1. 28 Jan, 2013 3 commits
    • Satya Bodapati's avatar
      Bug#16183892 - INNODB PURGE BUFFERING IS NOT CRASH-SAFE · d63f54c6
      Satya Bodapati authored
      With innodb_change_buffering enabled, Innodb buffers
      all modifications to secondary index leaf pages when
      the leaf pages are not in buffer pool.
      
      Crash InnoDB while an IBUF_OP_DELETE is being applied.
      Restart and note that the same record can be applied
      again which may lead to crash.
      
      Mark the change buffer record processed, so that it will
      not be merged again in case the server crashes between
      the following mtr_commit() and the subsequent mtr_commit()
      of deleting the change buffer record.
      
      Testcase: No testcase because it is difficult to get the
      timing right with the two asyncronous task purge and change
      buffering
      
      Approved by Marko. rb#1893
      d63f54c6
    • Venkatesh Duggirala's avatar
      Bug#16084594 USER_VAR ITEM IN 'LOAD FILE QUERY' WAS NOT · 3c5326f8
      Venkatesh Duggirala authored
      PROPERLY QUOTED IN BINLOG FILE
      Merging fix from mysql-5.1
      3c5326f8
    • Venkatesh Duggirala's avatar
      Bug#16084594 USER_VAR ITEM IN 'LOAD FILE QUERY' WAS NOT · 7e0901b9
      Venkatesh Duggirala authored
      PROPERLY QUOTED IN BINLOG FILE
      Problem: In load data file query, User variables are allowed
      inside "Into_list" and "Set_list". These user variables used
      inside these two lists are not properly guarded with backticks
      while server is writting into binlog. Hence user variable names
      like a` cannot be used in this context.
      
      Fix: Properly quote these variables while
      writting into binlog
      
      mysql-test/r/func_compress.result:
        changing result file
      mysql-test/r/variables.result:
        changing result file
      mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
        changing result file
      sql/item_func.cc:
        Quote the user variable items
      7e0901b9
  2. 26 Jan, 2013 1 commit
    • Venkatesh Duggirala's avatar
      Bug#16056813-MEMORY LEAK ON FILTERED SLAVE · 08a22ba1
      Venkatesh Duggirala authored
      Due to not resetting a member (last_added) of 
      Deferred events class inside a clean up function
      (Deferred_log_events::rewind), there is a memory
      leak on filtered slaves.
      
      Fix:
      Resetting last_added to NULL in rewind() function.
      
      sql/rpl_utility.cc:
        Resetting last_added to NULL to avoid memory leak
      08a22ba1
  3. 24 Jan, 2013 5 commits
    • unknown's avatar
      No commit message · 527c5817
      unknown authored
      No commit message
      527c5817
    • Venkata Sidagam's avatar
      BUG#11908153 CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE · 26f662be
      Venkata Sidagam authored
      Backporting bug patch from 5.5 to 5.1.
      This fix is applicable to BUG#14362617 as well
      26f662be
    • Venkata Sidagam's avatar
      Bug #11752803 SERVER CRASHES IF MAX_CONNECTIONS DECREASED BELOW · 8be7fa51
      Venkata Sidagam authored
                     CERTAIN LEVEL
      
      Merging from 5.1 to 5.5
      8be7fa51
    • Venkata Sidagam's avatar
      Bug #11752803 SERVER CRASHES IF MAX_CONNECTIONS DECREASED BELOW · 776df0a3
      Venkata Sidagam authored
                     CERTAIN LEVEL
            
      Problem description: mysqld crashes when we update the max_connections 
      variable to lesser value than the number of currently open connections.
            
      Analysis: The "alarm_queue.max_elements" size will be decided at the 
      server start time and it will get modified if we change max_connections 
      value. In the current scenario the value of "alarm_queue.max_elements" 
      is decremented when the max_connections is set to 2. When updating the  
      "alarm_queue.max_elements" value we are not updating "max_used_alarms" 
      value. Hence, instead of getting the warning "thr_alarm queue is full" 
      it is ending up in asserting the server at the time of inserting new 
      elements in the queue.
            
      Fix: the fix is to dynamically increase the size of the alarm_queue.
      In order to do that, queue_insert_safe() should be used instead if
      queue_insert().
      776df0a3
    • Venkatesh Duggirala's avatar
      BUG#14798572: REMOVE UNUSED VARIABLE BINLOG_CAN_BE_CORRUPTED · f31611c4
      Venkatesh Duggirala authored
      FROM MYSQL_BINLOG_SEND
      
      As part Bug #11747416 A DISK FULL MAKES BINARY LOG CORRUPT,
      reading the variable "binlog_can_be_corrupted" was removed
      In the existing code the value of this variable is only set,
      never read. And also this issue causing compiler warnings.
      So the variable is completely redundant and should be removed.
      
      sql/sql_repl.cc:
        Removing dead code
      f31611c4
  4. 23 Jan, 2013 2 commits
  5. 21 Jan, 2013 2 commits
    • Marko Mäkelä's avatar
      Merge mysql-5.1 to mysql-5.5. · f3e2ac30
      Marko Mäkelä authored
      f3e2ac30
    • Marko Mäkelä's avatar
      Bug#16067973 DROP TABLE SLOW WHEN IT DECOMPRESS COMPRESSED-ONLY PAGES · e7283cea
      Marko Mäkelä authored
      buf_page_get_gen(): Do not attempt to decompress a compressed-only
      page when mode == BUF_PEEK_IF_IN_POOL. This mode is only being used by
      btr_search_drop_page_hash_when_freed(). There cannot be any adaptive
      hash index pointing to a page that does not exist in uncompressed
      format in the buffer pool.
      
      innodb_buffer_pool_evict_update(): New function for debug builds, to handle
      SET GLOBAL innodb_buffer_pool_evicted='uncompressed'
      by evicting all uncompressed page frames of compressed tablespaces
      from the buffer pool.
      
      rb#1873 approved by Jimmy Yang
      e7283cea
  6. 19 Jan, 2013 2 commits
    • Venkatesh Duggirala's avatar
      BUG#11752707-SLAVE CRASHES IF RBR HAS AS DESTINATION A VIEW RATHER · e4f4e506
      Venkatesh Duggirala authored
      THAN A TABLE.
      Merging fix from mysql-5.1
      e4f4e506
    • Venkatesh Duggirala's avatar
      Bug#11752707-SLAVE CRASHES IF RBR HAS AS DESTINATION A VIEW · bc21e8cd
      Venkatesh Duggirala authored
      RATHER THAN A TABLE
      
      Problem: In RBR, If a table is converted into a view at slave,
      (i.e., "drop table 'object1'" & "create view 'object1'"), then any
      DML operations on the table at master are causing crash at slave.
      
      Analysis: Slave prepares tables to be opened for DML list when it
      receives Table_map_log_event(s). And the same list will be sent to
      open_table function. Open_table logic assumes that if the list
      contains a view object, it also contains "select_lex" object of
      that view. In the above special case, the table object does not
      contain 'select_lex' as it is base table at master. Since it
      is a view at slave, open_table logic goes to 'mysql_make_view()'
      function which assumes that 'select_lex' exists for the object.
      
      Fix: While preparing 'tables to be opened' list, we should make 
      sure that table required type is 'base table'. If it is not 
      base table while opening the object, mysql_make_view will throw an 
      error similar to 'object is not a base table' 
      
      sql/log_event.cc:
        Restrict that all table_map_log_event's objects should be 
        base tables @ slave also.
      bc21e8cd
  7. 18 Jan, 2013 3 commits
    • Astha Pareek's avatar
      BUG#11761680 · c8de0f9a
      Astha Pareek authored
      disabled binlog_spurious_ddl_errors on mysql-5.5
      c8de0f9a
    • unknown's avatar
      No commit message · 008bc7e1
      unknown authored
      No commit message
      008bc7e1
    • Astha Pareek's avatar
      Description · 9b904d35
      Astha Pareek authored
            The test, binlog.binlog_spurious_ddl_errors was failing on pb2 at the statement
            "UNINSTALL PLUGIN example;" with this warning:
            "Warning	1620	Plugin is busy and will be uninstalled on shutdown "
            
            Fix
            Spurious warnings occur in the test since we do not empty the Query cache,
            used by the example plugin at the time of creating tables using the plugin.
            Hence, the query chache is flushed before uninstalling the plugin.
            Also, as part of running the test across platforms, the plugin installation
            script is changed.
      9b904d35
  8. 17 Jan, 2013 1 commit
    • Marko Mäkelä's avatar
      Bug#16138582 MTR_MEMO_RELEASE AND DYN_ARRAY TOGETHER ARE VERY INEFFICIENT · 49adfa3d
      Marko Mäkelä authored
      Get rid of O(n^2) scan in dyn array (mtr->memo) operations, accessing
      the dyn array blocks directly.
      
      dyn_array_get_last_block(), dyn_array_get_next_block(),
      dyn_array_get_prev_block(): Define as a constness-preserving macro.
      
      Add const qualifiers to many dyn_array functions.
      
      mtr_memo_slot_release_func(): Renamed from mtr_memo_slot_release():
      Make mtr_t* a debug-only parameter. Assume that slot->object != NULL.
      
      mtr_memo_pop_all(): Access the dyn_array blocks directly, replacing
      O(n^2) operation with O(n).
      
      mtr_memo_release(): Access the dyn_array blocks directly, replacing
      O(n^2) operation with O(n). This caused the performance problem.
      
      rb#1540 approved by Jimmy Yang
      49adfa3d
  9. 16 Jan, 2013 5 commits
    • Anirudh Mangipudi's avatar
      BUG#14117025: UNABLE TO RESTORE DUMP · 4ccfba72
      Anirudh Mangipudi authored
      Null Merge from 5.1 to 5.5
      4ccfba72
    • Anirudh Mangipudi's avatar
      BUG#14117025: UNABLE TO RESTORE DUMP · 01208b5b
      Anirudh Mangipudi authored
      Problem: When a view, with a specific character set and collation, 
      is created on another view with a different character set and collation the 
      dump restoration results in an illegal mix of collations error.
      SOLUTION: To avoid this confusion of collations, the create table datatype 
      being used is hardcoded as "tinyint NOT NULL". This will not matter as the table 
      created will be dropped at runtime and specifically tinyint is used to 
      avoid hitting the row size conflicts.
      01208b5b
    • Neeraj Bisht's avatar
      Bug#11751794 MYSQL GIVES THE WRONG RESULT WITH SOME SPECIAL USAGE · 064c6db0
      Neeraj Bisht authored
      Consider the following query:
      
      SELECT f_1,..,f_m, AGGREGATE_FN(C)
      FROM t1
      WHERE ...
      GROUP BY ...
      
      Loose index scan ("Using index for group-by") can be used for
      this query if there is an index 'i' covering all fields in the
      select list, and the GROUP BY clause makes up a prefix f1,...,fn
      of 'i'. Furthermore, according to rule NGA2 of
      get_best_group_min_max(), the WHERE clause must contain a
      conjunction of equality predicates for all fields fn+1,...,fm.
      
      The problem in this bug was that a query with WHERE clause that
      broke NGA2(NGA: Non Group Attribuite) was not detected and therefore 
      used loose index scan.
      This lead to wrong result. The query had an index
      covering (c1,c2) and had:
        "WHERE (c1 = 1 AND c2 = 'a') OR (c1 = 2 AND c2 = 'b')
         GROUP BY c1"
      or 
        "WHERE (c1 = 1 ) OR (c1 = 2 AND c2 = 'b')
         GROUP BY c1"
      
      
      This WHERE clause cannot be transformed to a conjunction of
      equality predicates.
      
      The solution is to introduce another rule, NGA3, that complements
      NGA2. NGA3 says that if a gap field (field between those
      listed in GROUP BY and C in the index) has a predicate, then
      there can only be one range in the query. This requirement is
      more strict than it has to be in theory. BUG 15947433 will deal
      with that.
      
      
      sql/opt_range.cc:
        check for the repetition of non group field.
      064c6db0
    • Neeraj Bisht's avatar
      Bug#11751794 MYSQL GIVES THE WRONG RESULT WITH SOME SPECIAL USAGE · 3930dbf7
      Neeraj Bisht authored
      Consider the following query:
      
      SELECT f_1,..,f_m, AGGREGATE_FN(C)
      FROM t1
      WHERE ...
      GROUP BY ...
      
      Loose index scan ("Using index for group-by") can be used for
      this query if there is an index 'i' covering all fields in the
      select list, and the GROUP BY clause makes up a prefix f1,...,fn
      of 'i'. Furthermore, according to rule NGA2 of
      get_best_group_min_max(), the WHERE clause must contain a
      conjunction of equality predicates for all fields fn+1,...,fm.
      
      The problem in this bug was that a query with WHERE clause that
      broke NGA2 was not detected and therefore used loose index scan.
      This lead to wrong result. The query had an index
      covering (c1,c2) and had:
        "WHERE (c1 = 1 AND c2 = 'a') OR (c1 = 2 AND c2 = 'b')
         GROUP BY c1"
      or 
        "WHERE (c1 = 1 ) OR (c1 = 2 AND c2 = 'b')
         GROUP BY c1"
      
      
      This WHERE clause cannot be transformed to a conjunction of
      equality predicates.
      
      The solution is to introduce another rule, NGA3, that complements
      NGA2. NGA3 says that if a gap field (field between those
      listed in GROUP BY and C in the index) has a predicate, then
      there can only be one range in the query. This requirement is
      more strict than it has to be in theory. BUG 15947433 will deal
      with that.
      
      
      sql/opt_range.cc:
        check for the repetition of non group field.
      3930dbf7
    • unknown's avatar
      No commit message · cbb4732f
      unknown authored
      No commit message
      cbb4732f
  10. 15 Jan, 2013 4 commits
    • Nisha Gopalakrishnan's avatar
      Bug#11757464:SERVER CRASH IN RECURSIVE CALL WHEN OOM · d01b5c39
      Nisha Gopalakrishnan authored
      Analysis:
      ---------
      
      When the server is out of memory, an error is raised
      to indicate the same. Handling the error requires
      more memory to be allocated which fails, hence the
      error handling loops in a recursion and causes the
      server to crash.
      
      Fix:
      ---
      a) Prevents pushing the 'out of memory' error condition
      to the diagnostic area as it requires memory allocation.
      GET DIAGNOSTICS, SHOW WARNINGS and SHOW ERRORS statements
      will not show information about this error. However the
      'out of memory' error is returned to the client.
      b) It sets the ME_FATALERROR flag when 'out of memory' errors
      are reported (for places where the flag is not already set).
      This flag prevents activation of SP error handlers which also
      require memory allocation and therefore are likely to fail.
      d01b5c39
    • Neeraj Bisht's avatar
      Bug#11758009 - UNION EXECUTION ORDER WRONG ? · f7f21ee7
      Neeraj Bisht authored
      Problem:-
      In case of blob data field, UNION ALL doesn't give correct result.
      
      Analysis:-
      In MyISAM table, when we dont want to check for the distinct for particular 
      key, we set the key_map to zero.
      
      While writing record in MyISAM table, we check the distinct with the help 
      of keys, by checking whether that key is active in key_map and then writing 
      the record.
      
      In case of blob field, we are checking for distinct by unique constraint, 
      where we are not checking whether that unique key is active or not in key_map.
      
      Solution:
      Before checking for distinct, check whether any key is active in key_map.
      
      
      storage/myisam/mi_write.c:
        check whether key_map is active before checking distinct.
      f7f21ee7
    • Neeraj Bisht's avatar
      Bug#11758009 - UNION EXECUTION ORDER WRONG ? · 65af83f6
      Neeraj Bisht authored
      Problem:-
      In case of blob data field, UNION ALL doesn't give correct result.
      
      Analysis:-
      In MyISAM table, when we dont want to check for the distinct for particular 
      key, we set the key_map to zero.
      
      While writing record in MyISAM table, we check the distinct with the help 
      of keys, by checking whether that key is active in key_map and then writing 
      the record.
      
      In case of blob field, we are checking for distinct by unique constraint, 
      where we are not checking whether that unique key is active or not in key_map.
      
      Solution:-
      Before checking for distinct, check whether any key is active in key_map.
      
      storage/myisam/mi_write.c:
        check whether key_map is active before checking distinct.
      65af83f6
    • unknown's avatar
      No commit message · 5cf1a8c2
      unknown authored
      No commit message
      5cf1a8c2
  11. 14 Jan, 2013 5 commits
    • Neeraj Bisht's avatar
      · 84d798a1
      Neeraj Bisht authored
      BUG#14303860 - EXECUTING A SELECT QUERY WITH TOO 
      MANY WILDCARDS CAUSES A SEGFAULT
            Back port from 5.6 and trunk
      84d798a1
    • Olav Sandstaa's avatar
      Fix for Bug#14636211 WRONG RESULT (EXTRA ROW) ON A FROM SUBQUERY · fd5380b4
      Olav Sandstaa authored
                           WITH A VARIABLE AND ORDER BY
              Bug#16035412 MYSQL SERVER 5.5.29 WRONG SORTING USING COMPLEX INDEX
            
      This is a fix for a regression introduced by Bug#12667154:
      Bug#12667154 attempted to fix a performance problem with subqueries
      that did filesort. For doing filesort, the optimizer creates a quick
      select object to use when building the sort index. This quick select
      object was deleted after the first call to create_sort_index(). Thus,
      for queries where the subquery was executed multiple times, the quick
      object was only used for the first execution. For all later executions
      of the subquery, filesort used a complete table scan for building the
      sort index. The fix for Bug#12667154 tried to fix this by not deleting
      the quick object after the first execution of create_sort_index() so
      that it would be re-used for building the sort index by the following
      executions of the subquery.
            
      This regression introduced in Bug#12667154 is that due to not deleting
      the quick select object after building the sort index, the quick
      object could in some cases be used also during the second phase of the
      execution of the subquery instead of using the created sort
      index. This caused wrong results to be returned.
            
      The fix for this issue is to delete the reference to the select object
      after it has been used in create_sort_index(). In this way the select 
      and quick objects will not be available when doing the second phase
      of the execution of the select operation. To ensure that the select
      object can be re-used for the following executions of the subquery
      we make a copy of the select pointer. This is used for restoring the
      select object after the select operation is completed.
      
      
      mysql-test/suite/innodb/r/innodb_mysql.result:
        Changed explain output: The explain now contains "Using where" since we
        have restored the select pointer after doing the filesort operation.
      sql/sql_select.cc:
        Change create_sort_index() so that it always sets the pointer to
        the select object to NULL. This is done in order to avoid that the
        select->quick object can be used when execution the main part of
        the select operation.
      sql/sql_select.h:
        New member in JOIN_TAB: saved_select. Used by create_sort_index to
        make a backup copy of the select pointer.
      fd5380b4
    • Neeraj Bisht's avatar
      BUG#14303860 - EXECUTING A SELECT QUERY WITH TOO · 99645e5b
      Neeraj Bisht authored
      MANY WILDCARDS CAUSES A SEGFAULT
      
      Back port from 5.6 and trunk
      99645e5b
    • Krunal Bauskar krunal.bauskar@oracle.com's avatar
    • Krunal Bauskar krunal.bauskar@oracle.com's avatar
      - BUG#1608883: KILLING A QUERY INSIDE INNODB CAUSES IT TO EVENTUALLY CRASH · 54c47527
        WITH AN ASSERTION
      
        Recently we added check to handle kill query signal for long operating
        queries. 
        While the query interruption is reported it must to ensure cursor is restore
        to proper state for HANDLER interface to work correctly. 
        Normal select query will not face this problem, as on recieving interrupt,
        select query is aborted and new select query result in re-initialization
        (including cursor).
      
        rb://1836. Approved by Marko.
      
      54c47527
  12. 12 Jan, 2013 2 commits
    • Nisha Gopalakrishnan's avatar
      BUG#11757250: REPLACE(...) INSIDE A STORED PROCEDURE. · 0ac6c5fa
      Nisha Gopalakrishnan authored
      Merge from 5.1 to 5.5
      0ac6c5fa
    • Nisha Gopalakrishnan's avatar
      BUG#11757250: REPLACE(...) INSIDE A STORED PROCEDURE. · c4afaa42
      Nisha Gopalakrishnan authored
      Analysis:
      --------
      
      REPLACE operation provides incorrect output when
      user variable is supplied as an argument and there
      are multiple rows on which the operation is performed.
      
      Consider the example below:
      
      SET @var='(( 00000000 ++ 00000000 ))';
      SELECT REPLACE(@var, '00000000', table_name) AS a FROM
      INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='mysql';
      
      Invalid output:
        +---------------------------------------+
        | REPLACE(@var, '00000000', TABLE_NAME) |
        +---------------------------------------+
        | (( columns_priv ++ columns_priv ))    |
        | (( columns_priv ++ columns_priv ))    |
            ......
            ......
        | (( columns_priv ++ columns_priv ))    |
        | (( columns_priv ++ columns_priv ))    |
        | (( columns_priv ++ columns_priv ))    |
        +---------------------------------------+
      
      The user argument supplied as the string to REPLACE
      operation is overwritten after the first iteration
      to '(( columns_priv ++ columns_priv ))'.
      The overwritten string after the first iteration
      is used for the subsequent REPLACE iteration. Since
      the pattern string is not found, it returns invalid
      output as mentioned above.
      
      Fix:
      ---
      If the Alloced_length is zero, realloc() and create a
      copy of the string which is then used for the REPLACE
      operation for every iteration.
      c4afaa42
  13. 11 Jan, 2013 3 commits
    • Aditya A's avatar
      Bug#15843818 PARTITIONING BY RANGE WITH TO_DAYS ALWAYS · 3b4b050c
      Aditya A authored
                     INCLUDES FIRST PARTITION WHEN PRUNING
      
      [Merge from 5.1 to 5.5]
      3b4b050c
    • Aditya A's avatar
      Bug#15843818 PARTITIONING BY RANGE WITH TO_DAYS ALWAYS · 21bdf213
      Aditya A authored
                     INCLUDES FIRST PARTITION WHEN PRUNING
      
      
      PROBLEM
      -------
      
      TO_DAYS()/TO_SECONDS() can return NULL for invalid dates which 
      was stored in the first partition ,therefore the first partition 
      was always included for the scan when range was specified.
      
      
      FIX
      ---
      
      The fix is a small optimization which we have included ,which will
      prune the scanning of NULL/first partition if the dates specified 
      in the range are valid and in the same year and month . TO_SECONDS()
      function is not supported in 5.1 so removed it from the fix and test
      scripts for mysql-5.1 version.
      
      21bdf213
    • Chaithra Gopalareddy's avatar
      Merge from 5.1 to 5.5 · cb72ecbe
      Chaithra Gopalareddy authored
      cb72ecbe
  14. 10 Jan, 2013 2 commits
    • Venkata Sidagam's avatar
      Bug #14553380 MYSQL C API LIBRARY EXITS AT NET_CLEAR AT NET_SERV.CC:223 · 3fa76fd0
      Venkata Sidagam authored
      Problem description: When client loses the connection to the MySQL server or 
      if the server gets shutdown after mysql_stmt_prepare() then the next 
      mysql_stmt_prepare() will return an error(as expected) but consecutive call 
      mysql_stmt_execute(), will crash the client program. 
      The expected behavior would be, it should through an error.
      
      Analysis: The mysql_stmt_prepare() interns calls the function end_server() 
      and net->vio and net->buff are freed and set to NULL. Then the next call 
      mysql_stmt_execute() will interns call net_clear() where we are "net->vio" 
      with out validating it.
      
      Fix: we are validating the net->vio, before calling net_clear().
      3fa76fd0
    • Chaithra Gopalareddy's avatar
      Bug#11760726: LEFT JOIN OPTIMIZED INTO JOIN LEADS TO · 8b41f491
      Chaithra Gopalareddy authored
                    INCORRECT RESULTS
      
      This is a backport of fix for Bug#13068506.
      
      mysql-test/r/join_outer.result:
        Added test result for Bug#13068506
      mysql-test/t/join_outer.test:
        Added test case for Bug#13068506
      sql/item.h:
        Implement Item_outer_ref::not_null_tables()
      8b41f491