An error occurred fetching the project authors.
  1. 16 Nov, 2010 1 commit
    • Marc Alff's avatar
      Bug#56760 PFS_lock::allocated_to_free() assert failures on osx10.5-x86-64bit · ce89012c
      Marc Alff authored
      Before this fix, an assert could fail in PFS_lock::allocated_to_free(), during shutdown.
      The assert itself is valid, and detects an anomaly caused by bug 56666.
      
      While bug 56666 has no real consequences in production,
      the failure caused by this new assert in the code is negatively
      impacting the test suite with automated tests.
      
      This fix is a work around only, that relaxes the integrity checks 
      during the server shutdown.
      ce89012c
  2. 12 Nov, 2010 1 commit
    • Marc Alff's avatar
      Bug#58052 Binary log IO not being accounted for properly · 41dc34d6
      Marc Alff authored
      Before this fix, file io for the binary log file was not accounted properly,
      and showed no io at all.
      
      This bug was due to the following issues:
      
      1) file io for the binlog was instrumented:
      - sometime as "wait/io/file/sql/binlog"
      - sometime as "wait/io/file/sql/MYSQL_LOG"
      leading to inconsistent event_names.
      
      2) the binlog file itself was using an IO_CACHE,
      but the IO_CACHE implementation in mysys/mf_iocache.c was
      not instrumented to make performance schema calls to record file io.
      
      3) The "wait/io/file/sql/MYSQL_LOG" instrumentation was used
      for several log files, such as:
      - the binary log
      - the slow log
      - the query log
      which caused file io in these different log files to be accounted
      against the same instrument.
      The instrumentation needs to have a finer grain and report io
      in different event_names, because each file really serves a different purpose.
      
      With this fix:
      - the IO_CACHE implementation is now instrumented
      - the "wait/io/file/sql/MYSQL_LOG" instrument has been removed
      - binlog io is now always instrumented with "wait/io/file/sql/binlog"
      - the slow log is instrumented with a new name, "wait/io/file/sql/slow_log"
      - the query log is instrumented with a new name, "wait/io/file/sql/query_log"
      41dc34d6
  3. 11 Nov, 2010 1 commit
    • Dmitry Lenev's avatar
      Patch that refactors global read lock implementation and fixes · 6bf6272f
      Dmitry Lenev authored
      bug #57006 "Deadlock between HANDLER and FLUSH TABLES WITH READ
      LOCK" and bug #54673 "It takes too long to get readlock for
      'FLUSH TABLES WITH READ LOCK'".
      
      The first bug manifested itself as a deadlock which occurred
      when a connection, which had some table open through HANDLER
      statement, tried to update some data through DML statement
      while another connection tried to execute FLUSH TABLES WITH
      READ LOCK concurrently.
      
      What happened was that FTWRL in the second connection managed
      to perform first step of GRL acquisition and thus blocked all
      upcoming DML. After that it started to wait for table open
      through HANDLER statement to be flushed. When the first connection
      tried to execute DML it has started to wait for GRL/the second
      connection creating deadlock.
      
      The second bug manifested itself as starvation of FLUSH TABLES
      WITH READ LOCK statements in cases when there was a constant
      stream of concurrent DML statements (in two or more
      connections).
      
      This has happened because requests for protection against GRL
      which were acquired by DML statements were ignoring presence of
      pending GRL and thus the latter was starved.
      
      This patch solves both these problems by re-implementing GRL
      using metadata locks.
      
      Similar to the old implementation acquisition of GRL in new
      implementation is two-step. During the first step we block
      all concurrent DML and DDL statements by acquiring global S
      metadata lock (each DML and DDL statement acquires global IX
      lock for its duration). During the second step we block commits
      by acquiring global S lock in COMMIT namespace (commit code
      acquires global IX lock in this namespace).
      
      Note that unlike in old implementation acquisition of
      protection against GRL in DML and DDL is semi-automatic.
      We assume that any statement which should be blocked by GRL
      will either open and acquires write-lock on tables or acquires
      metadata locks on objects it is going to modify. For any such
      statement global IX metadata lock is automatically acquired
      for its duration.
      
      The first problem is solved because waits for GRL become
      visible to deadlock detector in metadata locking subsystem
      and thus deadlocks like one in the first bug become impossible.
      
      The second problem is solved because global S locks which
      are used for GRL implementation are given preference over
      IX locks which are acquired by concurrent DML (and we can
      switch to fair scheduling in future if needed).
      
      Important change:
      FTWRL/GRL no longer blocks DML and DDL on temporary tables.
      Before this patch behavior was not consistent in this respect:
      in some cases DML/DDL statements on temporary tables were
      blocked while in others they were not. Since the main use cases
      for FTWRL are various forms of backups and temporary tables are
      not preserved during backups we have opted for consistently
      allowing DML/DDL on temporary tables during FTWRL/GRL.
      
      Important change:
      This patch changes thread state names which are used when
      DML/DDL of FTWRL is waiting for global read lock. It is now
      either "Waiting for global read lock" or "Waiting for commit
      lock" depending on the stage on which FTWRL is.
      
      Incompatible change:
      To solve deadlock in events code which was exposed by this
      patch we have to replace LOCK_event_metadata mutex with
      metadata locks on events. As result we have to prohibit
      DDL on events under LOCK TABLES.
      
      This patch also adds extensive test coverage for interaction
      of DML/DDL and FTWRL.
      
      Performance of new and old global read lock implementations
      in sysbench tests were compared. There were no significant
      difference between new and old implementations.
      
      mysql-test/include/check_ftwrl_compatible.inc:
        Added helper script which allows to check that a statement is
        compatible with FLUSH TABLES WITH READ LOCK.
      mysql-test/include/check_ftwrl_incompatible.inc:
        Added helper script which allows to check that a statement is
        incompatible with FLUSH TABLES WITH READ LOCK.
      mysql-test/include/handler.inc:
        Adjusted test case to the fact that now DROP TABLE closes
        open HANDLERs for the table to be dropped before checking
        if there active FTWRL in this connection.
      mysql-test/include/wait_show_condition.inc:
        Fixed small error in the timeout message. The correct name
        of variable used as parameter for this script is "$condition"
        and not "$wait_condition".
      mysql-test/r/delayed.result:
        Added test coverage for scenario which triggered assert in
        metadata locking subsystem.
      mysql-test/r/events_2.result:
        Updated test results after prohibiting event DDL operations
        under LOCK TABLES.
      mysql-test/r/flush.result:
        Added test coverage for bug #57006 "Deadlock between HANDLER
        and FLUSH TABLES WITH READ LOCK".
      mysql-test/r/flush_read_lock.result:
        Added test coverage for various aspects of FLUSH TABLES WITH
        READ LOCK functionality.
      mysql-test/r/flush_read_lock_kill.result:
        Adjusted test case after replacing custom global read lock
        implementation with one based on metadata locks. Use new
        debug_sync point. Do not disable concurrent inserts as now
        InnoDB we always use InnoDB table.
      mysql-test/r/handler_innodb.result:
        Adjusted test case to the fact that now DROP TABLE closes
        open HANDLERs for the table to be dropped before checking
        if there active FTWRL in this connection.
      mysql-test/r/handler_myisam.result:
        Adjusted test case to the fact that now DROP TABLE closes
        open HANDLERs for the table to be dropped before checking
        if there active FTWRL in this connection.
      mysql-test/r/mdl_sync.result:
        Adjusted test case after replacing custom global read lock
        implementation with one based on metadata locks. Replaced
        usage of GRL-specific debug_sync's with appropriate sync
        points in MDL subsystem.
      mysql-test/suite/perfschema/r/dml_setup_instruments.result:
        Updated test results after removing global
        COND_global_read_lock condition variable.
      mysql-test/suite/perfschema/r/func_file_io.result:
        Ensure that this test doesn't affect subsequent tests.
        At the end of its execution enable back P_S instrumentation
        which this test disables at some point.
      mysql-test/suite/perfschema/r/func_mutex.result:
        Ensure that this test doesn't affect subsequent tests.
        At the end of its execution enable back P_S instrumentation
        which this test disables at some point.
      mysql-test/suite/perfschema/r/global_read_lock.result:
        Adjusted test case to take into account that new GRL
        implementation is based on MDL.
      mysql-test/suite/perfschema/r/server_init.result:
        Adjusted test case after replacing custom global read
        lock implementation with one based on MDL and replacing
        LOCK_event_metadata mutex with metadata lock.
      mysql-test/suite/perfschema/t/func_file_io.test:
        Ensure that this test doesn't affect subsequent tests.
        At the end of its execution enable back P_S instrumentation
        which this test disables at some point.
      mysql-test/suite/perfschema/t/func_mutex.test:
        Ensure that this test doesn't affect subsequent tests.
        At the end of its execution enable back P_S instrumentation
        which this test disables at some point.
      mysql-test/suite/perfschema/t/global_read_lock.test:
        Adjusted test case to take into account that new GRL
        implementation is based on MDL.
      mysql-test/suite/perfschema/t/server_init.test:
        Adjusted test case after replacing custom global read
        lock implementation with one based on MDL and replacing
        LOCK_event_metadata mutex with metadata lock.
      mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result:
        Updated test results after prohibiting event DDL under
        LOCK TABLES.
      mysql-test/t/delayed.test:
        Added test coverage for scenario which triggered assert in
        metadata locking subsystem.
      mysql-test/t/events_2.test:
        Updated test case after prohibiting event DDL operations
        under LOCK TABLES.
      mysql-test/t/flush.test:
        Added test coverage for bug #57006 "Deadlock between HANDLER
        and FLUSH TABLES WITH READ LOCK".
      mysql-test/t/flush_block_commit.test:
        Adjusted test case after changing thread state name which
        is used when COMMIT waits for FLUSH TABLES WITH READ LOCK
        from "Waiting for release of readlock" to "Waiting for commit
        lock".
      mysql-test/t/flush_block_commit_notembedded.test:
        Adjusted test case after changing thread state name which is
        used when DML waits for FLUSH TABLES WITH READ LOCK. Now we
        use "Waiting for global read lock" in this case.
      mysql-test/t/flush_read_lock.test:
        Added test coverage for various aspects of FLUSH TABLES WITH
        READ LOCK functionality.
      mysql-test/t/flush_read_lock_kill-master.opt:
        We no longer need to use make_global_read_lock_block_commit_loop
        debug tag in this test. Instead we rely on an appropriate
        debug_sync point in MDL code.
      mysql-test/t/flush_read_lock_kill.test:
        Adjusted test case after replacing custom global read lock
        implementation with one based on metadata locks. Use new
        debug_sync point. Do not disable concurrent inserts as now
        InnoDB we always use InnoDB table.
      mysql-test/t/lock_multi.test:
        Adjusted test case after changing thread state names which
        are used when DML or DDL waits for FLUSH TABLES WITH READ
        LOCK to "Waiting for global read lock".
      mysql-test/t/mdl_sync.test:
        Adjusted test case after replacing custom global read lock
        implementation with one based on metadata locks. Replaced
        usage of GRL-specific debug_sync's with appropriate sync
        points in MDL subsystem. Updated thread state names which
        are used when DDL waits for FTWRL.
      mysql-test/t/trigger_notembedded.test:
        Adjusted test case after changing thread state names which
        are used when DML or DDL waits for FLUSH TABLES WITH READ
        LOCK to "Waiting for global read lock".
      sql/event_data_objects.cc:
        Removed Event_queue_element::status/last_executed_changed
        members and Event_queue_element::update_timing_fields()
        method. We no longer use this class for updating mysql.events
        once event is chosen for execution. Accesses to instances of
        this class in scheduler thread require protection by
        Event_queue::LOCK_event_queue mutex and we try to avoid
        updating table while holding this lock.
      sql/event_data_objects.h:
        Removed Event_queue_element::status/last_executed_changed
        members and Event_queue_element::update_timing_fields()
        method. We no longer use this class for updating mysql.events
        once event is chosen for execution. Accesses to instances of
        this class in scheduler thread require protection by
        Event_queue::LOCK_event_queue mutex and we try to avoid
        updating table while holding this lock.
      sql/event_db_repository.cc:
        - Changed Event_db_repository methods to not release all
          metadata locks once they are done updating mysql.events
          table. This allows to keep metadata lock protecting
          against GRL and lock protecting particular event around
          until corresponding DDL statement is written to the binary
          log.
        - Removed logic for conditional update of "status" and
          "last_executed" fields from update_timing_fields_for_event()
          method. In the only case when this method is called now
          "last_executed" is always modified and tracking change
          of "status" is too much hassle.
      sql/event_db_repository.h:
        Removed logic for conditional update of "status" and
        "last_executed" fields from Event_db_repository::
        update_timing_fields_for_event() method.
        In the only case when this method is called now "last_executed"
        is always modified and tracking change of "status" field is
        too much hassle.
      sql/event_queue.cc:
        Changed event scheduler code not to update mysql.events
        table while holding Event_queue::LOCK_event_queue mutex.
        Doing so led to a deadlock with a new GRL implementation.
        This deadlock didn't occur with old implementation due to
        fact that code acquiring protection against GRL ignored
        pending GRL requests (which lead to GRL starvation).
        One of goals of new implementation is to disallow GRL
        starvation and so we have to solve problem with this
        deadlock in a different way.
      sql/events.cc:
        Changed methods of Events class to acquire protection
        against GRL while perfoming DDL statement and keep it
        until statement is written to the binary log.
        Unfortunately this step together with new GRL implementation
        exposed deadlock involving Events::LOCK_event_metadata
        and GRL. To solve it Events::LOCK_event_metadata mutex was
        replaced with a metadata lock on event. As a side-effect
        events DDL has to be prohibited under LOCK TABLES even in
        cases when mysql.events table was explicitly locked for
        write.
      sql/events.h:
        Replaced Events::LOCK_event_metadata mutex with a metadata
        lock on event.
      sql/ha_ndbcluster.cc:
        Updated code after replacing custom global read lock
        implementation with one based on MDL. Since MDL subsystem
        should now be able to detect deadlocks involving metadata
        locks and GRL there is no need for special handling of
        active GRL.
      sql/handler.cc:
        Replaced custom implementation of global read lock with
        one based on metadata locks. Consequently when doing
        commit instead of calling method of Global_read_lock
        class to acquire protection against GRL we simply acquire
        IX in COMMIT namespace.
      sql/lock.cc:
        Replaced custom implementation of global read lock with
        one based on metadata locks. This step allows to expose
        wait for GRL to deadlock detector of MDL subsystem and
        thus succesfully resolve deadlocks similar to one behind
        bug #57006 "Deadlock between HANDLER and FLUSH TABLES
        WITH READ LOCK". It also solves problem with GRL starvation
        described in bug #54673 "It takes too long to get readlock
        for 'FLUSH TABLES WITH READ LOCK'" since metadata locks used
        by GRL give preference to FTWRL statement instead of DML
        statements (if needed in future this can be changed to
        fair scheduling).
        
        Similar to old implementation of acquisition of GRL is
        two-step. During the first step we block all concurrent
        DML and DDL statements by acquiring global S metadata lock
        (each DML and DDL statement acquires global IX lock for
        its duration). During the second step we block commits by
        acquiring global S lock in COMMIT namespace (commit code
        acquires global IX lock in this namespace).
        
        Note that unlike in old implementation acquisition of
        protection against GRL in DML and DDL is semi-automatic.
        We assume that any statement which should be blocked by GRL
        will either open and acquires write-lock on tables or acquires
        metadata locks on objects it is going to modify. For any such
        statement global IX metadata lock is automatically acquired
        for its duration.
        
        To support this change:
        - Global_read_lock::lock/unlock_global_read_lock and
          make_global_read_lock_block_commit methods were changed
          accordingly.
        - Global_read_lock::wait_if_global_read_lock() and
          start_waiting_global_read_lock() methods were dropped.
          It is now responsibility of code acquiring metadata locks
          opening tables to acquire protection against GRL by
          explicitly taking global IX lock with statement duration.
        - Global variables, mutex and condition variable used by
          old implementation was removed.
        - lock_routine_name() was changed to use statement duration for
          its global IX lock. It was also renamed to lock_object_name()
          as it now also used to take metadata locks on events.
        - Global_read_lock::set_explicit_lock_duration() was added which
          allows not to release locks used for GRL when leaving prelocked
          mode.
      sql/lock.h:
        - Renamed lock_routine_name() to lock_object_name() and changed
          its signature to allow its usage for events.
        - Removed broadcast_refresh() function. It is no longer needed
          with new GRL implementation.
      sql/log_event.cc:
        Release metadata locks with statement duration at the end
        of processing legacy event for LOAD DATA. This ensures that
        replication thread processing such event properly releases
        its protection against global read lock.
      sql/mdl.cc:
        Changed MDL subsystem to support new MDL-based implementation
        of global read lock.
        
        Added COMMIT and EVENTS namespaces for metadata locks. Changed
        thread state name for GLOBAL namespace to "Waiting for global
        read lock".
        
        Optimized MDL_map::find_or_insert() method to avoid taking
        m_mutex mutex when looking up MDL_lock objects for GLOBAL
        or COMMIT namespaces. We keep pre-created MDL_lock objects
        for these namespaces around and simply return pointers to
        these global objects when needed.
        
        Changed MDL_lock/MDL_scoped_lock to properly handle
        notification of insert delayed handler threads when FTWRL
        takes global S lock.
        
        Introduced concept of lock duration. In addition to locks with
        transaction duration which work in the way which is similar to
        how locks worked before (i.e. they are released at the end of
        transaction), locks with statement and explicit duration were
        introduced.
        Locks with statement duration are automatically released at the
        end of statement. Locks with explicit duration require explicit
        release and obsolete concept of transactional sentinel.
        
        * Changed MDL_request and MDL_ticket classes to support notion
          of duration.
        * Changed MDL_context to keep locks with different duration in
          different lists. Changed code handling ticket list to take
          this into account.
        * Changed methods responsible for releasing locks to take into
          account duration of tickets. Particularly public
          MDL_context::release_lock() method now only can release
          tickets with explicit duration (there is still internal
          method which allows to specify duration). To release locks
          with statement or transaction duration one have to use
          release_statement/transactional_locks() methods.
        * Concept of savepoint for MDL subsystem now has to take into
          account locks with statement duration. Consequently
          MDL_savepoint class was introduced and methods working with
          savepoints were updated accordingly.
        * Added methods which allow to set duration for one or all
          locks in the context.
      sql/mdl.h:
        Changed MDL subsystem to support new MDL-based implementation
        of global read lock.
        
        Added COMMIT and EVENTS namespaces for metadata locks.
        
        Introduced concept of lock duration. In addition to locks with
        transaction duration which work in the way which is similar to
        how locks worked before (i.e. they are released at the end of
        transaction), locks with statement and explicit duration were
        introduced.
        Locks with statement duration are automatically released at the
        end of statement. Locks with explicit duration require explicit
        release and obsolete concept of transactional sentinel.
        
        * Changed MDL_request and MDL_ticket classes to support notion
          of duration.
        * Changed MDL_context to keep locks with different duration in
          different lists. Changed code handling ticket list to take
          this into account.
        * Changed methods responsible for releasing locks to take into
          account duration of tickets. Particularly public
          MDL_context::release_lock() method now only can release
          tickets with explicit duration (there is still internal
          method which allows to specify duration). To release locks
          with statement or transaction duration one have to use
          release_statement/transactional_locks() methods.
        * Concept of savepoint for MDL subsystem now has to take into
          account locks with statement duration. Consequently
          MDL_savepoint class was introduced and methods working with
          savepoints were updated accordingly.
        * Added methods which allow to set duration for one or all
          locks in the context.
      sql/mysqld.cc:
        Removed global mutex and condition variables which were used
        by old implementation of GRL.
        Also we no longer need to initialize Events::LOCK_event_metadata
        mutex as it was replaced with metadata locks on events.
      sql/mysqld.h:
        Removed global variable, mutex and condition variables which
        were used by old implementation of GRL.
      sql/rpl_rli.cc:
        When slave thread closes tables which were open for handling
        of RBR events ensure that it releases global IX lock which
        was acquired as protection against GRL.
      sql/sp.cc:
        Adjusted code to the new signature of lock_object/routine_name(),
        to the fact that one now needs specify duration of lock when
        initializing MDL_request and to the fact that savepoints for MDL
        subsystem are now represented by MDL_savepoint class.
      sql/sp_head.cc:
        Ensure that statements in stored procedures release statement
        metadata locks and thus release their protectiong against GRL
        in proper moment in time.
        Adjusted code to the fact that one now needs specify duration
        of lock when initializing MDL_request.
      sql/sql_admin.cc:
        Adjusted code to the fact that one now needs specify duration
        of lock when initializing MDL_request.
      sql/sql_base.cc:
        - Implemented support for new approach to acquiring protection
          against global read lock. We no longer acquire such protection
          explicitly on the basis of statement flags. Instead we always
          rely on code which is responsible for acquiring metadata locks
          on object to be changed acquiring this protection. This is
          achieved by acquiring global IX metadata lock with statement
          duration. Code doing this also responsible for checking that
          current connection has no active GRL by calling an
          Global_read_lock::can_acquire_protection() method.
          Changed code in open_table() and lock_table_names()
          accordingly.
          Note that as result of this change DDL and DML on temporary
          tables is always compatible with GRL (before it was
          incompatible in some cases and compatible in other cases).
        - To speed-up code acquiring protection against GRL introduced
          m_has_protection_against_grl member in Open_table_context
          class. It indicates that protection was already acquired
          sometime during open_tables() execution and new attempts
          can be skipped.
        - Thanks to new GRL implementation calls to broadcast_refresh()
          became unnecessary and were removed.
        - Adjusted code to the fact that one now needs specify duration
          of lock when initializing MDL_request and to the fact that
          savepoints for MDL subsystem are now represented by
          MDL_savepoint class.
      sql/sql_base.h:
        Adjusted code to the fact that savepoints for MDL subsystem are
        now represented by MDL_savepoint class.
        Also introduced Open_table_context::m_has_protection_against_grl
        member which allows to avoid acquiring protection against GRL
        while opening tables if such protection was already acquired.
      sql/sql_class.cc:
        Changed THD::leave_locked_tables_mode() after transactional
        sentinel for metadata locks was obsoleted by introduction of
        locks with explicit duration.
      sql/sql_class.h:
        - Adjusted code to the fact that savepoints for MDL subsystem
          are now represented by MDL_savepoint class.
        - Changed Global_read_lock class according to changes in
          global read lock implementation:
          * wait_if_global_read_lock and start_waiting_global_read_lock
            are now gone. Instead code needing protection against GRL
            has to acquire global IX metadata lock with statement
            duration itself. To help it new can_acquire_protection()
            was introduced. Also as result of the above change
            m_protection_count member is gone too.
          * Added m_mdl_blocks_commits_lock member to store metadata
            lock blocking commits.
          * Adjusted code to the fact that concept of transactional
            sentinel was obsoleted by concept of lock duration.
        - Removed CF_PROTECT_AGAINST_GRL flag as it is no longer
          necessary. New GRL implementation acquires protection
          against global read lock automagically when statement
          acquires metadata locks on tables or other objects it
          is going to change.
      sql/sql_db.cc:
        Adjusted code to the fact that one now needs specify duration
        of lock when initializing MDL_request.
      sql/sql_handler.cc:
        Removed call to broadcast_refresh() function. It is no longer
        needed with new GRL implementation.
        Adjusted code after introducing duration concept for metadata
        locks. Particularly to the fact transactional sentinel was
        replaced with explicit duration.
      sql/sql_handler.h:
        Renamed mysql_ha_move_tickets_after_trans_sentinel() to
        mysql_ha_set_explicit_lock_duration() after transactional
        sentinel was obsoleted by locks with explicit duration.
      sql/sql_insert.cc:
        Adjusted code handling delaying inserts after switching to
        new GRL implementation. Now connection thread initiating
        delayed insert has to acquire global IX lock in addition
        to metadata lock on table being inserted into. This IX lock
        protects against GRL and similarly to SW lock on table being
        inserted into has to be passed to handler thread in order to
        avoid deadlocks.
      sql/sql_lex.cc:
        LEX::protect_against_global_read_lock member is no longer
        necessary since protection against GRL is automatically
        taken by code acquiring metadata locks/opening tables.
      sql/sql_lex.h:
        LEX::protect_against_global_read_lock member is no longer
        necessary since protection against GRL is automatically
        taken by code acquiring metadata locks/opening tables.
      sql/sql_parse.cc:
        - Implemented support for new approach to acquiring protection
          against global read lock. We no longer acquire such protection
          explicitly on the basis of statement flags. Instead we always
          rely on code which is responsible for acquiring metadata locks
          on object to be changed acquiring this protection. This is
          achieved by acquiring global IX metadata lock with statement
          duration. This lock is automatically released at the end of
          statement execution.
        - Changed implementation of CREATE/DROP PROCEDURE/FUNCTION not
          to release metadata locks and thus protection against of GRL
          in the middle of statement execution.
        - Adjusted code to the fact that one now needs specify duration
          of lock when initializing MDL_request and to the fact that
          savepoints for MDL subsystem are now represented by
          MDL_savepoint class.
      sql/sql_prepare.cc:
        Adjusted code to the to the fact that savepoints for MDL
        subsystem are now represented by MDL_savepoint class.
      sql/sql_rename.cc:
        With new GRL implementation there is no need to explicitly
        acquire protection against GRL before renaming tables.
        This happens automatically in code which acquires metadata
        locks on tables being renamed.
      sql/sql_show.cc:
        Adjusted code to the fact that one now needs specify duration
        of lock when initializing MDL_request and to the fact that
        savepoints for MDL subsystem are now represented by
        MDL_savepoint class.
      sql/sql_table.cc:
        - With new GRL implementation there is no need to explicitly
          acquire protection against GRL before dropping tables.
          This happens automatically in code which acquires metadata
          locks on tables being dropped.
        - Changed mysql_alter_table() not to release lock on new table
          name explicitly and to rely on automatic release of locks
          at the end of statement instead. This was necessary since
          now MDL_context::release_lock() is supported only for locks
          for explicit duration.
      sql/sql_trigger.cc:
        With new GRL implementation there is no need to explicitly
        acquire protection against GRL before changing table triggers.
        This happens automatically in code which acquires metadata
        locks on tables which triggers are to be changed.
      sql/sql_update.cc:
        Fix bug exposed by GRL testing. During prepare phase acquire
        only S metadata locks instead of SW locks to keep prepare of
        multi-UPDATE compatible with concurrent LOCK TABLES WRITE
        and global read lock.
      sql/sql_view.cc:
        With new GRL implementation there is no need to explicitly
        acquire protection against GRL before creating view.
        This happens automatically in code which acquires metadata
        lock on view to be created.
      sql/sql_yacc.yy:
        LEX::protect_against_global_read_lock member is no longer
        necessary since protection against GRL is automatically
        taken by code acquiring metadata locks/opening tables.
      sql/table.cc:
        Adjusted code to the fact that one now needs specify duration
        of lock when initializing MDL_request.
      sql/table.h:
        Adjusted code to the fact that one now needs specify duration
        of lock when initializing MDL_request.
      sql/transaction.cc:
        Replaced custom implementation of global read lock with
        one based on metadata locks. Consequently when doing
        commit instead of calling method of Global_read_lock
        class to acquire protection against GRL we simply acquire
        IX in COMMIT namespace.
        Also adjusted code to the fact that MDL savepoint is now
        represented by MDL_savepoint class.
      6bf6272f
  4. 09 Nov, 2010 2 commits
    • Davi Arnaut's avatar
      Bug#58080: Crash on failure to create a thread to handle a user connection · 51ffca50
      Davi Arnaut authored
      The problem was that the scheduler function used to handle a
      new user connection could use the ER() macro without having a
      THD object bound to the current thread. The crash would happen
      whenever the function failed to create a new thread to handle a
      user connection. Thread creation can fail due to lack or limit
      of available resources.
      
      The solution is to simply use the ER_THD() macro instead and pass
      to it the THD object which would be bound to the connection.
      
      Fix was tested manually. In a test case, it is too cumbersome to
      inject a error in this context.
      
      sql/mysqld.cc:
        Use ER_THD and pass the object.
      51ffca50
    • Davi Arnaut's avatar
      Bug#57210: remove pstack · 1b88853a
      Davi Arnaut authored
      Quoting from the bug report:
      
      The pstack library has been included in MySQL since version
      4.0.0. It's useless and should be removed.
      
      Details: According to its own documentation, pstack only works
      on Linux on x86 in 32 bit mode and requires LinuxThreads and a
      statically linked binary. It doesn't really support any Linux
      from 2003 or later and doesn't work on any other OS.
      
      The --enable-pstack option is thus deprecated and has no effect.
      1b88853a
  5. 05 Nov, 2010 1 commit
    • Guilhem Bichot's avatar
      Fix for BUG#57316 "It is not clear how to disable autocommit" · 03b9e738
      Guilhem Bichot authored
      add boolean command-line option --autocommit.
      
      mysql-test/mysql-test-run.pl:
        do in --gdb like in --ddd: to let the developer debug the startup
        phase (like command-line options parsing), don't "run".
        It's the third time I do this change, it was previously lost
        by merges, port of 6.0 to next-mr...
      mysql-test/r/mysqld--help-notwin.result:
        new command-line option
      mysql-test/r/mysqld--help-win.result:
        a Linux user's best guess at what the Windows result should be
      mysql-test/suite/sys_vars/inc/autocommit_func2.inc:
        new test
      mysql-test/suite/sys_vars/t/autocommit_func2-master.opt:
        test new option
      mysql-test/suite/sys_vars/t/autocommit_func3-master.opt:
        test new option
      sql/mysqld.cc:
        new --autocommit
      sql/mysqld.h:
        new --autocommit
      sql/sql_partition.cc:
        What matters to this partitioning quote is to have
        the OPTION_QUOTE_SHOW_CREATE flag down, it's all
        that append_identifier() uses. So we make it explicit.
      03b9e738
  6. 04 Nov, 2010 1 commit
    • He Zhenxing's avatar
      BUG#47027 delegates_init() failure is not user friendly (usability issue) · 6429e7d3
      He Zhenxing authored
            
      Function delegetas_init() did not report proper error messages
      when there are failures, which made it hard to know where the problem
      occurred.
      
      Fixed the problem by adding specific error message for every possible
      place that can fail. And since these failures are supposed to never
      happen, ask the user to report a bug if they happened.
      6429e7d3
  7. 08 Oct, 2010 2 commits
    • Davi Arnaut's avatar
      Bug#45288: pb2 returns a lot of compilation warnings on linux · f60106f8
      Davi Arnaut authored
      Fix assorted compiler warnings.
      
      sql/mysqld.cc:
        Do not declare max_page_size twice. If large pages support
        is enabled, the code expects the size in max_desired_page_size.
      storage/innobase/include/ibuf0ibuf.h:
        Remove trailing comma. Only present in C99.
        
        Approved by: Vasil (via IRC)
      storage/innobase/include/row0row.h:
        Remove trailing comma. Only present in C99.
        
        Approved by: Vasil (via IRC)
      strings/my_vsnprintf.c:
        No need to assert the obvious.
      f60106f8
    • Alexey Botchkov's avatar
      Bug#30025 Mysqld prints out warnings/errors being run with --no-defaults --help · 5f318d4a
      Alexey Botchkov authored
              now do no initializations for the --help.
              Do it for --verbose --help though.
      
      per-file comments:
        sql/mysqld.cc
      Bug#30025 Mysqld prints out warnings/errors being run with --no-defaults --help
              quit with the help message at once as --help was given
      5f318d4a
  8. 06 Oct, 2010 1 commit
  9. 04 Oct, 2010 1 commit
    • Davi Arnaut's avatar
      Bug#57210: remove pstack · 40ee088f
      Davi Arnaut authored
      Quoting from the bug report:
      
      The pstack library has been included in MySQL since version
      4.0.0. It's useless and should be removed.
      
      Details: According to its own documentation, pstack only works
      on Linux on x86 in 32 bit mode and requires LinuxThreads and a
      statically linked binary. It doesn't really support any Linux
      from 2003 or later and doesn't work on any other OS.
      40ee088f
  10. 28 Sep, 2010 1 commit
    • smenon's avatar
      Backport into mysql-5.1.49sp1-release · e73738f1
      smenon authored
      > ------------------------------------------------------------
      > revno: 3457.3.1
      > revision-id: alexey.kopytov@sun.com-20100712145855-niybvwsthe480r69
      > parent: mattias.jonsson@oracle.com-20100709130033-fgr7hggrrebf6qkc
      > committer: Alexey Kopytov <Alexey.Kopytov@sun.com>
      > branch nick: 55061-5.1-bugteam
      > timestamp: Mon 2010-07-12 18:58:55 +0400
      > message:
      >   Bug#55061: Build failing on sol 8 x86 - assembler code vs 
      >              compiler problem
      >   
      >   GCC-style inline assembly is not supported by the Sun Studio
      >   compilers prior to version 12.
      >   
      >   Added a check for the Sun Studio version to avoid using 
      >   _FPU_GETCW() / _FPU_SETCW() when inline assembly is
      >    unsupported. This can lead to some differences in floating
      >   point calculations on Solaris 8/x86 which, however, is not worth
      >   bothering with Sun-style assembly .il templates.
      e73738f1
  11. 09 Sep, 2010 1 commit
    • Marc Alff's avatar
      Bug#56324 Race Condition while shutting down MySQL: "PSI_server" · bb04ac97
      Marc Alff authored
      Before this fix, the server could crash during shutdown,
      due to race conditions, that occured when killing the server.
      
      In particular, the performance schema instrumentation handle,
      PSI_server, and the performance schema itself would be cleaned up
      too soon, causing race conditions with a running kill server thread.
      
      The specifics of the race condition found are that:
      the main thread executing "PSI_server= NULL" can cause crashes in
      other threads still running, which are executing
      "if (PSI_server != NULL) PSI_server->xxx()"
      as part of the performance schema instrumentation.
      
      While the bug was reported for the kill server thread,
      in theory the same crash could happen with the signal thread,
      as found by code analysis.
      
      The correct fix would be to only shutdown the performance schema
      and set PSI_server to NULL after every other thread is guaranteed
      to be completed, including the kill_server_thread.
      
      However, due to the existing mysqld server design, this is not the case.
      See in particular bug number 56666.
      
      The work around used to fix this race condition is to simply not
      perform the call to shutdown_performance_schema() when the server exits,
      and to keep the PSI_server pointer unchanged.
      
      This will cause memory leaks to be reported by tools like valgrind,
      but no memory leak actually happen because the process is about to exit().
      
      As a result, the file mysql-test/valgrind.supp has been updated
      to filter out these false positive messages.
      
      This code has been tested with running in a loop the following
      tests in parallel, which have been known to fail with race conditions
      in the past:
      - rpl_change_master
      - binlog_max_extension
      - events_restart
      - rpl_heartbeat_basic
      and no crash of test failure has been seen with the changed code.
      bb04ac97
  12. 02 Sep, 2010 1 commit
    • Alexey Botchkov's avatar
      Bug#53251 mysql_library_init fails on second execution with embedded library · c6024dfc
      Alexey Botchkov authored
                thread-specific variables weren't set when we load error message files.
      
      per-file comments:
        libmysqld/lib_sql.cc
      Bug#53251      mysql_library_init fails on second execution with embedded library
            we need to call my_thread_init() once more. Normally it's called at the my_init()
            stage but that doesn't happen on the second my_init() call.
      
        sql/derror.cc
      Bug#53251      mysql_library_init fails on second execution with embedded library
           use default errors for the embedded server.
      
        sql/mysqld.cc
      Bug#53251      mysql_library_init fails on second execution with embedded library
              unregister server errors in clean_up(). Without it the error list contains
              that on the second mysql_server_init() which is not good.
      
        sql/set_var.cc
      Bug#53251      mysql_library_init fails on second execution with embedded library
              sys_var::cleanup() call instead of the destructor
      
        sql/set_var.h
      Bug#53251      mysql_library_init fails on second execution with embedded library
              sys_var::cleanup() introduced instead of the destructor
              
        sql/sys_vars.h
      Bug#53251      mysql_library_init fails on second execution with embedded library
              Sys_var_charptr::cleanup() implemented
      c6024dfc
  13. 25 Aug, 2010 2 commits
    • Marc Alff's avatar
      Bug#52312 lost Handler_read_last status variable · 25704549
      Marc Alff authored
      Before this fix, the ha_read_last_count status variable was defined and
      updated internally, for never exposed as a system variable.
      
      This fix exposes the system variable as "Handler_read_last",
      for completness of the Handler_read_* system variables interface.
      
      Adjusted tests results accordingly.
      25704549
    • Dmitry Shulga's avatar
      Fixed bug #29751 - do not rename the error log at FLUSH LOGS. · 800feb16
      Dmitry Shulga authored
      Added open log file with FILE_SHARE_DELETE flag on Windows.
      
      sql/log.cc:
        added reopen_fstreams();
        modified redirect_std_streams(): call to sequence of freopen()
        replaced to reopen_fstreams();
        modified flush_error_log(): removed file rename for flushed
        error log file.
      sql/mysqld.cc:
        modified main() and init_server_components(): do open log error file
        over call to reopen_fstreams().
      800feb16
  14. 20 Aug, 2010 1 commit
    • Alfranio Correia's avatar
      BUG#53452 Inconsistent behavior of binlog_direct_non_transactional_updates with · ac6026ce
      Alfranio Correia authored
      temp table
                  
      This patch introduces two key changes in the replication's behavior.
                  
      Firstly, it reverts part of BUG#51894 which puts any update to temporary tables
      into the trx-cache. Now, updates to temporary tables are handled according to
      the type of their engines as a regular table.
                  
      Secondly, an unsafe mixed statement, (i.e. a statement that access transactional
      table as well non-transactional or temporary table, and writes to any of them),
      are written into the trx-cache in order to minimize errors in the execution when
      the statement logging format is in use.
                  
      Such changes has a direct impact on which statements are classified as unsafe
      statements and thus part of BUG#53259 is reverted.
      ac6026ce
  15. 13 Aug, 2010 1 commit
  16. 09 Aug, 2010 1 commit
  17. 27 Jul, 2010 1 commit
    • Dmitry Lenev's avatar
      Fix for bug #52044 "FLUSH TABLES WITH READ LOCK and FLUSH · 00496b7a
      Dmitry Lenev authored
      TABLES <list> WITH READ LOCK are incompatible".
      
      The problem was that FLUSH TABLES <list> WITH READ LOCK
      which was issued when other connection has acquired global
      read lock using FLUSH TABLES WITH READ LOCK was blocked
      and has to wait until global read lock is released.
      
      This issue stemmed from the fact that FLUSH TABLES <list>
      WITH READ LOCK implementation has acquired X metadata locks
      on tables to be flushed. Since these locks required acquiring
      of global IX lock this statement was incompatible with global
      read lock.
      
      This patch addresses problem by using SNW metadata type of
      lock for tables to be flushed by FLUSH TABLES <list> WITH
      READ LOCK. It is OK to acquire them without global IX lock
      as long as we won't try to upgrade those locks. Since SNW
      locks allow concurrent statements using same table FLUSH
      TABLE <list> WITH READ LOCK now has to wait until old
      versions of tables to be flushed go away after acquiring
      metadata locks. Since such waiting can lead to deadlock
      MDL deadlock detector was extended to take into account
      waits for flush and resolve such deadlocks.
      
      As a bonus code in open_tables() which was responsible for
      waiting old versions of tables to go away was refactored.
      Now when we encounter old version of table in open_table()
      we don't back-off and wait for all old version to go away,
      but instead wait for this particular table to be flushed.
      Such approach supported by deadlock detection should reduce
      number of scenarios in which FLUSH TABLES aborts concurrent
      multi-statement transactions.
      
      Note that active FLUSH TABLES <list> WITH READ LOCK still
      blocks concurrent FLUSH TABLES WITH READ LOCK statement
      as the former keeps tables open and thus prevents the
      latter statement from doing flush.
      
      mysql-test/include/handler.inc:
        Adjusted test case after changing status which is set
        when FLUSH TABLES waits for tables to be flushed from
        "Flushing tables" to "Waiting for table".
      mysql-test/r/flush.result:
        Added test which checks that "flush tables <list> with
        read lock" is compatible with active "flush tables with
        read lock" but not vice-versa. This test also covers
        bug #52044 "FLUSH TABLES WITH READ LOCK and FLUSH TABLES
        <list> WITH READ LOCK are incompatible".
      mysql-test/r/mdl_sync.result:
        Added scenarios in which wait for table to be flushed
        causes deadlocks to the coverage of MDL deadlock detector.
      mysql-test/suite/perfschema/r/dml_setup_instruments.result:
        Adjusted test results after removal of COND_refresh
        condition variable.
      mysql-test/suite/perfschema/r/server_init.result:
        Adjusted test and its results after removal of COND_refresh
        condition variable.
      mysql-test/suite/perfschema/t/server_init.test:
        Adjusted test and its results after removal of COND_refresh
        condition variable.
      mysql-test/t/flush.test:
        Added test which checks that "flush tables <list> with
        read lock" is compatible with active "flush tables with
        read lock" but not vice-versa. This test also covers
        bug #52044 "FLUSH TABLES WITH READ LOCK and FLUSH TABLES
        <list> WITH READ LOCK are incompatible".
      mysql-test/t/kill.test:
        Adjusted test case after changing status which is set
        when FLUSH TABLES waits for tables to be flushed from
        "Flushing tables" to "Waiting for table".
      mysql-test/t/lock_multi.test:
        Adjusted test case after changing status which is set
        when FLUSH TABLES waits for tables to be flushed from
        "Flushing tables" to "Waiting for table".
      mysql-test/t/mdl_sync.test:
        Added scenarios in which wait for table to be flushed
        causes deadlocks to the coverage of MDL deadlock detector.
      sql/ha_ndbcluster.cc:
        Adjusted code after adding one more parameter for
        close_cached_tables() call - timeout for waiting for
        table to be flushed.
      sql/ha_ndbcluster_binlog.cc:
        Adjusted code after adding one more parameter for
        close_cached_tables() call - timeout for waiting for
        table to be flushed.
      sql/lock.cc:
        Removed COND_refresh condition variable. See comment
        for sql_base.cc for details.
      sql/mdl.cc:
        Now MDL deadlock detector takes into account information
        about waits for table flushes when searching for deadlock.
        To implement this change:
        - Declaration of enum_deadlock_weight and
          Deadlock_detection_visitor were moved to mdl.h header
          to make them available to the code in table.cc which
          implements deadlock detector traversal through edges
          of waiters graph representing waiting for flush.
        - Since now MDL_context may wait not only for metadata
          lock but also for table to be flushed an abstract
          Wait_for_edge class was introduced. Its descendants
          MDL_ticket and Flush_ticket incapsulate specifics
          of inspecting waiters graph when following through
          edge representing wait of particular type.
        
        We no longer require global IX metadata lock when acquiring
        SNW or SNRW locks. Such locks are needed only when metadata
        locks of these types are upgraded to X locks. This allows
        to use SNW locks in FLUSH TABLES <list> WITH READ LOCK
        implementation and keep the latter compatible with global
        read lock.
      sql/mdl.h:
        Now MDL deadlock detector takes into account information
        about waits for table flushes when searching for deadlock.
        To implement this change:
        - Declaration of enum_deadlock_weight and
          Deadlock_detection_visitor were moved to mdl.h header
          to make them available to the code in table.cc which
          implements deadlock detector traversal through edges
          of waiters graph representing waiting for flush.
        - Since now MDL_context may wait not only for metadata
          lock but also for table to be flushed an abstract
          Wait_for_edge class was introduced. Its descendants
          MDL_ticket and Flush_ticket incapsulate specifics
          of inspecting waiters graph when following through
          edge representing wait of particular type.
        - Deadlock_detection_visitor now has m_table_shares_visited
          member which allows to support recursive locking for
          LOCK_open. This is required when deadlock detector
          inspects waiters graph which contains several edges
          representing waits for flushes or needs to come through
          the such edge more than once.
      sql/mysqld.cc:
        Removed COND_refresh condition variable. See comment
        for sql_base.cc for details.
      sql/mysqld.h:
        Removed COND_refresh condition variable. See comment
        for sql_base.cc for details.
      sql/sql_base.cc:
        Changed approach to how threads are waiting for table
        to be flushed. Now thread that wants to wait for old
        table to go away subscribes for notification by adding
        Flush_ticket to table's share and waits using
        MDL_context::m_wait object. Once table gets flushed
        (i.e. all tables are closed and table share is ready
        to be destroyed) all such waiters are notified
        individually.
        Thanks to this change MDL deadlock detector can take
        such waits into account.
        
        To implement this/as result of this change:
        - tdc_wait_for_old_versions() was replaced with
          tdc_wait_for_old_version() which waits for individual
          old share to go away and which is called by open_table()
          after finding out that share is outdated. We don't
          need to perform back-off before such waiting thanks
          to the fact that deadlock detector now sees such waits.
        - As result Open_table_ctx::m_mdl_requests became
          unnecessary and was removed. We no longer allocate
          copies of MDL_request objects on MEM_ROOT when
          MYSQL_OPEN_FORCE_SHARED/SHARED_HIGH_PRIO flags are
          in effect.
        - close_cached_tables() and tdc_wait_for_old_version()
          share code which implements waiting for share to be
          flushed - the both use TABLE_SHARE::wait_until_flush()
          method. Thanks to this close_cached_tables() supports
          timeouts and has extra parameter for this.
        - Open_table_context::OT_MDL_CONFLICT enum element was
          renamed to OT_CONFLICT as it is now also used in cases
          when back-off is required to resolve deadlock caused
          by waiting for flush and not metadata lock.
        - In cases when we discover that current connection tries
          to open tables from different generation we now simply
          back-off and restart process of opening tables. To
          support this Open_table_context::OT_REOPEN_TABLES enum
          element was added.
        - COND_refresh condition variable became unnecessary and
          was removed.
        - mysql_notify_thread_having_shared_lock() no longer wakes
          up connections waiting for flush as all such connections
          can be waken up by deadlock detector if necessary.
      sql/sql_base.h:
        - close_cached_tables() now has one more parameter -
          timeout for waiting for table to be flushed.
        - Open_table_context::OT_MDL_CONFLICT enum element was
          renamed to OT_CONFLICT as it is now also used in cases
          when back-off is required to resolve deadlock caused
          by waiting for flush and not metadata lock.
          Added new OT_REOPEN_TABLES enum element to be used in
          cases when we need to restart open tables process even
          in the middle of transaction.
        - Open_table_ctx::m_mdl_requests became unnecessary and
          was removed.
      sql/sql_class.h:
        Added assert ensuring that we won't use LOCK_open mutex
        with THD::enter_cond(). Otherwise deadlocks can arise in
        MDL deadlock detector.
      sql/sql_parse.cc:
        Changed FLUSH TABLES <list> WITH READ LOCK to take SNW
        metadata locks instead of X locks on tables to be flushed.
        Since we no longer require global IX lock to be taken
        when SNW locks are taken this makes this statement
        compatible with FLUSH TABLES WITH READ LOCK statement.
        Since SNW locks allow other connections to have table
        opened FLUSH TABLES <list> WITH READ LOCK now has to
        wait during open_tables() for old version to go away.
        Such waits can lead to deadlocks which will be detected
        by MDL deadlock detector which now takes waits for table
        to be flushed into account.
        
        Also adjusted code after adding one more parameter for
        close_cached_tables() call - timeout for waiting for
        table to be flushed.
      sql/sql_yacc.yy:
        FLUSH TABLES <list> WITH READ LOCK now needs only SNW
        metadata locks on tables.
      sql/sys_vars.cc:
        Adjusted code after adding one more parameter for
        close_cached_tables() call - timeout for waiting for
        table to be flushed.
      sql/table.cc:
        Implemented new approach to how threads are waiting for
        table to be flushed. Now thread that wants to wait for
        old table to go away subscribes for notification by
        adding Flush_ticket to table's share and waits using
        MDL_context::m_wait object. Once table gets flushed
        (i.e. all tables are closed and table share is ready
        to be destroyed) all such waiters are notified
        individually. This change allows to make such waits
        visible inside of MDL deadlock detector.
        To do it:
        
        - Added list of waiters/Flush_tickets to TABLE_SHARE
          class.
        - Changed free_table_share() to postpone freeing of
          share memory until last waiter goes away and to
          wake up subscribed waiters.
        - Added TABLE_SHARE::wait_until_flushed() method which
          implements subscription to the list of waiters for
          table to be flushed and waiting for this event.
        
        Implemented interface which allows to expose waits for
        flushes to MDL deadlock detector:
        
        - Introduced Flush_ticket class a descendant of
          Wait_for_edge class.
        - Added TABLE_SHARE::find_deadlock() method which allows
          deadlock detector to find out what contexts are still
          using old version of table in question (i.e. to find
          out what contexts are waited for by owner of
          Flush_ticket).
      sql/table.h:
        In order to support new strategy of waiting for table flush
        (see comment for table.cc for details) added list of
        waiters/Flush_tickets to TABLE_SHARE class.
        
        Implemented interface which allows to expose waits for
        flushes to MDL deadlock detector:
        - Introduced Flush_ticket class a descendant of
          Wait_for_edge class.
        - Added TABLE_SHARE::find_deadlock() method which allows
          deadlock detector to find out what contexts are still
          using old version of table in question (i.e. to find
          out what contexts are waited for by owner of
          Flush_ticket).
      00496b7a
  18. 23 Jul, 2010 3 commits
  19. 20 Jul, 2010 1 commit
    • Davi Arnaut's avatar
      Bug#45288: pb2 returns a lot of compilation warnings on linux · 9a5fa17f
      Davi Arnaut authored
      Fix warnings flagged by the new warning option -Wunused-but-set-variable
      that was added to GCC 4.6 and that is enabled by -Wunused and -Wall. The
      option causes a warning whenever a local variable is assigned to but is
      later unused. It also warns about meaningless pointer dereferences.
      
      client/mysql.cc:
        Meaningless pointer dereferences.
      client/mysql_upgrade.c:
        Check whether reading from the file succeeded.
      extra/comp_err.c:
        Unused.
      extra/yassl/src/yassl_imp.cpp:
        Skip instead of reading data that is discarded.
      include/my_pthread.h:
        Variable is only used in debug builds.
      include/mysys_err.h:
        Add new error messages.
      mysys/errors.c:
        Add new error message for permission related functions.
      mysys/mf_iocache.c:
        Variable is only checked under THREAD.
      mysys/my_copy.c:
        Raise a error if chmod or chown fails.
      mysys/my_redel.c:
        Raise a error if chmod or chown fails.
      regex/engine.c:
        Use a equivalent variable for the assert.
      server-tools/instance-manager/instance_options.cc:
        Unused.
      sql/field.cc:
        Unused.
      sql/item.cc:
        Unused.
      sql/log.cc:
        Do not ignore the return value of freopen: only set buffer if
        reopening succeeds.
        
        Adjust doxygen comment to the right function.
        
        Pass message lenght to log function.
      sql/mysqld.cc:
        Do not ignore the return value of freopen: only set buffer if
        reopening succeeds.
      sql/partition_info.cc:
        Unused.
      sql/slave.cc:
        No need to set pointer to the address of '\0'.
      sql/spatial.cc:
        Unused. Left for historical purposes.
      sql/sql_acl.cc:
        Unused.
      sql/sql_base.cc:
        Pointers are always set to the same variables.
      sql/sql_parse.cc:
        End statement if reading fails.
        
        Store the buffer after it has actually been updated.
      sql/sql_repl.cc:
        No need to set pointer to the address of '\0'.
      sql/sql_show.cc:
        Put variable under the same ifdef block.
      sql/udf_example.c:
        Set null pointer flag appropriately.
      storage/csv/ha_tina.cc:
        Meaningless dereferences.
      storage/example/ha_example.cc:
        Return the error since it's available.
      storage/myisam/mi_locking.c:
        Remove unused and dead code.
      9a5fa17f
  20. 16 Jul, 2010 2 commits
  21. 15 Jul, 2010 1 commit
  22. 12 Jul, 2010 1 commit
    • Alexey Kopytov's avatar
      Bug#55061: Build failing on sol 8 x86 - assembler code vs · e98169d5
      Alexey Kopytov authored
                 compiler problem
      
      GCC-style inline assembly is not supported by the Sun Studio
      compilers prior to version 12.
      
      Added a check for the Sun Studio version to avoid using 
      _FPU_GETCW() / _FPU_SETCW() when inline assembly is
       unsupported. This can lead to some differences in floating
      point calculations on Solaris 8/x86 which, however, is not worth
      bothering with Sun-style assembly .il templates.
      e98169d5
  23. 08 Jul, 2010 1 commit
    • Davi Arnaut's avatar
      Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled · f56dd32b
      Davi Arnaut authored
      Essentially, the problem is that safemalloc is excruciatingly
      slow as it checks all allocated blocks for overrun at each
      memory management primitive, yielding a almost exponential
      slowdown for the memory management functions (malloc, realloc,
      free). The overrun check basically consists of verifying some
      bytes of a block for certain magic keys, which catches some
      simple forms of overrun. Another minor problem is violation
      of aliasing rules and that its own internal list of blocks
      is prone to corruption.
      
      Another issue with safemalloc is rather the maintenance cost
      as the tool has a significant impact on the server code.
      Given the magnitude of memory debuggers available nowadays,
      especially those that are provided with the platform malloc
      implementation, maintenance of a in-house and largely obsolete
      memory debugger becomes a burden that is not worth the effort
      due to its slowness and lack of support for detecting more
      common forms of heap corruption.
      
      Since there are third-party tools that can provide the same
      functionality at a lower or comparable performance cost, the
      solution is to simply remove safemalloc. Third-party tools
      can provide the same functionality at a lower or comparable
      performance cost. 
      
      The removal of safemalloc also allows a simplification of the
      malloc wrappers, removing quite a bit of kludge: redefinition
      of my_malloc, my_free and the removal of the unused second
      argument of my_free. Since free() always check whether the
      supplied pointer is null, redudant checks are also removed.
      
      Also, this patch adds unit testing for my_malloc and moves
      my_realloc implementation into the same file as the other
      memory allocation primitives.
      
      client/mysqldump.c:
        Pass my_free directly as its signature is compatible with the
        callback type -- which wasn't the case for free_table_ent.
      f56dd32b
  24. 02 Jul, 2010 1 commit
    • Davi Arnaut's avatar
      Bug#53445: Build with -Wall and fix warnings that it generates · 0eb26fdf
      Davi Arnaut authored
      Apart strict-aliasing warnings, fix the remaining warnings
      generated by GCC 4.4.4 -Wall and -Wextra flags.
      
      One major source of warnings was the in-house function my_bcmp
      which (unconventionally) took pointers to unsigned characters
      as the byte sequences to be compared. Since my_bcmp and bcmp
      are deprecated functions whose only difference with memcmp is
      the return value, every use of the function is replaced with
      memcmp as the special return value wasn't actually being used
      by any caller.
      
      There were also various other warnings, mostly due to type
      mismatches, missing return values, missing prototypes, dead
      code (unreachable) and ignored return values.
      
      BUILD/SETUP.sh:
        Remove flags that are implied by -Wall and -Wextra.
        Do not warn about unused parameters in C++.
      BUILD/check-cpu:
        Print only the compiler version instead of verbose banner.
        Although the option is gcc specific, the check was only
        being used for GCC specific checks anyway.
      client/mysql.cc:
        bcmp is no longer defined.
      client/mysqltest.cc:
        Pass a string to function expecting a format string.
        Replace use of bcmp with memcmp.
      cmd-line-utils/readline/Makefile.am:
        Always define _GNU_SOURCE when compiling GNU readline.
        Required to make certain prototypes visible.
      cmd-line-utils/readline/input.c:
        Condition for the code to be meaningful.
      configure.in:
        Remove check for bcmp.
      extra/comp_err.c:
        Use appropriate type.
      extra/replace.c:
        Replace use of bcmp with memcmp.
      extra/yassl/src/crypto_wrapper.cpp:
        Do not ignore the return value of fgets. Retrieve the file
        position if fgets succeed -- if it fails, the function will
        bail out and return a error.
      extra/yassl/taocrypt/include/blowfish.hpp:
        Use a single array instead of accessing positions of the sbox_
        through a subscript to pbox_.
      extra/yassl/taocrypt/include/runtime.hpp:
        One definition of such functions is enough.
      extra/yassl/taocrypt/src/aes.cpp:
        Avoid potentially ambiguous conditions.
      extra/yassl/taocrypt/src/algebra.cpp:
        Rename arguments to avoid shadowing related warnings.
      extra/yassl/taocrypt/src/blowfish.cpp:
        Avoid potentially ambiguous conditions.
      extra/yassl/taocrypt/src/integer.cpp:
        Do not define type within a anonymous union.
        Use a variable to return a value instead of
        leaving the result in a register -- compiler
        does not know the logic inside the asm.
      extra/yassl/taocrypt/src/misc.cpp:
        Define handler for pure virtual functions.
        Remove unused code.
      extra/yassl/taocrypt/src/twofish.cpp:
        Avoid potentially ambiguous conditions.
      extra/yassl/testsuite/test.hpp:
        Function must have C language linkage.
      include/m_string.h:
        Remove check which relied on bcmp being defined -- they weren't
        being used as bcmp is only visible when _BSD_SOURCE is defined.
      include/my_bitmap.h:
        Remove bogus helpers which were used only in a few files and
        were causing warnings about dead code.
      include/my_global.h:
        Due to G++ bug, always silence false-positive uninitialized
        variables warnings when compiling C++ code with G++.
        Remove bogus helper.
      libmysql/Makefile.shared:
        Remove built-in implementation of bcmp.
      mysql-test/lib/My/SafeProcess/safe_process.cc:
        Cast pid to largest possible type for a process identifier.
      mysys/mf_loadpath.c:
        Leave space of the ending nul.
      mysys/mf_pack.c:
        Replace bcmp with memcmp.
      mysys/my_bitmap.c:
        Dead code removal.
      mysys/my_gethwaddr.c:
        Remove unused variable.
      mysys/my_getopt.c:
        Silence bogus uninitialized variable warning.
        Do not cast away the constant qualifier.
      mysys/safemalloc.c:
        Cast to expected type.
      mysys/thr_lock.c:
        Silence bogus uninitialized variable warning.
      sql/field.cc:
        Replace bogus helper with a more appropriate logic which is
        used throughout the code.
      sql/item.cc:
        Remove bogus logical condition which always evaluates to TRUE.
      sql/item_create.cc:
        Simplify code to avoid signedness related warnings.
      sql/log_event.cc:
        Replace use of bcmp with memcmp.
        No need to use helpers for simple bit operations.
      sql/log_event_old.cc:
        Replace bmove_align with memcpy.
      sql/mysqld.cc:
        Move use declaration of variable to the ifdef block where it
        is used. Remove now-unnecessary casts and arguments.
      sql/set_var.cc:
        Replace bogus helpers with simple and classic bit operations.
      sql/slave.cc:
        Cast to expected type and silence bogus warning.
      sql/sql_class.h:
        Don't use enum values as bit flags, the supposed type safety is
        bogus as the combined bit flags are not a value in the enumeration.
      sql/udf_example.c:
        Only declare variable when necessary.
      sql/unireg.h:
        Replace use of bmove_align with memcpy.
      storage/innobase/os/os0file.c:
        Silence bogus warning.
      storage/myisam/mi_open.c:
        Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
        char.
      storage/myisam/mi_page.c:
        Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
        char.
      strings/bcmp.c:
        Remove built-in bcmp.
      strings/ctype-ucs2.c:
        Silence bogus warning.
      tests/mysql_client_test.c:
        Use a appropriate type as expected by simple_command().
      0eb26fdf
  25. 01 Jul, 2010 2 commits
    • Jon Olav Hauglid's avatar
      A 5.5 version of the fix for Bug #54360 "Deadlock DROP/ALTER/CREATE · 9ff272fb
      Jon Olav Hauglid authored
      DATABASE with open HANDLER"
      
      Remove LOCK_create_db, database name locks, and use metadata locks instead.
      This exposes CREATE/DROP/ALTER DATABASE statements to the graph-based
      deadlock detector in MDL, and paves the way for a safe, deadlock-free
      implementation of RENAME DATABASE.
      
      Database DDL statements will now take exclusive metadata locks on
      the database name, while table/view/routine DDL statements take
      intention exclusive locks on the database name. This prevents race
      conditions between database DDL and table/view/routine DDL.
      (e.g. DROP DATABASE with concurrent CREATE/ALTER/DROP TABLE)
      
      By adding database name locks, this patch implements
      WL#4450 "DDL locking: CREATE/DROP DATABASE must use database locks" and
      WL#4985 "DDL locking: namespace/hierarchical locks".
      
      The patch also changes code to use init_one_table() where appropriate.
      The new lock_table_names() function requires TABLE_LIST::db_length to
      be set correctly, and this is taken care of by init_one_table().
      
      This patch also adds a simple template to help work with 
      the mysys HASH data structure.
      
      Most of the patch was written by Konstantin Osipov.
      9ff272fb
    • Alexey Kopytov's avatar
      Bug#54667: Unnecessary signal handler redefinition · f3ccf506
      Alexey Kopytov authored
      POSIX requires that a signal handler defined with sigaction()
      is not reset on delivering a signal unless SA_NODEFER or
      SA_RESETHAND is set. It is therefore unnecessary to redefine
      the handler on signal delivery on platforms where sigaction()
      is used without those flags.
      
      include/my_alarm.h:
        Renamed DONT_REMEMBER_SIGNAL ->
        SIGNAL_HANDLER_RESET_ON_DELIVERY.
      include/my_global.h:
        Renamed DONT_REMEMBER_SIGNAL ->
        SIGNAL_HANDLER_RESET_ON_DELIVERY. The latter is now defined
        only on non-BSD platforms missing the POSIX sigaction()
        function.
      libmysql/libmysql.c:
        Renamed DONT_REMEMBER_SIGNAL ->
        SIGNAL_HANDLER_RESET_ON_DELIVERY
      mysys/thr_alarm.c:
        Renamed DONT_REMEMBER_SIGNAL ->
        SIGNAL_HANDLER_RESET_ON_DELIVERY
      sql/mysqld.cc:
        Renamed DONT_REMEMBER_SIGNAL ->
        SIGNAL_HANDLER_RESET_ON_DELIVERY
      f3ccf506
  26. 28 Jun, 2010 1 commit
    • Davi Arnaut's avatar
      Bug#54457: Test suite broken for 32-bit build · 715bac92
      Davi Arnaut authored
      The default value of the myisam_max_extra_sort_file_size could be
      higher than the maximum accepted value, leading to warnings upon
      the server start.
      
      The solution is to simply set the value to the maximum value in a
      32-bit built (2147483647, one less than the current). This should
      be harmless as the option is currently unused in 5.1.
      
      include/myisam.h:
        Remove now-unused macro.
      sql/mysqld.cc:
        Set max value to INT_MAX32.
      715bac92
  27. 17 Jun, 2010 1 commit
    • Magne Mahre's avatar
      WL#5349 Change default storage engine to InnoDB · 32b7e60e
      Magne Mahre authored
      The default storage engine is changed from MyISAM to
      InnoDB, in all builds except for the embedded server.
      
      In addition, the following system variables are 
      changed:
      
        * innodb_file_per_table is enabled
        * innodb_strict_mode is enabled
        * innodb_file_format_name_update is changed
          to 'Barracuda'
      
      The test suite is changed so that tests that do not
      explicitly include the have_innodb.inc are run with
      --default-storage-engine=MyISAM.  This is to ease the
      transition, so that most regression tests are run
      with the same engine as before.
      
      Some tests are disabled for the embedded server
      regression test, as the output of certain statements
      will be different that for the regular server
      (i.e SELECT @@default_storage_engine).  This is to
      ease transition.
      
      
      
      mysql-test/mysql-test-run.pl:
        The regression test suite now adds a
        --default-storage-engine=MyISAM for all non-innodb 
        tests.  This behaviour can be controlled by the
        default-myisam switch in mysql-test-run
      mysql-test/t/bootstrap-master.opt:
        The bootstrap test can only be run without InnoDB
        as it starts several mysqld instances on the same
        datadir. This is possible with MyISAM, but not
        with InnoDB.
      storage/innobase/CMakeLists.txt:
        Build InnoDB per default
      storage/innobase/handler/ha_innodb.cc:
        Change default values for system variables
        
          Enable file_per_table
          Enable strict_mode
          Upgrade default file format to Barracuda
      32b7e60e
  28. 15 Jun, 2010 1 commit
  29. 10 Jun, 2010 1 commit
    • Davi Arnaut's avatar
      Bug#42733: Type-punning warnings when compiling MySQL -- · 6f3a540c
      Davi Arnaut authored
                 strict aliasing violations.
      
      Essentially, the problem is that large parts of the server were
      developed in simpler times (last decades, pre C99 standard) when
      strict aliasing and compilers supporting such optimizations were
      rare to non-existent. Thus, when compiling the server with a modern
      compiler that uses strict aliasing rules to perform optimizations,
      there are several places in the code that might trigger undefined
      behavior.
      
      As evinced by some recent bugs, GCC does a somewhat good of job
      misoptimizing such code, but on the other hand also gives warnings
      about suspicious code. One problem is that the warnings aren't
      always accurate, yet we can't afford to just shut them off as we
      might miss real cases. False-positive cases are aggravated mostly
      by casts that are likely to trigger undefined behavior.
      
      The solution is to start a cleanup process focused on fixing and
      reducing the amount of strict-aliasing related warnings produced
      by GCC and others compilers. A good deal of noise reduction can
      be achieved by just removing useless casts that are product of
      historical cruft and are likely to trigger undefined behavior if
      dereferenced.
      
      client/mysql.cc:
        Remove now-unnecessary casts.
        Break up large strings.
      client/mysql_upgrade.c:
        Remove now-unnecessary casts.
      client/mysqladmin.cc:
        Remove now-unnecessary casts.
        Break up large strings.
      client/mysqlbinlog.cc:
        Remove now-unnecessary casts.
      client/mysqlcheck.c:
        Remove now-unnecessary casts.
      client/mysqldump.c:
        Remove now-unnecessary casts.
      client/mysqlimport.c:
        Remove now-unnecessary casts.
      client/mysqlshow.c:
        Remove now-unnecessary casts.
      client/mysqlslap.c:
        Remove now-unnecessary casts.
      client/mysqltest.cc:
        Remove now-unnecessary casts.
      extra/comp_err.c:
        Remove now-unnecessary casts.
      extra/my_print_defaults.c:
        Remove now-unnecessary casts.
        Break up large strings.
      extra/mysql_waitpid.c:
        Remove now-unnecessary casts.
      extra/perror.c:
        Remove now-unnecessary casts.
      extra/resolve_stack_dump.c:
        Remove now-unnecessary casts.
      extra/resolveip.c:
        Remove now-unnecessary casts.
      include/my_getopt.h:
        Use a void pointer type as the opaque type to avoid problems with type
        incompatibility -- GCC issues warnings when the type name is not type
        compatible with a operand. As a side bonus, a explicit cast won't be
        necessary anymore.
      include/sslopt-longopts.h:
        Remove now-unnecessary casts.
        Break up large strings.
      mysys/my_getopt.c:
        Update opaque type and introduce a type definition for the
        argument to my_getopt_register_get_addr.
      server-tools/instance-manager/options.cc:
        Remove now-unnecessary casts.
      sql/mysqld.cc:
        Remove now-unnecessary casts.
        Break up large strings.
        Update mysql_getopt_value prototype (the old prototype
        was different from the definition anyway).
      sql/sql_plugin.cc:
        The type of a pointer to a function must be compatible with the
        pointed-to function type, otherwise the behavior is undefined.
      sql/table.cc:
        The variable buf pointer to pointer to pointer to constant char
        could improperly alias a incompatible type in call to fix_type_
        pointers. Since this was actually dead code, it is simply removed.
      sql/unireg.cc:
        Remove call to get_form_pos. The code creates a new FRM file which
        is always truncated and writes the form position as 0. Hence, no
        need to retrieve it, we now for sure it is 0.
      storage/archive/archive_reader.c:
        Remove now-unnecessary casts.
      storage/myisam/ft_nlq_search.c:
        Read weight directly from the buffer.
      storage/myisam/fulltext.h:
        Add explanation about the type duality of a key buffer.
        Add accessor macro to retrieve a FT float value.
      storage/myisam/mi_test1.c:
        Remove now-unnecessary casts.
      storage/myisam/myisam_ftdump.c:
        Read weight directly from the buffer.
      storage/myisam/myisamchk.c:
        Remove now-unnecessary casts.
      storage/myisam/myisamlog.c:
        A pointer to char was used to alias a pointer to pointer to
        unsigned char, thus violating strict aliasing rules.
      storage/myisam/myisampack.c:
        Remove now-unnecessary casts.
      strings/decimal.c:
        Remove aliasing violation, printing the value is enough for
        debugging purposes.
      tests/mysql_client_test.c:
        Remove now-unnecessary casts.
      6f3a540c
  30. 07 Jun, 2010 1 commit
    • Mats Kindahl's avatar
      WL#5363: Thread Pool Service Interface · aaf2bdde
      Mats Kindahl authored
      In order to allow thread schedulers to be dynamically loaded,
      it is necessary to make the following changes to the server:
      
      - Two new service interfaces
      
      - Modifications to InnoDB to inform the thread scheduler of state changes.
      
      - Changes to the VIO subsystem for checking if data is available on a socket.
      
      - Elimination of remains of the old thread pool implementation.
      
      The two new service interfaces introduces are:
      
      my_thread_scheduler
        A service interface to register a thread
        scheduler.
      
      thd_wait
        A service interface to inform thread scheduler
        that the thread is about to start waiting.
      
      In addition, the patch adds code that:
      
      - Add a call to thd_wait for table locks in mysys
        thd_lock.c by introducing a set function that
        can be used to set a callback to be used when
        waiting on a lock and resuming from waiting.
      
      - Calling the mysys set function from the server
        to set the callbacks correctly.
      
      aaf2bdde
  31. 04 Jun, 2010 1 commit
    • Georgi Kodinov's avatar
      Bug #52315: utc_date() crashes when system time > year 2037 · 121e0473
      Georgi Kodinov authored
                  
      Some of the server implementations don't support dates later
      than 2038 due to the internal time type being 32 bit.
      Added checks so that the server will refuse dates that cannot
      be handled by either throwing an error when setting date at 
      runtime or by refusing to start or shutting down the server if 
      the system date cannot be stored in my_time_t.
      121e0473
  32. 31 May, 2010 1 commit
    • Davi Arnaut's avatar
      Bug#53445: Build with -Wall and fix warnings that it generates · a8c28805
      Davi Arnaut authored
      Fix various mismatches between function's language linkage. Any
      particular function that is declared in C++ but should be callable
      from C must have C linkage. Note that function types with different
      linkages are also distinct. Thus, if a function type is declared in
      C code, it will have C linkage (same if declared in a extern "C"
      block).
      
      client/mysql.cc:
        Mismatch between prototype and declaration.
      client/mysqltest.cc:
        mysqltest used to be C code. Use C linkage where appropriate.
      cmd-line-utils/readline/input.c:
        Isolate unreachable code.
      include/my_alloc.h:
        Function type must have C linkage.
      include/my_base.h:
        Function type must have C linkage.
      include/my_global.h:
        Add helper macros to avoid spurious namespace indentation.
      include/mysql.h.pp:
        Update ABI file.
      mysys/my_gethwaddr.c:
        Remove stray carriage return and fix coding style.
      plugin/semisync/semisync_master_plugin.cc:
        Callback function types have C linkage.
      plugin/semisync/semisync_slave_plugin.cc:
        Callback function types have C linkage.
      sql/derror.cc:
        Expected function type has C linkage.
      sql/field.cc:
        Use helper macro and fix indentation.
      sql/handler.cc:
        Expected function type has C linkage.
      sql/item_sum.cc:
        Correct function linkages. Remove now unnecessary cast.
      sql/item_sum.h:
        Add prototypes with the appropriate linkage as otherwise they
        are distinct.
      sql/mysqld.cc:
        Wrap functions in C linkage mode.
      sql/opt_range.cc:
        C language linkage is ignored for class member functions.
      sql/partition_info.cc:
        Add wrapper functions with C linkage for class member functions.
      sql/rpl_utility.h:
        Use helper macro and fix indentation.
      sql/sql_class.cc:
        Change type of thd argument -- THD is a class.
        Use helper macro and fix indentation.
      sql/sql_class.h:
        Change type of thd argument -- THD is a class.
      sql/sql_select.cc:
        Expected function type has C linkage.
      sql/sql_select.h:
        Move prototype to sql_test.h
      sql/sql_show.cc:
        Expected function type has C linkage.
      sql/sql_test.cc:
        Fix required function prototype and fix coding style.
      sql/sql_test.h:
        Removed unnecessary export and add another.
      storage/myisammrg/ha_myisammrg.cc:
        Expected function type has C linkage.
      storage/perfschema/pfs.cc:
        PSI headers are declared with C language linkage, which also
        applies to function types.
      a8c28805
  33. 29 May, 2010 1 commit
    • Alexey Kopytov's avatar
      Bug #48537: difference of index selection between rpm binary · f3a83073
      Alexey Kopytov authored
                  and .tar.gz, windows vs linux..
      
      On Intel x86 machines index selection by the MySQL query
      optimizer could sometimes depend on the compiler version and
      optimization flags used to build the server binary.
      
      The problem was a result of a known issue with floating point
      calculations on x86: since internal FPU precision (80 bit)
      differs from precision used by programs (32-bit float or 64-bit
      double), the result of calculating a complex expression may
      depend on how FPU registers are allocated by the compiler and
      whether intermediate values are spilled from FPU to memory. In
      this particular case compiler versions and optimization flags
      had an effect on cost calculation when choosing the best index
      in best_access_path().
      
      A possible solution to this problem which has already been
      implemented in mysql-trunk is to limit FPU internal precision
      to 64 bits. So the fix is a backport of the relevant code to
      5.1 from mysql-trunk.
      
      configure.in:
        Configure check for fpu_control.h
      mysql-test/r/explain.result:
        Test case for bug #48537.
      mysql-test/t/explain.test:
        Test case for bug #48537.
      sql/mysqld.cc:
        Backport of the code to switch FPU on x86 to 64-bit precision.
      f3a83073