1. 12 Jun, 2012 2 commits
    • Igor Babaev's avatar
      Merge. · 01cd1235
      Igor Babaev authored
      01cd1235
    • Igor Babaev's avatar
      Fixed LP bug #1008293. · 7b32d88c
      Igor Babaev authored
      One of the reported problems manifested itself in the scenario when one
      thread tried to to get statistics on a key cache while the second thread
      had not finished initialization of the key cache structure yet. 
      The problem was resolved by forcing serialization of such operations
      on key caches.
      
      To serialize function calls to perform certain operations over a key cache
      a new mutex associated with the key cache now is used. It is stored in the
      field op_lock of the KEY_CACHE structure. It is locked when the operation
      is performed. Some of the serialized key cache operations utilize calls 
      for other key cache operations. To avoid recursive locking of op_lock
      the new functions that perform the operations of key cache initialization,
      destruction and re-partitioning with an additional parameter were introduced.
      The parameter says whether the operation over op_lock are to be performed or
      are to be omitted. The old functions for the operations of key cache 
      initialization, destruction,and  re-partitioning  now just call the
      corresponding new functions with the additional parameter set to true
      requesting to use op_lock while all other calls of these new function
      have this parameter set to false. 
      
      Another problem reported in the bug entry concerned the operation of
      assigning an index to a key cache. This operation can be called
      while the key cache structures are not initialized yet. In this
      case any call of flush_key_blocks() should return without any actions.
      
      No test case is provided with this patch.
      7b32d88c
  2. 10 Jun, 2012 2 commits
  3. 01 Jun, 2012 2 commits
  4. 25 May, 2012 1 commit
  5. 23 May, 2012 1 commit
    • unknown's avatar
      Fix bug lp:1001506 · d56f5dae
      unknown authored
      This is a backport of the (unchaged) fix for MySQL bug #11764372, 57197.
      
      Analysis:
      
      When the outer query finishes its main execution and computes GROUP BY,
      it needs to construct a new temporary table (and a corresponding JOIN) to
      execute the last DISTINCT operation. At this point JOIN::exec calls
      JOIN::join_free, which calls JOIN::cleanup -> TMP_TABLE_PARAM::cleanup
      for both the outer and the inner JOINs. The call to the inner
      TMP_TABLE_PARAM::cleanup sets copy_field = NULL, but not copy_field_end.
      
      The final execution phase that computes the DISTINCT invokes:
      evaluate_join_record -> end_write -> copy_funcs
      The last function copies the results of all functions into the temp table.
      copy_funcs walks over all functions in join->tmp_table_param.items_to_copy.
      In this case items_to_copy contains both assignments to user variables.
      The process of copying user variables invokes Item_func_set_user_var::check
      which in turn re-evaluates the arguments of the user variable assignment.
      This in turn triggers re-evaluation of the subquery, and ultimately
      copy_field.
      
      However, the previous call to TMP_TABLE_PARAM::cleanup for the subquery
      already set copy_field to NULL but not its copy_field_end. This results
      in a null pointer access, and a crash.
      
      Fix:
      Set copy_field_end and save_copy_field_end to null when deleting
      copy fields in TMP_TABLE_PARAM::cleanup().
      d56f5dae
  6. 22 May, 2012 1 commit
  7. 18 May, 2012 2 commits
  8. 17 May, 2012 2 commits
  9. 12 May, 2012 2 commits
  10. 11 May, 2012 1 commit
    • unknown's avatar
      fix for LP bug#994392 · f2cbc014
      unknown authored
      The not_null_tables() of Item_func_not_all and Item_in_optimizer was inherited from
      Item_func by mistake. It made the optimizer think that  subquery
      predicates with ALL/ANY/IN were null-rejecting. This could trigger invalid
      conversions of outer joins into inner joins.
      f2cbc014
  11. 10 May, 2012 1 commit
  12. 08 May, 2012 1 commit
    • Vladislav Vaintroub's avatar
      MDEV-262 : log_state occationally fails in buildbot. · 54534a69
      Vladislav Vaintroub authored
      The failures are  missing entries in the slow query log.  The reason for the failure  are sleep() calls  with short duration 10ms, which is less than the default system timer resolution for various WaitForXXXObject functions  (15.6 ms) and thus can't work reliably.
      The fix is to make sleeps tiny bit longer (20ms from 10ms) in the test.
      54534a69
  13. 07 May, 2012 3 commits
    • Vladislav Vaintroub's avatar
      MDEV-261 : mysqtest crashes when assigning variable to result of select , like · 597e98bc
      Vladislav Vaintroub authored
      let x = `SELECT <something>`
      
      The fix is to detect the condition "no active connection",  to report error and die.
      Note, that the check for no active connection was already in place for ordinary commands, 
      and was missing only for assign-variable command.
      597e98bc
    • unknown's avatar
      Fix for LP bug#993726 · 80651436
      unknown authored
      Optimization of aggregate functions detected constant under max() and evalueted it, but condition in the WHWRE clause (which is always FALSE) was not taken into account
      80651436
    • unknown's avatar
      Fix for bug lp:992405 · 213476ef
      unknown authored
      The patch backports two patches from mysql 5.6:
      - BUG#12640437: USING SQL_BUFFER_RESULT RESULTS IN A DIFFERENT QUERY OUTPUT
      - Bug#12578908: SELECT SQL_BUFFER_RESULT OUTPUTS TOO MANY ROWS WHEN GROUP IS OPTIMIZED AWAY
      
      Original comment:
      -----------------
      3714 Jorgen Loland	2012-03-01
            BUG#12640437 - USING SQL_BUFFER_RESULT RESULTS IN A DIFFERENT 
                           QUERY OUTPUT
            
            For all but simple grouped queries, temporary tables are used to
            resolve grouping. In these cases, the list of grouping fields is
            stored in the temporary table and grouping is resolved
            there (e.g. by adding a unique constraint on the involved
            fields). Because of this, grouping is already done when the rows
            are read from the temporary table.
            
            In the case where a group clause may be optimized away, grouping
            does not have to be resolved using a temporary table. However, if
            a temporary table is explicitly requested (e.g. because the
            SQL_BUFFER_RESULT hint is used, or the statement is
            INSERT...SELECT), a temporary table is used anyway. In this case,
            the temporary table is created with an empty group list (because
            the group clause was optimized away) and it will therefore not
            create groups. Since the temporary table does not take care of
            grouping, JOIN::group shall not be set to false in 
            make_simple_join(). This was fixed in bug 12578908. 
            
            However, there is an exception where make_simple_join() should
            set JOIN::group to false even if the query uses a temporary table
            that was explicitly requested but is not strictly needed. That
            exception is if the loose index scan access method (explain
            says "Using index for group-by") is used to read into the 
            temporary table. With loose index scan, grouping is resolved 
            by the access method. This is exactly what happens in this bug.
      213476ef
  14. 03 May, 2012 1 commit
    • unknown's avatar
      Fix bug lp:993745 · c9a73aa2
      unknown authored
      This is a backport of the fix for MySQL bug #13723054 in 5.6.
      
      Original comment:
            The crash is caused by arbitrary memory area owerwriting in case of
            BLOB fields during attempt to copy BLOB field key image into record
            buffer(record buffer is too small to get BLOB key part image).
            note:
            QUICK_GROUP_MIN_MAX_SELECT can not work with BLOB fields
            because it uses record buffer as temporary buffer for key values
            however this case is filtered out by covering_keys() check
            in get_best_group_min_max() as BLOBs always require key length
            modificator in the key declaration and if the key has a BLOB
            then it can not be covered key.
            The fix is to use 'max_used_key_length' key length instead of 0.
      
      Analysis:
      Spcifically the crash in this bug was a result of the call to key_copy()
      that copied the whole key, inlcuding the BLOB field which is not used
      for index access. Copying the blob field overwrote memory as far as the
      function parameter 'key_info'. As a result the contents of key_info was
      all 0, which resulted in a crash when this key_info was accessed few
      lines below in key_cmp().
      c9a73aa2
  15. 02 May, 2012 4 commits
  16. 25 Apr, 2012 1 commit
  17. 24 Apr, 2012 1 commit
  18. 18 Apr, 2012 1 commit
  19. 16 Apr, 2012 5 commits
  20. 10 Apr, 2012 1 commit
  21. 09 Apr, 2012 1 commit
  22. 06 Apr, 2012 4 commits
    • Mayank Prasad's avatar
      BUG#13738989 : 62136 : FAILED TO FETCH SELECT RESULT USING EMBEDDED MYSQLD · fe3f7993
      Mayank Prasad authored
      Background : 
      In mysql-5.1, in a fix for bug#47485, code has been changed for 
      mysql client (libmysql/libmysql.c) but corresponding code was not
      changed for embedded mysql. In that code change, after execution
      of a statement, mysql_stmt_store_result() checks for mysql->state
      to be MYSQL_STATUS_STATEMENT_GET_RESULT, instead of
      MYSQL_STATUS_GET_RESULT (earlier).
      
      Reason:
      In embedded mysql code, after execution, mysql->state was not
      set to MYSQL_STATUS_STATEMENT_GET_RESULT, so it was throwing
      OUT_OF_SYNC error.
      
      Fix:
      Fixed the code in libmysqld/lib_sql.cc to have mysql->state
      to be set to MYSQL_STATUS_STATEMENT_GET_RESULT after execution.
      
      fe3f7993
    • Georgi Kodinov's avatar
      Bug #13934049: 64884: LOGINS WITH INCORRECT PASSWORD ARE ALLOWED · 7dcf0a66
      Georgi Kodinov authored
      Fixed an improper type conversion on return that can make the server accept
      logins with a wrong password.
      7dcf0a66
    • Alexey Botchkov's avatar
      merging. · ab5c6cd7
      Alexey Botchkov authored
      ab5c6cd7
    • Alexey Botchkov's avatar
      MDEV-80 Memory engine table full at much less than max_heap_table_size with btree index. · 357c5f74
      Alexey Botchkov authored
              RB-tree index in the MEMORY table fails if it grews over 4G.
              That happened because the old_allocated variable in hp_rb_write_key()
              had the uint type. Changed with the 'size_t' type to be same as the
              'rb_tree.allocated'.
      
      per-file comments:
        storage/heap/hp_write.c
      MDEV-80 Memory engine table full at much less than max_heap_table_size with btree index.
              uint->size_t for the 'old_allocated'.
      357c5f74