1. 19 Nov, 2009 1 commit
    • Georgi Kodinov's avatar
      Bug #48665: sql-bench's insert test fails due to wrong result · 405c9310
      Georgi Kodinov authored
      When merging ranges during calculation of the result of OR
      to two range sets the current range may be obsoleted by the 
      resulting merged range.
      The first overlapping range can be obsoleted as well.
      
      Fixed by moving the pointer to the first overlapping range to the
      pointer of the resulting union range.
      Added few comments at key places in key_or().
      405c9310
  2. 20 Nov, 2009 2 commits
  3. 19 Nov, 2009 1 commit
    • Christopher Powers's avatar
      Bug #48739 MySQL crashes on specific INTERVAL in select query · c74609b1
      Christopher Powers authored
      Fixed crash caused by x64 int/long incompatibility introduced
      in Bug #29125.
      
      sql/item_timefunc.cc:
        Fixed crash caused by int/long incompatibility on x64 systems.
        
        Changed two "uint" casts and a "long" declartion to "int" in order to
        ensure that the integer sign is preserved.
        
        See Bug #48739 for details.
      c74609b1
  4. 18 Nov, 2009 7 commits
    • Georgi Kodinov's avatar
      Bug#48864: MySQL fails to compile on 64 bit Fedora 12 · ed9e3409
      Georgi Kodinov authored
      Fixed 2 errors in comp_err executable : 
      1. Wrong (off by 1) length passed to my_checksum()
      2. strmov() was used on overlapping strings. This is
       not legal according to the docs in stpcpy(). Used 
      the overlap safe memmove() instead.
      ed9e3409
    • Sven Sandberg's avatar
      BUG#47995: Mark system functions as unsafe · 2f78abd2
      Sven Sandberg authored
      Problem: Some system functions that could return different values on
      master and slave were not marked unsafe. In particular:
       GET_LOCK
       IS_FREE_LOCK
       IS_USED_LOCK
       MASTER_POS_WAIT
       RELEASE_LOCK
       SLEEP
       SYSDATE
       VERSION
      Fix: Mark these functions unsafe.
      
      
      mysql-test/extra/rpl_tests/rpl_stm_000001.test:
        - The test does not work in mixed mode any more, since it tries to
          simulate an error in the sql thread in a query that uses get_lock.
          Since get_lock now causes the query to be logged in row format,
          the error didn't happen. Hence, we now force statement mode.
        - Warnings must be disabled when the unsafe query is issued.
        - Replaced some save_master_pos+connection slave+sync_with_master
          by sync_slave_with_master.
      mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
        updated result file
      mysql-test/suite/binlog/r/binlog_stm_row.result:
        updated result file
      mysql-test/suite/binlog/r/binlog_unsafe.result:
        updated result file
      mysql-test/suite/binlog/t/binlog_killed.test:
        binlog_killed only works in statement format now, since
        it switches to row mode in mixed mode.
      mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test:
        suppress warnings for unsafe statements
      mysql-test/suite/binlog/t/binlog_stm_row.test:
        - Suppress warnings in test that causes warnings.
        - The test sets binlog format explicitly, so no need to execute it
          twice.
      mysql-test/suite/binlog/t/binlog_unsafe.test:
        Added test for all unsafe system functions. This test also includes
        system functions that were unsafe prior to BUG#47995.
      mysql-test/suite/rpl/r/rpl_err_ignoredtable.result:
        updated result file
      mysql-test/suite/rpl/r/rpl_get_lock.result:
        updated result file
      mysql-test/suite/rpl/r/rpl_nondeterministic_functions.result:
        new result file
      mysql-test/suite/rpl/r/rpl_stm_000001.result:
        updated result file
      mysql-test/suite/rpl/r/rpl_trigger.result:
        updated result file
      mysql-test/suite/rpl/t/rpl_err_ignoredtable.test:
        - suppress warnings for unsafe statement
        - replaced save_master_pos+connection slave+sync_with_master
          with sync_slave_with_master
      mysql-test/suite/rpl/t/rpl_get_lock.test:
        update test case that causes new warnings
      mysql-test/suite/rpl/t/rpl_nondeterministic_functions.test:
        Added new test case for nondeterministic functions.
      mysql-test/suite/rpl/t/rpl_trigger.test:
        update test case that causes new warnings
      sql/item_create.cc:
        Marked some system functions unsafe.
      sql/item_strfunc.cc:
        Clarified comment related to this bug.
      sql/sql_yacc.yy:
        Marked sysdate unsafe.
      2f78abd2
    • Jon Olav Hauglid's avatar
      Postfix for Bug #47682 strange behaviour of INSERT DELAYED · 7524b961
      Jon Olav Hauglid authored
      Fixed a problem with the test case when executed with ps-protocol.
      There the conflicing lock would be noticed during prepare, not
      during execution of the insert - leading to a different (but 
      equally appropriate) error message.
      7524b961
    • Mattias Jonsson's avatar
      merge · f6ec131f
      Mattias Jonsson authored
      f6ec131f
    • Magne Mahre's avatar
      merge · 58f43459
      Magne Mahre authored
      58f43459
    • Magne Mahre's avatar
      Bug #46425 crash in Diagnostics_area::set_ok_status , empty statement, · 3987c7ac
      Magne Mahre authored
                 DELETE IGNORE
      
      The ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG error was set in the
      diagnostics area when it happened, but the DELETE cleanup code
      never checked for a non-fatal error condition, thus trying to
      set diag.area to "ok".  This triggered an assert checking that
      the diag.area was empty.
      
      The fix was to test if there existed a non-fatal error condition
      (thd->is_error() before ok'ing the operation.
      3987c7ac
    • Jon Olav Hauglid's avatar
      Bug #47682 strange behaviour of INSERT DELAYED · 41ba4292
      Jon Olav Hauglid authored
      The problem was a "self-deadlock" if the connection issuing INSERT DELAYED
      had both the global read lock (FLUSH TABLES WITH READ LOCK) and LOCK TABLES
      mode active. The table being inserted into had to be different from the 
      table(s) locked by LOCK TABLES.
      
      For INSERT DELAYED, the connection thread waits until the handler thread has
      opened and locked its table before returning. But since the global read lock
      was active, the handler thread would be unable to lock and would wait for the
      global read lock to go away.
      
      So the handler thread would be waiting for the connection thread to release
      the global read lock while the connection thread was waiting for the handler
      thread to lock the table. This gave a "self-deadlock" (same connection,
      different threads).
      
      The deadlock would only happen if we also had LOCK TABLES mode since the
      INSERT otherwise will try to get protection against global read lock before
      starting the handler thread. It will then notice that the global read lock
      is owned by the same connection and report ER_CANT_UPDATE_WITH_READLOCK.
      
      This patch removes the deadlock by reporting ER_CANT_UPDATE_WITH_READLOCK
      also if we are inside LOCK TABLES mode.
      
      Test case added to delayed.test.
      41ba4292
  5. 17 Nov, 2009 7 commits
  6. 13 Nov, 2009 1 commit
    • Jorgen Loland's avatar
      Bug#48052: Valgrind warning - uninitialized value in · a120e969
      Jorgen Loland authored
                 init_read_record() - (records.cc:274)
            
      Item_cond::used_tables_cache was accessed in
      records.cc#init_read_record() without being initialized. It had
      not been initialized because it was wrongly assumed that the
      Item's variables would not be accessed, and hence
      quick_fix_field() was used instead of fix_fields() to save a few
      CPU cycles at creation time.
      
      The fix is to properly initilize the Item by replacing
      quick_fix_field() with fix_fields().
      
      
      mysql-test/r/select.result:
        Add test for BUG#48052
      mysql-test/t/select.test:
        Add test for BUG#48052
      sql/sql_select.cc:
        Properly initialize Item_cond_and by calling fix_fields (instead of quick_fix_field) when the Item that "ANDs" WHERE clause conditions with HAVING clause conditions is created.
      a120e969
  7. 12 Nov, 2009 4 commits
  8. 11 Nov, 2009 2 commits
    • Christopher Powers's avatar
      Merge · 8c3233b0
      Christopher Powers authored
      8c3233b0
    • Anurag Shekhar's avatar
      Bug #47012 archive tables are not upgradeable, and server crashes · c8737515
      Anurag Shekhar authored
             on any access
      
      Archive engine for 5.1 (and latter) version uses a modified 
      version of zlib (azlib). These two version are incompatible
      so a proper upgrade is needed before tables created in 5.0 
      can be used reliable.
      
      This upgrade can be performed using repair. But due to lack 
      of test its risky to allow upgrade for now. This patch addresses
      only the crashing issue. Any attempt to repair will be blocked.
      
      Eventually repair can be allowed to run through (which will also
      cause an upgrade from older version to newer) but only after a 
      thorough testing.
      
      mysql-test/r/archive.result:
        Updated result file for test case for bug#47012
      mysql-test/std_data/bug47012.ARM:
        part of archive table (t1) created in mysql 5.0
      mysql-test/std_data/bug47012.ARZ:
        part of archive table (t1) created in mysql 5.0
      mysql-test/std_data/bug47012.frm:
        part of archive table (t1) created in mysql 5.0
      mysql-test/t/archive.test:
        Added test case for bug#47012.
      storage/archive/azio.c:
        Fixed a minor issues (minor version overwriting version in 
        stream structure)
        Removed assertion when an older version is found. Instead
        setting the correct version (2) in s->version
        If an unknown version is found marked it as corrupt.
      storage/archive/ha_archive.cc:
        Detecting the archive version in getShare and marking
        it as need to upgrade.
        Blocking open if the archive needs an upgrade. This
        can be allowed in case of open for repair to upgrade
        the archive but needs to tested.
      c8737515
  9. 10 Nov, 2009 1 commit
    • Christopher Powers's avatar
      Bug#47382 'mysqladmin debug' crash on 64-bit Windows · e0cb24c3
      Christopher Powers authored
      The crash occurs because SAFEMALLOC is defined for the MySQL server
      but not for the Archive or Federated engines, resulting in a 
      parameter mismatch between the function prototype and definition
      for functions using the CALLER_INFO macro.
      
      storage/archive/CMakeLists.txt:
        Set SAFEMALLOC by default to be consistent with the server.
      storage/federated/CMakeLists.txt:
        Set SAFEMALLOC by default to be consistent with the server.
      e0cb24c3
  10. 09 Nov, 2009 1 commit
    • Georgi Kodinov's avatar
      Bug #48458: simple query tries to allocate enormous amount of · 4519d5e4
      Georgi Kodinov authored
        memory
      
      The server was doing a bad class typecast causing setting of 
      wrong value for the maximum number of items in an internal
      structure used in equality propagation.
      Fixed by not doing the wrong typecast and asserting the type
      of the Item where it should be done.
      4519d5e4
  11. 10 Nov, 2009 1 commit
    • Georgi Kodinov's avatar
      Bug #42760: Select doesn't return desired results when we have null · ddd90017
      Georgi Kodinov authored
       values
       
       We should re-set the access method functions when changing the access
       method when switching to another index to avoid sorting.
       
       Fixed by doing a little re-engineering : encapsulating all the function
       assignment into a special function and calling it when flipping the 
       indexes.
      ddd90017
  12. 09 Nov, 2009 1 commit
    • Mattias Jonsson's avatar
      Bug#48276: can't add column if subpartition exists · 785b5c4e
      Mattias Jonsson authored
      Bug when setting up default partitioning,
      used an uninitialized variabe.
      
      mysql-test/r/partition.result:
        Bug#48276: can't add column if subpartition exists
        
        Added result
      mysql-test/t/partition.test:
        Bug#48276: can't add column if subpartition exists
        
        Added test
      sql/sql_partition.cc:
        Bug#48276: can't add column if subpartition exists
        
        even if is_create_table_ind was set, one tried to set no_subparts
        with the unitialized no_parts local variable.
        
        Fixed by rearrange the code to be to only execute
        the statements when is_create_table_ind was not set.
      785b5c4e
  13. 06 Nov, 2009 8 commits
    • Evgeny Potemkin's avatar
      Auto-merged fix for the bug#34384. · 5594215c
      Evgeny Potemkin authored
      5594215c
    • Evgeny Potemkin's avatar
      Bug#34384: Slow down on constant conversion. · c81e2345
      Evgeny Potemkin authored
      When values of different types are compared they're converted to a type that
      allows correct comparison. This conversion is done for each comparison and
      takes some time. When a constant is being compared it's possible to cache the
      value after conversion to speedup comparison. In some cases (large dataset,
      complex WHERE condition with many type conversions) query might be executed
      7% faster.
      
      A test case isn't provided because all changes are internal and isn't visible
      outside.
      
      The behavior of the Item_cache is changed to cache values on the first request
      of cached value rather than at the moment of storing item to be cached.
      A flag named value_cached is added to the Item_cache class. It's set to TRUE
      when cache holds the value of the last stored item.
      Function named cache_value() is added to the Item_cache class and derived classes.
      This function actually caches the value of the saved item.
      Item_cache_xxx::store functions now only store item to be cached and set
      value_cached flag to FALSE.
      Item_cache_xxx::val_xxx functions are changed to call cache_value function
      prior to returning cached value if value_cached is FALSE.
      The Arg_comparator::set_cmp_func function now calls cache_converted_constant
      to cache constants if they need a type conversion.
      The Item_cache::get_cache function is overloaded to allow setting of the
      cache type.
      The cache_converted_constant function is added to the Arg_comparator class.
      It checks whether a value can and should be cached and if so caches it.
      
      sql/item.cc:
        Bug#34384: Slow down on constant conversion.
        Function named cache_value() is added to the Item_cache class and derived classes.
        This function actually caches the value of the saved item.
        Item_cache_xxx::store functions now only store item to be cached and set
        value_cached flag to FALSE.
        Item_cache_xxx::val_xxx functions are changed to call cache_value function
        prior to returning cached value if value_cached is FALSE.
        The Item_cache::get_cache function is overloaded to allow setting of the
        cache type.
      sql/item.h:
        Bug#34384: Slow down on constant conversion.
        A flag named value_cached is added to the Item_cache class. It's set to TRUE
        when we need to start caching values when the store method is called.
        Function named cache_value() is added to the Item_cache class and derived classes.
      sql/item_cmpfunc.cc:
        Bug#34384: Slow down on constant conversion.
        A helper function cache_converted_constant is added to the Arg_comparator class.
        It checks whether a given item can and should be cached and caches it if so.
        The Arg_comparator::set_cmp_func function now calls cache_converted_constant
        to cache constants if they need a type conversion.
      sql/item_cmpfunc.h:
        Bug#34384: Slow down on constant conversion.
        The cache_converted_constant function is added to the Arg_comparator class.
        It checks whether a value can and should be cached and if so caches it.
      sql/item_subselect.cc:
        Bug#34384: Slow down on constant conversion.
        Force immediate caching of subselect result.
      sql/item_xmlfunc.cc:
        Bug#34384: Slow down on constant conversion.
      sql/sp_rcontext.cc:
        Bug#34384: Slow down on constant conversion.
        Force immediate caching of values of an SP CASE function.
      c81e2345
    • Luis Soares's avatar
    • Alexey Kopytov's avatar
      Automerge. · 40587d0c
      Alexey Kopytov authored
      40587d0c
    • Alexey Kopytov's avatar
      Automerge. · ee049964
      Alexey Kopytov authored
      ee049964
    • Alexey Kopytov's avatar
      Automerge. · 58ee6c80
      Alexey Kopytov authored
      58ee6c80
    • Alexey Kopytov's avatar
      Automerge. · 05c4f3f3
      Alexey Kopytov authored
      05c4f3f3
    • Alexey Kopytov's avatar
      Bug #48475: DISTINCT is ignored with GROUP BY WITH ROLLUP and · 39f9a3ff
      Alexey Kopytov authored
                  only const tables
      
      The problem was caused by two shortcuts in the optimizer that
      are inapplicable in the ROLLUP case.
      
      Normally in a case when only const tables are involved in a
      query, DISTINCT clause can be safely optimized away since there
      may be only one row produced by the join. Similarly, we don't
      need to create a temporary table to resolve DISTINCT/GROUP
      BY/ORDER BY. Both of these are inapplicable when the WITH
      ROLLUP modifier is present.
      
      Fixed by disabling the said optimizations for the WITH ROLLUP
      case.
      
      mysql-test/r/olap.result:
        Added a test case for bug #48475.
      mysql-test/t/olap.test:
        Added a test case for bug #48475.
      sql/sql_select.cc:
        Disabled const-only table optimizations for the WITH ROLLUP
        case.
      39f9a3ff
  14. 04 Nov, 2009 3 commits