1. 19 Sep, 2010 1 commit
  2. 17 Sep, 2010 1 commit
    • Davi Arnaut's avatar
      Bug#52419: x86 assembly based atomic CAS causes test failures · 580338dd
      Davi Arnaut authored
      The problem was that the x86 assembly based atomic CAS
      (compare and swap) implementation could copy the wrong
      value to the ebx register, where the cmpxchg8b expects
      to see part of the "comparand" value. Since the original
      value in the ebx register is saved in the stack (that is,
      the push instruction causes the stack pointer to change),
      a wrong offset could be used if the compiler decides to
      put the source of the comparand value in the stack.
      
      The solution is to copy the comparand value directly from
      memory. Since the comparand value is 64-bits wide, it is
      copied in two steps over to the ebx and ecx registers.
      
      include/atomic/x86-gcc.h:
        For reference, an excerpt from a faulty binary follows.
        
        It is a disassembly of my_atomic-t, compiled at -O3 with
        ICC 11.0. Most of the code deals with preparations for
        a atomic cmpxchg8b operation. This instruction compares
        the value in edx:eax with the destination operand. If the
        values are equal, the value in ecx:ebx is stored in the
        destination, otherwise the value in the destination operand
        is copied into edx:eax.
        
        In this case, my_atomic_add64 is implemented as a compare
        and exchange. The addition is done over temporary storage
        and loaded into the destination if the original term value
        is still valid.
        
          volatile int64 a64;
          int64 b=0x1000200030004000LL;
          a64=0;
              mov    0xfffffda8(%ebx),%eax
              xor    %ebp,%ebp
              mov    %ebp,(%eax)
              mov    %ebp,0x4(%eax)
          my_atomic_add64(&a64, b);
              mov    0xfffffda8(%ebx),%ebp      # Load address of a64
              mov    0x0(%ebp),%edx             # Copy value
              mov    0x4(%ebp),%ecx
              mov    %edx,0xc(%esp)             # Assign to tmp var in the stack
              mov    %ecx,0x10(%esp)
              add    $0x30004000,%edx           # Sum values
              adc    $0x10002000,%ecx
              mov    %edx,0x8(%esp)             # Save part of result for later
              mov    0x0(%ebp),%esi             # Copy value of a64 again
              mov    0x4(%ebp),%edi
              mov    0xc(%esp),%eax             # Load the value of a64 used
              mov    0x10(%esp),%edx            # for comparison
              mov    %esi,(%esp)
              mov    %edi,0x4(%esp)
              push   %ebx                       # Push %ebx into stack. Changes esp.
              mov    0x8(%esp),%ebx             # Wrong restore of the result.
              lock cmpxchg8b 0x0(%ebp)
              sete   %cl
              pop    %ebx
      580338dd
  3. 13 Sep, 2010 1 commit
    • Joerg Bruehe's avatar
      Selective transfer of a bugfix patch into 5.5.6-rc. · 63cbb5f9
      Joerg Bruehe authored
      The first part is the functional change,
      the second is needed as a compile fix on Windows
      (header file order).
      
      | committer: Marc Alff <marc.alff@oracle.com>
      | branch nick: mysql-5.5-bugfixing-56521
      | timestamp: Thu 2010-09-09 14:28:47 -0600
      | message:
      |   Bug#56521 Assertion failed: (m_state == 2), function allocated_to_free, pfs_lock.h (138)
      |
      |   Before this fix, it was possible to build the server:
      |   - with the performance schema
      |   - with a dummy implementation of my_atomic (MY_ATOMIC_MODE_DUMMY).
      |
      |   In this case, the resulting binary will just crash,
      |   as this configuration is not supported.
      |
      |   This fix enforces that the build will fail with a compilation error in this
      |   configuration, instead of resulting in a broken binary.
      
      | committer: Tor Didriksen <tor.didriksen@oracle.com>
      | branch nick: 5.5-bugfixing-56521
      | timestamp: Fri 2010-09-10 11:10:38 +0200
      | message:
      |   Header files should be self-contained
      63cbb5f9
  4. 10 Sep, 2010 1 commit
  5. 07 Sep, 2010 1 commit
    • Joerg Bruehe's avatar
      Fix bug#56574: · 51cef7ff
      Joerg Bruehe authored
      After installation from RPM, server is run under root, not mysql user
      
      The problem was that in the cmake way of building
      the variable "MYSQLD_USER" was not set and propagated.
      In the script "mysqld_safe" its value is used as the
      name of the user who should run the server process.
      
      The fix is to explicitly set this variable to "mysql"
      and propagate it in the build process.
      It was analyzed and proposed by Jonathan Perkin. 
      51cef7ff
  6. 06 Sep, 2010 2 commits
    • Dmitry Lenev's avatar
      A temporary workaround for bug #56405 "Deadlock in the · 5770bd13
      Dmitry Lenev authored
      MDL deadlock detector".
      
      Deadlock could have occurred when workload containing mix
      of DML, DDL and FLUSH TABLES statements affecting same
      set of tables was executed in heavily concurrent environment.
      
      This deadlock occurred when several connections tried to
      perform deadlock detection in metadata locking subsystem.
      The first connection started traversing wait-for graph,
      encountered sub-graph representing wait for flush, acquired
      LOCK_open and dived into sub-graph inspection. When it has
      encounterd sub-graph corresponding to wait for metadata lock
      and blocked while trying to acquire rd-lock on
      MDL_lock::m_rwlock (*) protecting this subgraph, since some
      other thread had wr-lock on it. When this wr-lock was released
      it could have happened (if there was other pending wr-lock
      against this rwlock) that rd-lock from the first connection
      was left unsatisfied but at the same time new rd-lock request
      from the second connection sneaked in and was satisfied (for
      this to be possible second rd- request should come exactly
      after wr-lock is released but before pending wr-lock manages
      to grab rwlock, which is possible both on Linux and in our
      own rwlock implementation). If this second connection
      continued traversing wait-for graph and encountered sub-graph
      representing wait for flush it tried to acquire LOCK_open
      and thus deadlock was created.
      
      This patch tries to workaround this problem but not allowing
      deadlock detector to lock LOCK_open mutex if some other thread
      doing deadlock detection already owns it and current search
      depth is greater than 0. Instead deadlock is reported.
      
      Other possible solutions are either known to have negative
      effects on performance or require much more time for proper
      implementation and testing.
      
      No test case is provided as this bug is very hard to repeat
      in MTR environment but is repeatable with the help of RQG
      tests.
      
      sql/mdl.cc:
        Moved Deadlock_detection_visitor::m_current_search_depth to
        parent class to make it available in
        TABLE_SHARE::visit_subgraph().
        Added MDL_wait_for_graph_visitor::abort_traversal() method
        which allows to abort traversal of a wait-for graph and
        report a deadlock.
      sql/mdl.h:
        Moved Deadlock_detection_visitor::m_current_search_depth to
        parent class to make it available in
        TABLE_SHARE::visit_subgraph().
        Added MDL_wait_for_graph_visitor::abort_traversal() method
        which allows to abort traversal of a wait-for graph and
        report a deadlock.
      sql/sql_base.cc:
        Added dd_owns_lock_open counter and mutex protecting it to
        track number of connections which do deadlock detection and
        own or try to acquire LOCK_open.
      sql/sql_base.h:
        Added dd_owns_lock_open counter and mutex protecting it to
        track number of connections which do deadlock detection and
        own or try to acquire LOCK_open.
      sql/table.cc:
        Workaround bug #56405 but not allowing MDL deadlock detector
        to lock LOCK_open mutex if some other thread doing deadlock
        detection already owns it and current search depth is greater
        than 0. Instead report deadlock.
      5770bd13
    • Joerg Bruehe's avatar
      Fix bug#56547 mysql client interprets commands in comments · 3f71b3a4
      Joerg Bruehe authored
      The problem was not caused by a change in the client,
      rather by the tests using the Windows built-in "echo"
      and not the one built by MySQL.
      This again happened because the binary was missing in the package,
      caused by the wrong macro being used to build it in "cmake".
      3f71b3a4
  7. 02 Sep, 2010 1 commit
  8. 01 Sep, 2010 1 commit
  9. 31 Aug, 2010 6 commits
    • Alexander Nozdrin's avatar
      Cherry-picking patch for Bug#55846. · 56623561
      Alexander Nozdrin authored
      Original changeset:
      ------------------------------------------------------------
      revno: 3186
      revision-id: davi.arnaut@oracle.com-20100831142822-2qhufn3hho4xqr4p
      parent: gshchepa@mysql.com-20100830222201-ie7n43mjy4irlllk
      committer: Davi Arnaut <davi.arnaut@oracle.com>
      branch nick: mysql-5.5-merge
      timestamp: Tue 2010-08-31 11:28:22 -0300
      message:
        Bug#55846: Link tests fail on Windows - my_compiler.h missing
        
        Make the my_compiler.h header, like my_attribute.h, part of
        the distribution. This is required due to the dependency of
        the former on the latter (which can undefine __attribute__).
      ------------------------------------------------------------
      56623561
    • Alexander Nozdrin's avatar
      Cherry-picking patch for Bug#55980. · a8c90735
      Alexander Nozdrin authored
      Original changeset:
      ------------------------------------------------------------
      revno: 3197
      revision-id: alik@sun.com-20100831135426-h5a4s2w6ih1d8q2x
      parent: magnus.blaudd@sun.com-20100830120632-u3xzy002mdwueli8
      committer: Alexander Nozdrin <alik@sun.com>
      branch nick: mysql-5.5-bugfixing
      timestamp: Tue 2010-08-31 17:54:26 +0400
      message:
        Bug#55980 Character sets: supplementary character _bin ordering is wrong
        
        Problem:
        - ORDER BY for utf8mb4_bin, utf16_bin and utf32_bin returned
          results in a wrong order, because old functions
          (supporting only BMP range) were used to handle these collations.
        - Additionally, utf16_bin did not sort supplementary characters
          between U+D700 and U+E000, as WL#1213 specification specified.
      ------------------------------------------------------------
      a8c90735
    • Alexander Nozdrin's avatar
      Cherry-picking patch for Bug#56137 from mysql-5.5-runtime. · c710d1c1
      Alexander Nozdrin authored
      ```---------------------------------------------------------
      revno: 3124
      revision-id: dlenev@mysql.com-20100831090419-rzr5ktekby2gspm1
      parent: alik@sun.com-20100827083901-x4wvtc10u9p7gcs9
      committer: Dmitry Lenev <dlenev@mysql.com>
      branch nick: mysql-5.5-rt-56137
      timestamp: Tue 2010-08-31 13:04:19 +0400
      message:
        Bug #56137 "Assertion `thd->lock == 0' failed on upgrading 
        from 5.1.50 to 5.5.6".
        
        Debug builds of the server aborted due to an assertion
        failure when DROP DATABASE statement was run on an
        installation which had outdated or corrupt mysql.proc table.
        Particularly this affected the mysql_upgrade tool which is
        run as part of 5.1 to 5.5 upgrade.
        
        The problem was that sp_drop_db_routines(), which was invoked
        during dropping of the database, could have returned without
        closing and unlocking mysql.proc table in cases when this
        table was not up-to-date with the current server. As a result
        further attempt to open and lock the mysql.event table, which
        was necessary to complete dropping of the database, ended up
        with an assert.
        
        This patch solves this problem by ensuring that
        sp_drop_db_routines() always closes mysql.proc table and
        releases metadata locks on it. This is achieved by changing
        open_proc_table_for_update() function to close tables and
        release metadata locks acquired by it in case of failure.
        This step also makes behavior of the latter function
        consistent with behavior of open_proc_table_for_read()/
        open_and_lock_tables().
        
        
        Test case for this bug was added to sp-destruct.test.
      ```
      
      ---------------------------------------------------------
      c710d1c1
    • Alexander Nozdrin's avatar
    • Daniel Fischer's avatar
    • Alexander Nozdrin's avatar
      Auto-merge from mysql-5.5-merge. · e0622c5a
      Alexander Nozdrin authored
      e0622c5a
  10. 30 Aug, 2010 8 commits
  11. 28 Aug, 2010 1 commit
  12. 27 Aug, 2010 6 commits
    • Marc Alff's avatar
      local merge · 3b56ef04
      Marc Alff authored
      3b56ef04
    • Sergey Vojtovich's avatar
      Merge 5.1-bugteam to 5.5-merge. · 98df5f7c
      Sergey Vojtovich authored
      98df5f7c
    • Alexey Kopytov's avatar
      Bug #54465: assert: field_types == 0 || field_types[field_pos] · 36e234a8
      Alexey Kopytov authored
                  == MYSQL_TYPE_LONGLONG
      
      A MIN/MAX() function with a subquery as its argument could lead
      to a debug assertion on debug builds or wrong data on release
      ones.
      
      The problem was a combination of the following factors:
      
      - Item_sum_hybrid::fix_fields() might use the argument
      (args[0]) to calculate 'hybrid_field_type' which was later used
      to decide how the data should be sent to the client.
      
      - Item_sum::make_field() might use the argument again to
      calculate the field's type when sending result set metadata to
      the client.
      
      - The argument could be changed in between these two calls via
        Item::set_arg() leading to inconsistent metadata being
        reported.
      
      Here is what was happening for the bug's test case:
      
      1. Item_sum_hybrid::fix_fields() calculates hybrid_field_type
      as MYSQL_TYPE_LONGLONG based on args[0] which is an
      Item::SUBSELECT_ITEM at that time.
      
      2. A temporary table is created to execute the
      query. create_tmp_field_from_item() creates a Field_long object
      according to the subselect's max_length.
      
      3. The subselect item in Item_sum_hybrid is replaced by the
      Item_field object referencing the newly created Field_long.
      
      4. Item_sum::make_field() rightfully returns the
      MYSQL_TYPE_LONG type when calculating the result set metadata.
      
      5. When sending the actual data, Item::send() relies on the
      virtual field_type() function which in our case returns
      previously calculated hybrid_field_type == MYSQL_TYPE_LONGLONG.
      
      It looks like the only solution is to never refer to the
      argument's metadata after the result metadata has been
      calculated in fix_fields(), since the argument itself may be
      different by then. In this sense, Item_sum::make_field() should
      never be used, because it may rely on the argument's metadata
      and is only called after fix_fields(). The "default"
      implementation in Item::make_field() should be used instead as
      it relies only on field_type(), but not on the argument's type.
      
      Fixed by removing Item_sum::make_field() so that the superclass
      implementation Item::make_field() is always used.
      
      mysql-test/r/func_group.result:
        Added a test case for bug #54465.
      mysql-test/t/func_group.test:
        Added a test case for bug #54465.
      sql/item_sum.cc:
        Removed Item_sum::make_field() so that the superclass
        implementation Item::make_field() is always used.
      sql/item_sum.h:
        Removed Item_sum::make_field() so that the superclass
        implementation Item::make_field() is always used.
      36e234a8
    • Ramil Kalimullin's avatar
      Fix for bug #54253: memory leak when using I_S plugins w/o deinit method · e433cb33
      Ramil Kalimullin authored
      Free memory allocated by the server for all plugins,
      with or without deinit() method.
      
      e433cb33
    • Sergey Vojtovich's avatar
      e1af6730
    • Sergey Vojtovich's avatar
      BUG#52821 - plugin_ftparser.h and plugin_audit.h are · 8f773e6f
      Sergey Vojtovich authored
                  not tested by ABI check
      
      plugin_audit.h and plugin_ftparser.h are now subject
      for ABI check. plugin.h is now tested implicitly.
      
      Also fixed broken ABI check cmake rules.
      
      Makefile.am:
        plugin_audit.h and plugin_ftparser.h are now subject
        for ABI check. plugin.h is now tested implicitly.
      cmake/abi_check.cmake:
        plugin_audit.h and plugin_ftparser.h are now subject
        for ABI check. plugin.h is now tested implicitly.
        
        Also fixed broken ABI check rules: -DMYSQL_ABI_CHECK is
        compiler (not cmake) definition, incorrect definitions
        were passed to do_abi_check.cmake for abi_check_all rule.
      cmake/do_abi_check.cmake:
        Inform sources that we do ABI check.
      include/mysql/plugin.h.pp:
        plugin.h is now tested implicitly.
      include/mysql/plugin_audit.h.pp:
        plugin_audit.h is now subject for ABI check.
      include/mysql/plugin_ftparser.h.pp:
        plugin_ftparser.h is now subject for ABI check.
      8f773e6f
  13. 26 Aug, 2010 10 commits