1. 14 Nov, 2008 3 commits
    • Gleb Shchepa's avatar
      Bug #40021: Renaming view fails, archived .frm for view is · 56b9586f
      Gleb Shchepa authored
                  missing after downgrade
      
      Obsolete arc/ directory and view .frm file backup support
      has been removed by the patch for bug 17823. However, that
      bugfix caused a problem with "live downgrades" of the
      server: if we rename some view 4 times under 5.1.29/5.0.72
      and then try to rename it under 5.1.28/5.0.70 on the same
      database, the server fails with a error:
      
        query 'RENAME TABLE ... TO ...' failed: 6: Error on
        delete of '....frm-0001' (Errcode: 2)
      
      Also .frm file of that view may be lost (renamed to .frm~).
      
      The server failed because it tried to rename latest 3
      backup .frm files renaming the view: the server used an
      integer value of the "revision" field of .frm file to
      extract those file names. After the fix for bug 17823 those
      files were not created/maintained any more, however the
      "revision" field was incremented as usual. So, the server
      failed renaming non existent files.
      
      This fix solves the problem by removing the support for
      "revision" .frm file field:
      1. New server silently ignores existent "revision" fields
         in old .frm files and never write it down;
      2. Old server assumes, that missing "revision" field in new
         .frm files means default value of 0.
      3. Accordingly to the fix for bug 17823 the new server
         drops arc/ directory on alter/rename view, so after
         "live downgrade" old server begins maintenance of the
         arc/ directory from scratch without conflicts with .frm
         files.
      
      
      sql/parse_file.cc:
        Bug #40021: Renaming view fails, archived .frm for view is
                    missing after downgrade
        
        1. static write_parameter(): the old_version parameter
           and the section for FILE_OPTIONS_REV have been re moved.
        2. write_parameter(): the max_versions parameter has been
           removed;
        3. sql_create_definition_file(): removal of dead code;
        4. rename_in_schema_file(): revision and num_view_backups
           parameters and dead code have been removed;
        5. File_parser::parse(): FILE_OPTIONS_REV section has been
           removed.
      sql/parse_file.h:
        Bug #40021: Renaming view fails, archived .frm for view is
                    missing after downgrade
        
        1. The FILE_OPTIONS_REV constant has been removed.
        2. sql_create_definition_file and rename_in_schema_file
           functions: obsolete versions, revision and
           num_view_backups parameters have been removed.
      sql/sql_db.cc:
        Bug #40021: Renaming view fails, archived .frm for view is
                    missing after downgrade
        
        Commentary update.
      sql/sql_trigger.cc:
        Bug #40021: Renaming view fails, archived .frm for view is
                    missing after downgrade
        
        sql_create_definition_file() calls have been updates to
        new parameter lists.
      sql/sql_view.cc:
        Bug #40021: Renaming view fails, archived .frm for view is
                    missing after downgrade
        
        1. The mysql_create_view function code is used for both
           CREATE VIEW and ALTER queries, but query cache is
           necessary for ALTER command only. Check for a non first
           view revision has been replaced with a direct check for
           ALTER query.
        2. The num_view_backups global constant has been removed.
        3. view_parameters: the "revision" .frm field support has
           been removed.
        4. sql_create_definition_file and rename_in_schema_file
           function calls have been updates to new parameter lists.
      sql/table.h:
        Bug #40021: Renaming view fails, archived .frm for view is
                    missing after downgrade
        
        TABLE_LIST: the revision field has been removed.
      56b9586f
    • Ramil Kalimullin's avatar
      Test case for bug #34774: key prefix on text field in federated · dbc062bf
      Ramil Kalimullin authored
      tables can cause server to crash!
      
      The bug will be fixed by patch for #34779: "crash in checksum table
      on federated tables with blobs containing nulls"
      
      Only a test case commited.
      
      
      mysql-test/r/federated.result:
        Test case for bug #34774: key prefix on text field in federated 
        tables can cause server to crash!
          - test result.
      mysql-test/t/federated.test:
        Test case for bug #34774: key prefix on text field in federated 
        tables can cause server to crash!
          - test case.
      dbc062bf
    • Ramil Kalimullin's avatar
      Fix for bug#37527: mysqlcheck fails to report entire database · e3de8d36
      Ramil Kalimullin authored
      when InnoDB frm file corruption
      
      Problem: mysqlcheck runs 'SHOW FULL TABLE' queries to get table lists.
      The query may fail for some reasons (e.g. null .frm file) then
      mysqlcheck doesn't process the database tables.
      
      Fix: try to run 'SHOW TABLES' if 'SHOW FULL TABLES' failed.
      
      
      client/mysqlcheck.c:
        Fix for bug#37527: mysqlcheck fails to report entire database 
        when InnoDB frm file corruption
          - run "SHOW TABLES" query if "SHOW /*!50002 FULL*/ TABLES" failed;
          - print error info if both failed.
      mysql-test/r/mysqlcheck.result:
        Fix for bug#37527: mysqlcheck fails to report entire database 
        when InnoDB frm file corruption
          - test result.
      mysql-test/t/mysqlcheck.test:
        Fix for bug#37527: mysqlcheck fails to report entire database 
        when InnoDB frm file corruption
          - test case.
      e3de8d36
  2. 13 Nov, 2008 2 commits
  3. 10 Nov, 2008 1 commit
  4. 06 Nov, 2008 4 commits
  5. 03 Nov, 2008 1 commit
  6. 31 Oct, 2008 1 commit
  7. 27 Oct, 2008 1 commit
    • Sergey Glukhov's avatar
      Bug#39040 valgrind errors/crash when creating views with binlog logging enabled · 380f1a84
      Sergey Glukhov authored
      A string buffers which were included in the 'view' data structure
      were allocated on the stack, causing an invalid pointer when used
      after the function returned.
      The fix: use copy of values for view->md5 & view->queries
      
      
      mysql-test/r/view.result:
        test result
      mysql-test/t/view.test:
        test case
      sql/sql_view.cc:
        A string buffers which were included in the 'view' data structure
        were allocated on the stack, causing an invalid pointer when used
        after the function returned.
        The fix: use copy of values for view->md5 & view->queries
      380f1a84
  8. 26 Oct, 2008 2 commits
  9. 24 Oct, 2008 3 commits
    • unknown's avatar
      Raise version number after cloning 5.0.72 · 408523b7
      unknown authored
      408523b7
    • Sergey Petrunia's avatar
      Merge · d5202ddd
      Sergey Petrunia authored
      d5202ddd
    • Sergey Petrunia's avatar
      BUG#38072: Wrong result: HAVING not observed in a query with aggregate · 844797c4
      Sergey Petrunia authored
      - Make send_row_on_empty_set() return FALSE when simplify_cond() has found out
        that HAVING is always FALSE
      re-committing to put the fix into 5.0 and 5.1
      
      mysql-test/r/group_by.result:
        BUG#38072: Wrong result: HAVING not observed in a query with aggregate
        - Testcase
      mysql-test/t/group_by.test:
        BUG#38072: Wrong result: HAVING not observed in a query with aggregate
        - Testcase
      sql/sql_select.h:
        BUG#38072: Wrong result: HAVING not observed in a query with aggregate
        - Make send_row_on_empty_set() return FALSE when simplify_cond() has found out
          that HAVING is always FALSE
      844797c4
  10. 23 Oct, 2008 4 commits
  11. 21 Oct, 2008 4 commits
    • Davi Arnaut's avatar
      Post-merge fix: drop table at the end of test. · 07b7261a
      Davi Arnaut authored
      mysql-test/r/xa.result:
        Update test case result.
      mysql-test/t/xa.test:
        Drop table used for test.
      07b7261a
    • Davi Arnaut's avatar
      Bug#28323: Server crashed in xid cache operations · 41dd7b6b
      Davi Arnaut authored
      The problem was that the server did not robustly handle a
      unilateral roll back issued by the Resource Manager (RM)
      due to a resource deadlock within the transaction branch.
      By not acknowledging the roll back, the server (TM) would
      eventually corrupt the XA transaction state and crash.
      
      The solution is to mark the transaction as rollback-only
      if the RM indicates that it rolled back its branch of the
      transaction.
      
      mysql-test/r/xa.result:
        Add test case result for Bug#28323
      mysql-test/t/xa.test:
        Add test case for Bug#28323
      sql/handler.cc:
        Reset XID only at the end of the global transaction.
      sql/share/errmsg.txt:
        Add new error codes.
      sql/sql_class.h:
        Remember the error reported by the Resource Manager.
      sql/sql_parse.cc:
        Rollback the transaction if the Resource Manager reported
        a error and rolled back its branch of the transaction.
      41dd7b6b
    • Davi Arnaut's avatar
      Bug#28323: Server crashed in xid cache operations · 9ad8d644
      Davi Arnaut authored
      The problem was that the server did not robustly handle a
      unilateral roll back issued by the Resource Manager (RM)
      due to a resource deadlock within the transaction branch.
      By not acknowledging the roll back, the server (TM) would
      eventually corrupt the XA transaction state and crash.
      
      The solution is to mark the transaction as rollback-only
      if the RM indicates that it rolled back its branch of the
      transaction.
      
      mysql-test/r/xa.result:
        Add test case result for Bug#28323
      mysql-test/t/xa.test:
        Add test case for Bug#28323
      sql/handler.cc:
        Reset XID only at the end of the global transaction.
      sql/share/errmsg.txt:
        Add new error codes.
      sql/sql_class.h:
        Remember the error reported by the Resource Manager.
      sql/sql_parse.cc:
        Rollback the transaction if the Resource Manager reported
        a error and rolled back its branch of the transaction.
      9ad8d644
    • unknown's avatar
      Merge from mysql-5.0.70-release · 4927d707
      unknown authored
      4927d707
  12. 20 Oct, 2008 2 commits
  13. 17 Oct, 2008 2 commits
    • Georgi Kodinov's avatar
      Bug #33811: Call to stored procedure with SELECT * / RIGHT JOIN · 697b2839
      Georgi Kodinov authored
      fails after the first time
        
      Two separate problems : 
        1. When flattening joins the linked list used for name resolution 
        (next_name_resolution_table) was not updated.
        Fixed by updating the pointers when extending the table list
        
        2. The items created by expanding a * (star) as a column reference
        were marked as fixed, but no cached table was assigned to them 
        (unlike what Item_field::fix_fields does).
        Fixed by assigning a cached table (so the re-preparation is done
        faster).
        
      Note that the fix for #2 hides the fix for #1 in most cases
      (except when a table reference cannot be cached).
      
      mysql-test/r/sp.result:
        Bug #33811: test case
      mysql-test/t/sp.test:
        Bug #33811: test case
      sql/sql_base.cc:
        Bug #33811: cache the table for Item_fields created by expanding '*'
      sql/sql_select.cc:
        Bug #33811: maintain a correct name resolution chain when
        flattening joins.
      697b2839
    • Georgi Kodinov's avatar
      merged 5.0-bugteam -> bug 39958 · 0f678ee6
      Georgi Kodinov authored
      0f678ee6
  14. 16 Oct, 2008 2 commits
    • Gleb Shchepa's avatar
      Bug #39844: Query Crash Mysql Server 5.0.67 · b5917934
      Gleb Shchepa authored
      Server crashed during a sort order optimization
      of a dependent subquery:
      
      SELECT
          (SELECT t1.a FROM t1, t2
            WHERE t1.a = t2.b AND t2.a = t3.c
            ORDER BY t1.a)
        FROM t3;
      
      
      Bitmap of tables, that the reference to outer table
      column uses, in addition to the regular table bit
      has the OUTER_REF_TABLE_BIT bit set.
      The only_eq_ref_tables function traverses this map
      bit by bit simultaneously with join->map2table list.
      Obviously join->map2table never contains an entry
      for the OUTER_REF_TABLE_BIT pseudo-table, so the
      server crashed there.
      
      
      The only_eq_ref_tables function has been modified
      to traverse regular table bits only like the
      update_depend_map function (resetting of the
      OUTER_REF_TABLE_BIT there is enough, but
      resetting of the whole set of PSEUDO_TABLE_BITS
      is used there for sure).
      
      
      mysql-test/r/order_by.result:
        Added test case for bug #39844.
      mysql-test/t/order_by.test:
        Added test case for bug #39844.
      sql/sql_select.cc:
        Bug #39844: Query Crash Mysql Server 5.0.67
        
        The only_eq_ref_tables function has been modified
        to traverse regular table bits only like the
        update_depend_map function (resetting of the
        OUTER_REF_TABLE_BIT there is enough, but
        resetting of the whole set of PSEUDO_TABLE_BITS
        is used there for sure).
      b5917934
    • Georgi Kodinov's avatar
      Bug #39958: Test "windows" lacks a cleanup · ca6e0576
      Georgi Kodinov authored
      Added the missing DROP TABLE
      
      mysql-test/r/windows.result:
        Bug #39958: added the missing DROP TABLE
      mysql-test/t/windows.test:
        Bug #39958: added the missing DROP TABLE
      ca6e0576
  15. 15 Oct, 2008 3 commits
    • Davi Arnaut's avatar
      Bug#37075: offset of limit clause might be truncated on 32-bits server w/o big tables · 3ad228d7
      Davi Arnaut authored
      The problem is that the offset argument of the limit clause
      might be truncated on a 32-bits server built without big
      tables support. The truncation was happening because the
      original 64-bits long argument was being cast to a 32-bits
      (ha_rows) offset counter.
      
      The solution is to check if the conversing resulted in value
      truncation and if so, the offset is set to the maximum possible
      value that can fit on the type.
      
      mysql-test/r/limit.result:
        Add test case result for Bug#37075
      mysql-test/t/limit.test:
        Add test case for Bug#37075
      sql/sql_lex.cc:
        Check for truncation of the offset value. If value was
        truncated, set to the maximum possible value.
      3ad228d7
    • Georgi Kodinov's avatar
      Bug #38693: leaked memory with blobs! · 74735183
      Georgi Kodinov authored
      If delayed insert fails to upgrade the lock it was not
      freeing the temporary memory storage used to keep
      newly constructed blob values in memory.
      Fixed by iterating over the remaining rows in the delayed
      insert rowset and freeing the blob storage for each row.
      
      No test suite because it involves concurrent delayed inserts 
      on a table and cannot easily be made deterministic. 
      
      Added a correct valgrind suppression for Fedora 9.
      
      mysql-test/valgrind.supp:
        Added a vagrind suppression for Fedora 9
      sql/sql_insert.cc:
        Bug #38693: free the blobs temp storage on error.
      74735183
    • Kristofer Pettersson's avatar
      automerge · 7fa3897e
      Kristofer Pettersson authored
      7fa3897e
  16. 14 Oct, 2008 1 commit
    • Davi Arnaut's avatar
      Bug#38823: Invalid memory access when a SP statement does wildcard expansion · 017307f2
      Davi Arnaut authored
      The problem is that field names constructed due to wild-card
      expansion done inside a stored procedure could point to freed
      memory if the expansion was performed after the first call to
      the stored procedure.
      
      The problem was solved by patch for Bug#38691. The solution
      was to allocate the database, table and field names in the
      in the statement memory instead of table memory.
      
      mysql-test/r/sp.result:
        Add test case result for Bug#38823
      mysql-test/t/sp.test:
        Add test case for Bug#38823
      sql/item.cc:
        Remark that this also impacts wildcard expansion inside SPs.
      017307f2
  17. 13 Oct, 2008 1 commit
  18. 10 Oct, 2008 3 commits
    • Joerg Bruehe's avatar
      Merge from main 5.0 branch -> 5.0-build · 8acc0f55
      Joerg Bruehe authored
      Merge conflicts in test "create:
      - for "create.result", handled correctly by "bzr extmerge" (using "kdiff3"),
      - for "create.test", not reported as a conflict, but merged wrong
        (new block at the test end got duplicated), fixed manually.
      
      Test on Linux (Debian, PowerPC) was ok.
      8acc0f55
    • Georgi Kodinov's avatar
      merged 5.0-main -> 5.0-bugteam · 9b6347f0
      Georgi Kodinov authored
      9b6347f0
    • Gleb Shchepa's avatar
      Bug #37894: Assertion in init_read_record_seq in handler.h line 1444 · 097b60bd
      Gleb Shchepa authored
      Select with a "NULL NOT IN" condition containing complex
      subselect from the same table as in the outer select failed
      with an assertion.
      
      
      The failure was caused by a concatenation of circumstances:
      1) an inner select was optimized by make_join_statistics to use
         the QUICK_RANGE_SELECT access method (that implies an index
         scan of the table);
      2) a subselect was independent (constant) from the outer select;
      3) a condition was pushed down into inner select.
      
      During the evaluation of a constant IN expression an optimizer
      temporary changed the access method from index scan to table
      scan, but an engine handler was already initialized for index
      access by make_join_statistics. That caused an assertion.
      
      
      Unnecessary index initialization has been removed from
      the QUICK_RANGE_SELECT::init method (QUICK_RANGE_SELECT::reset
      reinvokes this initialization).
      
      
      mysql-test/r/subselect3.result:
        Added test case for bug #37894.
      mysql-test/t/subselect3.test:
        Added test case for bug #37894.
      sql/opt_range.cc:
        Bug #37894: Assertion in init_read_record_seq in handler.h line 1444
        
        Unnecessary index initialization has been removed from
        the QUICK_RANGE_SELECT::init method (QUICK_RANGE_SELECT::reset
        reinvokes this initialization).
      097b60bd