1. 25 Mar, 2010 9 commits
    • Andrei Elkin's avatar
      merge from 5.1-bt rep · f05d9752
      Andrei Elkin authored
      f05d9752
    • Sergey Vojtovich's avatar
    • Andrei Elkin's avatar
      merging bug#52304 to 5.1-bt,pe · dc62faf4
      Andrei Elkin authored
      dc62faf4
    • Sergey Vojtovich's avatar
      5eff6aed
    • Sergey Vojtovich's avatar
      BUG#51866 - crash with repair by sort and fulltext keys · 41279865
      Sergey Vojtovich authored
      Repairing MyISAM table with fulltext indexes and low
      myisam_sort_buffer_size may crash the server.
      
      Estimation of number of index entries was done incorrectly,
      causing further assertion failure or server crash.
      
      Docs note: min value for myisam_sort_buffer_size has been
      changed from 4 to 4096.
      
      mysql-test/r/fulltext.result:
        A test case for BUG#51866.
      mysql-test/r/myisam.result:
        Min value for myisam_sort_buffer_size is 4096.
      mysql-test/r/variables.result:
        Min value for myisam_sort_buffer_size is 4096.
      mysql-test/suite/sys_vars/r/myisam_sort_buffer_size_basic_32.result:
        Min value for myisam_sort_buffer_size is 4096.
      mysql-test/t/fulltext.test:
        A test case for BUG#51866.
      sql/mysqld.cc:
        Min value for myisam_sort_buffer_size is 4096.
      storage/myisam/mi_check.c:
        When estimating number of index entries for external
        fulltext parser, take into account that key_length may
        be bigger than myisam_sort_buffer_size. Reuse logic
        from _create_index_by_sort(): force MIN_SORT_BUFFER to
        be min value for myisam_sort_buffer_size.
        
        Another problem is that ftkey_nr has no other meaning
        than serial number of fulltext index starting with 1.
        We can't say if this key using built-in or external
        parser basing on it's value. In other words we always
        entered if-branch for external parser. At this point,
        the only way to check if we use default parser is to
        compare keyinfo::parser with &ft_default_parser.
      storage/myisam/sort.c:
        Get rid of MIN_SORT_MEMORY, use MIN_SORT_BUFFER instead
        (defined in myisamdef.h, has the same value and purpose).
      41279865
    • Sergey Vojtovich's avatar
      e5c4f845
    • Sergey Vojtovich's avatar
      BUG#51877 - HANDLER interface causes invalid memory read · b57ef6d3
      Sergey Vojtovich authored
      Invalid memory read if HANDLER ... READ NEXT is executed
      after failed (e.g. empty table) HANDLER ... READ FIRST.
      
      The problem was that we attempted to perform READ NEXT,
      whereas there is no pivot available from failed READ FIRST.
      
      With this fix READ NEXT after failed READ FIRST equals
      to READ FIRST.
      
      This bug affects MyISAM tables only.
      
      mysql-test/r/gis-rtree.result:
        Restore a test case for BUG51357.
      mysql-test/r/handler_myisam.result:
        A test case for BUG#51877.
      mysql-test/t/gis-rtree.test:
        Restore a test case for BUG51357.
      mysql-test/t/handler_myisam.test:
        A test case for BUG#51877.
      storage/myisam/mi_rnext.c:
        "search first" failed. This means we have no pivot for
        "search next", or in other words MI_INFO::lastkey is
        likely uninitialized.
        
        Normally SQL layer would never request "search next" if
        "search first" failed. But HANDLER may do anything.
        
        As mi_rnext() without preceeding mi_rkey()/mi_rfirst()
        equals to mi_rfirst(), we must restore original state
        as if failing mi_rfirst() was not called.
      b57ef6d3
    • Sergey Vojtovich's avatar
      b3bdabe2
    • Sergey Vojtovich's avatar
      BUG#47598 - MyISAM may write uninitialized data to disk · 85094f3c
      Sergey Vojtovich authored
      When MyISAM writes newly created index page it may be
      initialized partially. In other words some bytes of
      sensible data and uninitialized tail of the page may
      go into index file.
      
      Under certain rare circumstances these hunks of memory
      may contain data that would be otherwise inaccessible
      to user, like passwords or data from other tables.
      
      Fixed by initializing memory for temporary MyISAM key
      buffer to '\0'.
      
      No test case for this fix as it is heavily covered by
      existing tests.
      
      storage/myisam/mi_open.c:
        When creating new MI_INFO object, initialize MI_INFO::buff.
        This is done to ensure that we never write uninitialized
        memory hunks to index file.
      storage/myisam/mi_page.c:
        No need to silence memory error detector anymore,
        page buffer is always initialized.
      storage/myisam/mi_write.c:
        Fixed invalid memory read of 2 bytes. new_right_length
        is length of data on a page, including first 2 bytes
        that store this length itself. pos + k_length is pure
        data excluding these 2 bytes containing length.
      storage/myisam/rt_index.c:
        To avoid uninitialized data write, create new page
        on info->buff, instead of locally allocated buffer.
        
        Note: second key block on info->buff is used here,
        because first block is used by called functions.
      storage/myisam/rt_split.c:
        To avoid uninitialized data write, create new page
        on info->buff, instead of locally allocated buffer.
      85094f3c
  2. 24 Mar, 2010 7 commits
    • Sergey Vojtovich's avatar
      5a9bad95
    • Sergey Vojtovich's avatar
      Applying InnoDB snapshot · ad849f01
      Sergey Vojtovich authored
      Detailed revision comments:
      
      r6822 | vasil | 2010-03-15 10:17:31 +0200 (Mon, 15 Mar 2010) | 12 lines
      branches/5.1:
      
      Typecast to silence a compiler warning:
      
      row/row0sel.c: 4548
              C4244: '=' : conversion from 'float' to 'ib_ulonglong', possible loss of data
      row/row0sel.c: 4553
              C4244: '=' : conversion from 'double' to 'ib_ulonglong', possible loss of data
      
      Reported by:	Jonas Oreland <Jonas.Oreland@Sun.COM>
      Discussed with:	Sunny Bains <sunny.bains@oracle.com>
      ad849f01
    • Sergey Vojtovich's avatar
      Applying InnoDB snapshot · fbfbdc21
      Sergey Vojtovich authored
      Detailed revision comments:
      
      r6785 | vasil | 2010-03-10 09:04:38 +0200 (Wed, 10 Mar 2010) | 11 lines
      branches/5.1:
      
      Add the missing --reap statements in innodb_bug38231.test. Probably MySQL
      enforced the presence of those recently and the test started failing like:
      
        main.innodb_bug38231                     [ fail ]
                Test ended at 2010-03-10 08:48:32
        
        CURRENT_TEST: main.innodb_bug38231
        mysqltest: At line 49: Cannot run query on connection between send and reap
      
      r6788 | vasil | 2010-03-10 10:53:21 +0200 (Wed, 10 Mar 2010) | 8 lines
      branches/5.1:
      
      In innodb_bug38231.test: replace the fragile sleep 0.2 that depends on timing
      with a more robust condition which waits for the TRUNCATE and LOCK commands
      to appear in information_schema.processlist. This could also break if there
      are other sessions executing the same SQL commands, but there are none during
      the execution of the mysql test.
      fbfbdc21
    • Sergey Vojtovich's avatar
      Applying InnoDB snapshot, fixes BUG#47621. · b0bf53aa
      Sergey Vojtovich authored
      Detailed revision comments:
      
      r6783 | jyang | 2010-03-09 17:54:14 +0200 (Tue, 09 Mar 2010) | 9 lines
      branches/5.1: Fix bug #47621 "MySQL and InnoDB data dictionaries
      will become out of sync when renaming columns". MySQL does not
      provide new column name information to storage engine to
      update the system table. To avoid column name mismatch, we shall
      just request a table copy for now.
      
      rb://246 approved by Marko.
      b0bf53aa
    • Sergey Vojtovich's avatar
      Applying InnoDB snapshot · 59583948
      Sergey Vojtovich authored
      Detailed revision comments:
      
      r6780 | vasil | 2010-03-08 19:13:20 +0200 (Mon, 08 Mar 2010) | 4 lines
      branches/5.1:
      
      Whitespace fixup.
      59583948
    • Sergey Vojtovich's avatar
      Applying InnoDB snapshot, fixes BUG#51653 · eb60a27a
      Sergey Vojtovich authored
      Detailed revision comments:
      
      r6774 | calvin | 2010-03-03 23:56:10 +0200 (Wed, 03 Mar 2010) | 2 lines
      branches/5.1: fix bug#51653: outdated reference to set-variable
      Non functional change.
      eb60a27a
    • Alexey Botchkov's avatar
      merging. · f3b8b07a
      Alexey Botchkov authored
      f3b8b07a
  3. 25 Mar, 2010 1 commit
  4. 24 Mar, 2010 4 commits
    • Kristofer Pettersson's avatar
      Bug#46615 Assertion in Query_cache::invalidate in INSERT in a VIEW of a MERGE table · ea7d830a
      Kristofer Pettersson authored
      If the listed columns in the view definition of 
      the table used in a 'INSERT .. SELECT ..'
      statement mismatched, a debug assertion would
      trigger in the cache invalidation code
      following the failing statement.
      
      Although the find_field_in_view() function
      correctly generated ER_BAD_FIELD_ERROR during
      setup_fields(), the error failed to propagate
      further than handle_select(). This patch fixes
      the issue by adding a check for the return
      value.
      
      
      mysql-test/r/query_cache_with_views.result:
        * added test for bug 46615
      mysql-test/t/query_cache_with_views.test:
        * added test for bug 46615
      sql/sql_parse.cc:
        * added check for handle_select() return code before attempting to invalidate the cache.
      ea7d830a
    • Alexey Botchkov's avatar
      merging. · 9a9501c2
      Alexey Botchkov authored
      9a9501c2
    • Sergey Glukhov's avatar
      5.0-bugteam->5.1-bugteam merge · fe25ec8f
      Sergey Glukhov authored
      fe25ec8f
    • Sergey Glukhov's avatar
      Bug#48483 crash in get_best_combination() · bccf219b
      Sergey Glukhov authored
      The crash happens because greedy_serach
      can not determine best plan due to
      wrong inner table dependences. These
      dependences affects join table sorting
      which performs before greedy_search starting.
      In our case table which has real 'no dependences'
      should be put on top of the list but it does not
      happen as inner tables have no dependences as well.
      The fix is to exclude RAND_TABLE_BIT mask from
      condition which checks if table dependences
      should be updated.
      
      
      mysql-test/r/join.result:
        test result
      mysql-test/t/join.test:
        test case
      sql/sql_select.cc:
        RAND_TABLE_BIT mask should not be counted as it
        prevents update of inner table dependences.
        For example it might happen if RAND() function
        is used in JOIN ON clause.
      bccf219b
  5. 23 Mar, 2010 2 commits
    • Georgi Kodinov's avatar
      Bug #51850: crash/memory overlap when using load data infile and set · a9a2ceae
      Georgi Kodinov authored
        col equal to itself!
      
      There's no need to copy the value of a field into itself.
      While generally harmless (except for some performance penalties)
      it may be dangerous when the copy code doesn't expect this.
      Fixed by checking if the source field is the same as the destination
      field before copying the data.
      Note that we must preserve the order of assignment of the null 
      flags (hence the null_value assignment addition).
      a9a2ceae
    • Andrei Elkin's avatar
      Bug #52304 valgrind does not like to print un-inited string in Protocol_text::store() · 649ec775
      Andrei Elkin authored
      The reason of the failure was apparent flaw in that a pointer to an uninitialized buffer was
      passed to DBUG_PRINT of Protocol_text::store().
      
      Fixed with splitting the print-out into two branches: 
      one with length zero of the problematic arg and the rest.
      
      
      sql/protocol.cc:
        correcting DBUG_PRINT to print out `from' with a care because one may be uninitialized in the caller.
      649ec775
  6. 22 Mar, 2010 7 commits
  7. 21 Mar, 2010 1 commit
  8. 19 Mar, 2010 5 commits
    • Sergey Glukhov's avatar
      Bug#51242 HAVING clause on table join produce incorrect results · ad6e00e3
      Sergey Glukhov authored
      The problem is that when we make conditon for
      grouped result const part of condition is cut off.
      It happens because some parts of 'having' condition
      which refer to outer join become const after
      make_join_statistics. These parts may be lost
      during further having condition transformation
      in JOIN::exec. The fix is adding 'having'
      condition check for const tables after
      make_join_statistics is performed.
      
      
      mysql-test/r/having.result:
        test case
      mysql-test/t/having.test:
        test result
      sql/sql_select.cc:
        added 'having' condition check for const tables
        after make_join_statistics is performed.
      ad6e00e3
    • Andrei Elkin's avatar
      Bug #51648 DBUG_SYNC_POINT is not defined on all platforms and mtr cant pre-check that · c3cd608a
      Andrei Elkin authored
      
      DBUG_SYNC_POINT has at least one strong limitation that it's not defined
      on all platforms. It has issues cooperating with @@debug.
      All in all its functionality is superseded by DEBUG_SYNC facility and
      there is no reason to maintain the old less flexible one.
      
      Fixed with adding debug_sync_set_action() function as a facility to set up
      a sync-action in the server sources code and re-writing existing simulations
      (found 3) to use it.
      Couple of tests have been reworked as well.
      
      The patch offers a pattern for setting sync-points in replication threads
      where the standard DEBUG_SYNC does not suffice to reach goals.
      
      
      
      
      
      mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test:
        rewriting the test from GET_LOCK()-based to DEBUG_SYNC-based;
        a pattern of usage DEBUG_SYNC for replication testing is provided.
      mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result:
        results are changed.
      mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test:
        rewriting the test from GET_LOCK()-based to DEBUG_SYNC-based;
        limiting the test to run only with MIXED binlog-format as the test last
        some 10 secs sensitively contributing to the total of tests run.
      mysql-test/suite/rpl/t/rpl_show_slave_running.test:
        rewriting the test from GET_LOCK()-based to DEBUG_SYNC-based.
      sql/debug_sync.cc:
        adding debug_sync_set_action() function as a facility to set up
        a sync-action in the server sources code.
      sql/debug_sync.h:
        externalizing debug_sync_set_action().
      sql/item_func.cc:
        purging sources from DBUG_SYNC_POINT.
      sql/mysql_priv.h:
        purging sources from DBUG_SYNC_POINT.
      sql/slave.cc:
        rewriting failure simulations to base on DEBUG_SYNC rather than GET_LOCK()-based DBUG_SYNC_POINT.
      sql/sql_repl.cc:
        removing an orphan failure simulation line because no counterpart in tests existing.
      c3cd608a
    • Martin Hansson's avatar
      Post-push fix to disable a subset of the test case for Bug#47762. · a76b8f9a
      Martin Hansson authored
      This has been back-ported from 6.0 as the problems proved to afflict 
      5.1 as well.
      The fix exposed two new bugs. They were reported as follows.
            
      Bug no 52174: Sometimes wrong plan when reading a MAX value 
      from non-NULL index
            
      Bug no 52173: Reading NULL value from non-NULL index gives wrong 
      result in embedded server 
            
      Both bugs taken together affect a much smaller class of queries than #47762, 
      so the fix stays for now.
      a76b8f9a
    • Sergey Glukhov's avatar
      Bug#51598 Inconsistent behaviour with a COALESCE statement inside an IN comparison · d1c2e850
      Sergey Glukhov authored
      Optimizer erroneously translated LEFT JOIN into INNER JOIN.
      It leads to cutting rows with NULL right side. It happens
      because Item_row uses not_null_tables() method form the
      base(Item) class and does not calculate 'null tables'
      properly. The fix is adding calculation of 'not null tables'
      to Item_row.
      
      
      mysql-test/r/join_outer.result:
        test result
      mysql-test/t/join_outer.test:
        test case
      sql/item_row.cc:
        adding calculation of 'not null tables' to Item_row.
      sql/item_row.h:
        adding calculation of 'not null tables' to Item_row.
      d1c2e850
    • Sergey Glukhov's avatar
      Bug#51494 crash with join, explain and 'sounds like' operator · caa1ccb0
      Sergey Glukhov authored
      The crash happens because of discrepancy between values of
      conts_tables and join->const_table_map(make_join_statisctics).
      Calculation of conts_tables used condition with
      HA_STATS_RECORDS_IS_EXACT flag check. Calculation of
      join->const_table_map does not use this flag check.
      In case of MERGE table without union with index
      the table does not become const table and
      thus join_read_const_table() is not called
      for the table. join->const_table_map supposes
      this table is const and later in make_join_select
      this table is used for making&calculation const
      condition. As table record buffer is not populated
      it leads to crash.
      The fix is adding a check if an engine supports
      HA_STATS_RECORDS_IS_EXACT flag before updating
      join->const_table_map.
      
      
      mysql-test/r/merge.result:
        test result
      mysql-test/t/merge.test:
        test case
      sql/sql_select.cc:
        adding a check if an engine supports
        HA_STATS_RECORDS_IS_EXACT flag before updating
        join->const_table_map.
      caa1ccb0
  9. 18 Mar, 2010 2 commits
  10. 17 Mar, 2010 2 commits
    • Mats Kindahl's avatar
      Merging with mysql-5.1-bugteam · 96d4a038
      Mats Kindahl authored
      96d4a038
    • Mats Kindahl's avatar
      BUG#49618: Field length stored incorrectly in binary log · 2c5f439d
      Mats Kindahl authored
                 for InnoDB
                  
      The class Field_bit_as_char stores the metadata for the
      field incorrecly because bytes_in_rec and bit_len are set
      to (field_length + 7 ) / 8 and 0 respectively, while
      Field_bit has the correct values field_length / 8 and
      field_length % 8.
                  
      Solved the problem by re-computing the values for the
      metadata based on the field_length instead of using the
      bytes_in_rec and bit_len variables.
                  
      To handle compatibility with old server, a table map
      flag was added to indicate that the bit computation is
      exact. If the flag is clear, the slave computes the
      number of bytes required to store the bit field and
      compares that instead, effectively allowing replication
      *without conversion* from any field length that require
      the same number of bytes to store.
      
      
      mysql-test/suite/rpl/t/rpl_typeconv_innodb.test:
        Adding test to check compatibility for bit field
        replication when using InnoDB
      sql/field.cc:
        Extending compatible_field_size() with flags from
        table map to allow fields to check master info.
      sql/field.h:
        Extending compatible_field_size() with flags from
        table map to allow fields to check master info.
      sql/log.cc:
        Removing table map flags since they are not used
        outside table map class.
      sql/log_event.cc:
        Removing flags parameter from table map constructor
        since it is not used and does not have to be exposed.
      sql/log_event.h:
        Adding flag to denote that bit length for bit field type
        is exact and not potentially rounded to even bytes.
      sql/rpl_utility.cc:
        Adding fields to table_def to store table map flags.
      sql/rpl_utility.h:
        Removing obsolete comment and adding flags to store
        table map flags from master.
      2c5f439d