1. 11 Jun, 2010 4 commits
    • Konstantin Osipov's avatar
      Fix the cmake rule that builds heap tests, added · 5d4082e2
      Konstantin Osipov authored
      to cmake build with the patch for WL#5419.
      Add missing libraries.
      5d4082e2
    • Konstantin Osipov's avatar
      WL#5419 "LOCK_open scalability: make tdc_refresh_version · 33c57e2f
      Konstantin Osipov authored
      an atomic counter"
      
      Split the large LOCK_open section in open_table(). 
      Do not call open_table_from_share() under LOCK_open.
      Remove thd->version.
      
      This fixes
      Bug#50589 "Server hang on a query evaluated using a temporary 
      table"
      Bug#51557 "LOCK_open and kernel_mutex are not happy together"
      Bug#49463 "LOCK_table and innodb are not nice when handler 
      instances are created".
      
      This patch has effect on storage engines that rely on
      ha_open() PSEA method being called under LOCK_open.
      In particular:
      
      1) NDB is broken and left unfixed. NDB relies on LOCK_open
      being kept as part of ha_open(), since it uses auto-discovery.
      While previously the NDB open code was race-prone, now
      it simply fails on asserts.
      
      2) HEAP engine had a race in ha_heap::open() when
      a share for the same table could be added twice
      to the list of shares, or a dangling reference to a share
      stored in HEAP handler. This patch aims to address this
      problem by 'pinning' the newly created share in the 
      internal HEAP engine share list until at least one
      handler instance is created using that share.
      
      
      include/heap.h:
        Add members to HP_CREATE_INFO.
        Declare heap_release_share().
      sql/lock.cc:
        Remove thd->version, use thd->open_tables->s->version instead.
      sql/repl_failsafe.cc:
        Remove thd->version.
      sql/sql_base.cc:
        - close_thread_table(): move handler cleanup code outside the critical section protected by LOCK_open.
        - remove thd->version
        - split the large critical section in open_table() that
        opens a new table from share and is protected by LOCK_open
        into 2 critical sections, thus reducing the critical path.
        - make check_if_table_exists() acquire LOCK_open internally.
        - use thd->open_tables->s->version instead of thd->refresh_version to make sure that all tables in
        thd->open_tables are in the same refresh series.
      sql/sql_base.h:
        Add declaration for check_if_table_exists().
      sql/sql_class.cc:
        Remove init_open_tables_state(), it's now equal to
        reset_open_tables_state().
      sql/sql_class.h:
        Remove thd->version, THD::init_open_tables_state().
      sql/sql_plugin.cc:
        Use table->m_needs_reopen to mark the table as stale
        rather than manipulate with thd->version, which is no more.
      sql/sql_udf.cc:
        Use table->m_needs_reopen to mark the table as stale
        rather than manipulate with thd->version, which is no more.
      sql/table.h:
        Remove an unused variable.
      sql/tztime.cc:
        Use table->m_needs_reopen to mark the table as stale
        rather than manipulate with thd->version, which is no more.
      storage/heap/CMakeLists.txt:
        Add heap tests to cmake build files.
      storage/heap/ha_heap.cc:
        Fix a race when ha_heap::ha_open() could insert two 
        HP_SHARE objects into the internal share list or store
        a dangling reference to a share in ha_heap instance,
        or wrongly set implicit_emptied.
      storage/heap/hp_create.c:
        Optionally pin a newly created share in the list of shares
        by increasing its open_count. This is necessary to 
        make sure that a newly created share doesn't disappear while
        a HP_INFO object is being created to reference it.
      storage/heap/hp_open.c:
        When adding a new HP_INFO object to the list of objects
        in the heap share, make sure the open_count is not increased
        twice.
      storage/heap/hp_test1.c:
        Adjust the test to new function signatures.
      storage/heap/hp_test2.c:
        Adjust the test to new function signatures.
      33c57e2f
    • Dmitry Lenev's avatar
      Fix for bug #46785 "main.truncate_coverage fails · a6cfec17
      Dmitry Lenev authored
      sporadically".
      
      Races in truncate_coverage.test have caused its sporadical 
      failures.
      
      In the test case we have tried to kill truncate statement 
      being executed in the first connection which was waiting 
      for X metadata lock on table being locked by the second
      connection. Since we have released metadata lock held by 
      the second connection right after issuing KILL statement 
      sometimes TRUNCATE TABLE managed to acquire X lock before 
      it has noticed that it was killed. In this case TRUNCATE
      TABLE was successfully executed till its end and this fact
      has caused test failure since this statement didn't return 
      expected error in such case.
      
      This patch addresses the problem by not releasing metadata
      locks in the second connections prematurely.
      a6cfec17
    • Jon Olav Hauglid's avatar
      This patch backports test coverage for: · 262bf59a
      Jon Olav Hauglid authored
      Bug #22909 Using CREATE ... LIKE is possible to create
                 field with invalid default value
      Bug #35935 CREATE TABLE under LOCK TABLES ignores FLUSH
                 TABLES WITH READ LOCK
      Bug #37371 CREATE TABLE LIKE merge loses UNION parameter
      
      These bugs were originally fixed in the 6.1-fk tree and the fixes
      were backported as part of the fix for Bug #42546 "Backup: RESTORE
      fails, thinking it finds an existing table". This patch backports
      test coverage missing in the original backport. The patch contains
      no code changes.
      
      262bf59a
  2. 10 Jun, 2010 2 commits
    • Konstantin Osipov's avatar
      A pre-requisite for WL#5419 "LOCK_open scalability: · 90a87cd5
      Konstantin Osipov authored
      make tdc_refresh_version an 
      atomic counter".
      Backport the trivial changes from mysql-trunk-iplus.
      90a87cd5
    • Konstantin Osipov's avatar
      A pre-requisite patch for WL#5419 "LOCK_open scalability: · 47b9f64c
      Konstantin Osipov authored
      make tdc_refresh_version an atomic counter".
      
      To avoid orphaned TABLE_SHARE objects left in the
      cache, make sure that wherever we set table->s->version
      we take care of removing all unused table share objects
      from the table cache. 
      
      Always set table->s->version under LOCK_open, to make sure
      that no other connection sees an old value of the
      version and adds the table to unused_tables list.
      
      Add an assert to table_def_unuse_table() that we never
      'unuse' a talbe of a share that has an old version.
      
      With this patch, only three places are left in the code
      that manipulate with table->s->version:
      - tdc_remove_table(). In most cases we have an X mdl lock
      in tdc_remove_table(), the two remaining cases when we
      don't are 'FLUSH TABLE' and mysql_admin_table().
      - sql_view.cc - a crude hack that needs a separate fix
      - initial assignment from refresh_version in table.cc.
      
      
      sql/sql_base.cc:
        Add an assert.
        Don't manipulate with table->s->version in auto-repair, auto-discover.
        Use tdc_remove_table() in auto_repair_table() and drop_open_table().
      sql/sql_table.cc:
        Remove dead code from mysql_admin_table().
        Manipulate with table->s->version through the TDC API.
      47b9f64c
  3. 09 Jun, 2010 2 commits
    • Magne Mahre's avatar
      Post-commit fixes after the push for Bug#20837 et. al. · 75d7bb91
      Magne Mahre authored
      
      mysql-test/suite/innodb/r/innodb_information_schema.result:
        The transaction is in REPEATABLE READ, since the
        iso level was changed to SERIALIZABLE only for the 
        previous trx.
      mysql-test/suite/innodb/t/innodb-semi-consistent.test:
        'commit' was missing from the original patch
      mysql-test/t/parser.test:
        Moved the test for Bug#46527 to parser_not_embedded,
        since "disconnect default" isn't allowed with
        the embedded server.
      mysql-test/t/parser_not_embedded.test:
        Moved the test for Bug#46527 to parser_not_embedded,
        since "disconnect default" isn't allowed with
        the embedded server.
      75d7bb91
    • Konstantin Osipov's avatar
      A review comment for WL#4441 " LOCK_open: Remove requirement of · 8d425341
      Konstantin Osipov authored
      mutex protecting thd->open_tables".
      
      We should not manipulate with table->s->version outside the 
      table definition cache code, but use the TDC API
      to achieve the desired result.
      
      Fix one violation: close_all_tables_for_name().
      
      sql/sql_base.cc:
        Use tdc_remove_table(TDC_RT_REMOVE_ALL) to expel the
        table share in close_all_tables_for_name, rather
        than manipulate with the table cache explicitly.
        
        Make sure that close_cached_tables() calls 
        close_all_tables_for_name() after closing all the involved
        handlers. The rest of the code was inspected to
        make sure that mysql_ha_rm_tables() is called.
      sql/sql_handler.cc:
        Add a method to close all HANDLER cursors for a list
        of tables.
      sql/sql_handler.h:
        Add declaration for mysql_ha_flush_tables().
      8d425341
  4. 08 Jun, 2010 3 commits
    • Magne Mahre's avatar
      Bug#20837 Apparent change of isolation level during transaction · db716d11
      Magne Mahre authored
      Bug#46527 COMMIT AND CHAIN RELEASE does not make sense
      Bug#53343 completion_type=1, COMMIT/ROLLBACK AND CHAIN don't 
                preserve the isolation level
      Bug#53346 completion_type has strange effect in a stored 
                procedure/prepared statement
      
      Added test cases to verify the expected behaviour of :
       SET SESSION TRANSACTION ISOLATION LEVEL, 
       SET TRANSACTION ISOLATION LEVEL,
       @@completion_type,
       COMMIT AND CHAIN,
       ROLLBACK AND CHAIN
       ..and some combinations of the above
      
      db716d11
    • Konstantin Osipov's avatar
      Merge with trunk-runtime. · da8c33ba
      Konstantin Osipov authored
      da8c33ba
    • Konstantin Osipov's avatar
      WL#4441 "LOCK_open: Remove requirement of mutex protecting · d4f1abaa
      Konstantin Osipov authored
      thd->open_tables"
      
      thd->open_tables list is not normally accessed concurrently
      except for one case: when the connection has open SQL
      HANDLER tables, and we want to perform a DDL on the table,
      we want to abort waits on MyISAM thr_lock of those connections
      that prevent the DDL from proceeding, and iterate
      over thd->open_tables list to find out the tables on which
      the thread is waiting.
      
      In 5.5 we mostly use deadlock detection and soft deadlock 
      prevention, as opposed to "hard" deadlock prevention
      of 5.1, which would abort any transaction that
      may cause a deadlock. The only remaining case when
      neither deadlock detection nor deadlock prevention
      is implemented in 5.5 is HANDLER SQL, where we use
      old good thr_lock_abort() technique form 5.1. 
      
      Thus, replace use of LOCK_open to protect thd->open_tables
      with thd->LOCK_ha_data (a lock protecting various session
      private data).
      
      This is a port of the work done for 5.5.4 for review
      and inclusion into 5.5.5.
      
      sql/sql_base.cc:
        Use thd->LOCK_ha_data (systematically) to set
        thd->open_tables.
      sql/sql_class.h:
        Implement THD::set_open_tables().
      sql/sql_cursor.cc:
        Use thd->LOCK_ha_data (systematically) to set
        thd->open_tables.
      sql/sql_handler.cc:
        Use thd->LOCK_ha_data (systematically) to set
        thd->open_tables.
        Acquisition of LOCK_open is moved inside close_thread_table().
      sql/sql_table.cc:
        Acquisition of LOCK_open is moved inside close_thread_tables().
      d4f1abaa
  5. 07 Jun, 2010 6 commits
    • Jon Olav Hauglid's avatar
      Bug #54282 Crash in MDL_context::upgrade_shared_lock_to_exclusive · 4ea99a50
      Jon Olav Hauglid authored
      This crash happened if a table was listed twice in a DROP TABLE statement,
      and the statement was executed while in LOCK TABLES mode. Since the two
      elements of table list were identical, they were assigned the same TABLE object. 
      During processing of the first table element, the TABLE instance was destroyed
      and the second table list element was left with a dangling reference.
      When this reference was later accessed, the server crashed.
      
      Listing the same table twice in DROP TABLES should give an ER_NONUNIQ_TABLE
      error. However, this did not happen as the check for unique table names was 
      skipped due to the lock type for table list elements being set to TL_IGNORE.
      Previously TL_UNLOCK was used and the unique check was performed.
      
      This bug was a regression introduced by a pre-requisite patch for
      Bug#51263 "Deadlock between transactional SELECT and ALTER TABLE ...
      REBUILD PARTITION". The regression only existed in an internal team
      tree and never in any released code.
      
      This patch reverts DROP TABLE (and DROP VIEW) to the old behavior of
      using TL_UNLOCK locks. Test case added to drop.test.
      4ea99a50
    • Konstantin Osipov's avatar
      Backport two small cleanups from trunk-iplus tree: · 29f9fb7a
      Konstantin Osipov authored
          
      1) No mutex and no function call if we're not using
      plugins.
      2) If we're above the table definition cache limit,
      delete the oldest unused share, not the share on our hands.
      
      sql/sql_base.cc:
        If we're above the table definition cache limit,
        delete the oldest unused share, not the share on our hands.
      sql/sql_lex.cc:
        No mutex and no function call if we're not using
        plugins.
      29f9fb7a
    • Konstantin Osipov's avatar
      Apply: · 69f8e588
      Konstantin Osipov authored
      3413 Davi Arnaut	2010-06-03
           Don't enable safemalloc for valgrind builds, it's too slow.
      to trunk-runtime.
      69f8e588
    • Dmitry Lenev's avatar
      Follow-up for bug#52289 "performance regression · 1398a1a9
      Dmitry Lenev authored
      for MyISAM in sysbench OLTP_RW test".
      
      Fixes compilation warnings about local variable
      shadowing I_P_List_fast_push_back::last member.
      
      Renamed I_P_List_fast_push_back::last member
      to m_last. Also to keep member naming consistent
      renamed I_P_List::first member to m_first.
      1398a1a9
    • Konstantin Osipov's avatar
      A fix for Bug#52432 "Crash in check_table_is_closed on an · cc90cbbe
      Konstantin Osipov authored
      information_schema query.
      Porting a fix done for a feature tree by Ingo Struewing.
      No test case since the crash only occurs under a stress
      load.
      
      storage/myisam/mi_dbug.c:
        Iterate over the list of MyISAM shares and access the MyISAM 
        share internals under a lock.
      cc90cbbe
    • Dmitry Lenev's avatar
      Patch that changes approach to how we acquire metadata · 9dbd9ce1
      Dmitry Lenev authored
      locks for DML statements and changes the way MDL locks
      are acquired/granted in contended case.
      
      Instead of backing-off when a lock conflict is encountered
      and waiting for it to go away before restarting open_tables()
      process we now wait for lock to be released without releasing
      any previously acquired locks. If conflicting lock goes away
      we resume opening tables. If waiting leads to a deadlock we
      try to resolve it by backing-off and restarting open_tables()
      immediately.
      
      As result both waiting for possibility to acquire and
      acquiring of a metadata lock now always happen within the
      same MDL API call. This has allowed to make release of a lock
      and granting it to the most appropriate pending request an
      atomic operation.
      Thanks to this it became possible to wake up during release
      of lock only those waiters which requests can be satisfied
      at the moment as well as wake up only one waiter in case
      when granting its request would prevent all other requests
      from being satisfied. This solves thundering herd problem
      which occured in cases when we were releasing some lock and
      woke up many waiters for SNRW or X locks (this was the issue
      in bug#52289 "performance regression for MyISAM in sysbench
      OLTP_RW test".
      This also allowed to implement more fair (FIFO) scheduling
      among waiters with the same priority.
      It also opens the door for introducing new types of requests
      for metadata locks such as low-prio SNRW lock which is
      necessary in order to support LOCK TABLES LOW_PRIORITY WRITE.
      
      Notice that after this sometimes can report ER_LOCK_DEADLOCK
      error in cases in which it has not happened before.
      Particularly we will always report this error if waiting for
      conflicting lock has happened in the middle of transaction
      and resulted in a deadlock. Before this patch the error was
      not reported if deadlock could have been resolved by backing
      off all metadata locks acquired by the current statement.
      
      mysql-test/r/mdl_sync.result:
        Added test coverage for some aspects of deadlock handling in
        metadata locking subsystem.
        Adjusted test case after removing back-off in general case
        when conflicting metadata lock is encountered during
        open_tables() (now this happens only if waiting for
        conflicting lock to go away leads to a deadlock).
      mysql-test/r/sp_sync.result:
        Adjusted test case after removing back-off in general case
        when conflicting metadata lock is encountered during
        open_tables() (now this happens only if waiting for
        conflicting lock to go away leads to a deadlock).
      mysql-test/suite/perfschema/r/dml_setup_instruments.result:
        Adjusted test results after renaming MDL_context::
        m_waiting_for_lock rwlock to m_LOCK_waiting_for.
      mysql-test/suite/rpl/r/rpl_sp.result:
        Adjusted test case after implementing new approach to
        acquiring metadata locks in open_tables(). We no longer
        release all MDL locks acquired by statement before waiting
        for conflicting lock to go away. As result DROP FUNCTION
        statement has to wait for DML statement which managed to
        acquire metadata lock on function being dropped and now
        waits for other conflicting metadata lock to go away.
      mysql-test/suite/rpl/t/rpl_sp.test:
        Adjusted test case after implementing new approach to
        acquiring metadata locks in open_tables(). We no longer
        release all MDL locks acquired by statement before waiting
        for conflicting lock to go away. As result DROP FUNCTION
        statement has to wait for DML statement which managed to
        acquire metadata lock on function being dropped and now
        waits for other conflicting metadata lock to go away.
      mysql-test/t/mdl_sync.test:
        Added test coverage for some aspects of deadlock handling in
        metadata locking subsystem.
        Adjusted test case after removing back-off in general case
        when conflicting metadata lock is encountered during
        open_tables() (now this happens only if waiting for
        conflicting lock to go away leads to a deadlock).
      mysql-test/t/sp_sync.test:
        Adjusted test case after removing back-off in general case
        when conflicting metadata lock is encountered during
        open_tables() (now this happens only if waiting for
        conflicting lock to go away leads to a deadlock).
      sql/mdl.cc:
        Changed MDL subsystem to support new approach to acquring
        metadata locks in open tables and more fair and efficient
        scheduling of metadata locks. To implement this:
        - Made releasing of the lock and granting it to the most
          appropriate pending request atomic operation. As result it
          became possible to wake up only those waiters requests from
          which can be satisfied at the moment as well as wake-up
          only one waiter in case when granting its request would
          prevent all other requests from being satisfied.
          This solved thundering herd problem which occured in cases
          when we were releasing some lock and woke up many waiters
          for SNRW or X locks (this was the issue in Bug #52289
          "performance regression for MyISAM in sysbench OLTP_RW
          test".
          To emphasize above changes wake_up_waiters() was renamed
          to MDL_context::reschedule_waiters().
        - Changed code to add tickets for new requests to the back of
          waiters queue and to select tickets to be satisfied from
          the head of the queue if possible (this makes scheduling of
          requests with the same priority fair). To be able to do
          this efficiently we now use for waiting and granted queues
          version of I_P_List class which provides fast push_back()
          method.
        - Members and methods of MDL_context related to sending
          and waiting for signal were moved to separate MDL_wait
          class.
        - Since in order to avoid race conditions we must grant the
          lock only to the context which was not chosen as a victim
          of deadlock, killed or aborted due to timeout
          MDL_wait::set_status() (former awake()) was changed not to
          send signal if signal slot is already occupied and to
          indicate this fact through its return value. As another
          consequence MDL_wait::timed_wait() method was changed to
          handle timeout (optionally) and abort due to kill as
          signals which make signal slot occupied.
        - Renamed MDL_context::acquire_lock_impl() to acquire_lock().
          Changed it to be able correctly process requests for shared
          locks when there are open HANDLERs, made this method more
          optimized for acquisition of shared locks. As part of this
          change moved code common between try_acquire_lock() and
          acquire_lock() to new try_acquire_lock_impl() method.
          Also adjusted acquire_lock()'s code to take into account
          the fact that in cases when lock is granted as result of
          MDL_context::reschedule_waiters() call (i.e. when it is
          granted after waiting for lock conflict to go away)
          updating MDL_lock state is responsibility of the thread
          calling reschedule_waiters().
        - Changed MDL_context::find_deadlock() to send VICTIM
          signal even if victim is the context which has initiated
          deadlock detection. This is required in order to avoid
          races in cases when the same context simultaneously is
          chosen as a victim and its request for lock is satisfied.
          As result return value of this method became unnecessary
          and it was changed to return void.
          Adjusted MDL_lock::find_deadlock() method to take into
          account that now there can be a discrepancy between
          MDL_context::m_waiting_for value being set and real state
          of the ticket this member points to.
        - Renamed MDL_context::m_waiting_for_lock to m_LOCK_waiting_for
          and MDL_context::stop_waiting() to done_waiting_for().
        - Finally, removed MDL_context::wait_for_lock() method.
      sql/mdl.h:
        Changed MDL subsystem to support new approach to acquring
        metadata locks in open tables and more fair and efficient
        scheduling of metadata locks. To implement this:
        - Members and methods of MDL_context related to sending
          and waiting for signal were moved to separate MDL_wait
          class.
        - Since now in order to avoid race conditions we must grant
          the lock only to the context which was not chosen as a
          victim of deadlock, killed or aborted due to timeout
          MDL_wait::set_status (former awake()) was changed not to
          send signal if signal slot is already occupied and to
          indicate this fact through its return value.
          Also NORMAL_WAKE_UP signal became GRANTED, and timeouts
          and aborts due to kill became full blown signals rather
          than simple return values.
        - MDL_wait::timed_wait() now takes extra parameter that
          indicates whether signal should be set if timeout is
          reached.
        - Enabled fast push_back() operation in MDL_context::m_tickets
          list to make move_ticket_after_trans_sentinel() method more
          efficient.
        - Removed MDL_context::wait_for_lock() method.
        - Renamed MDL_context::m_waiting_for_lock to m_LOCK_waiting_for
          and MDL_context::stop_waiting() to done_waiting_for().
        - MDL_context::acquire_lock_impl() became acquire_lock().
        - Introduced MDL_context::try_acquire_lock_impl() as a
          place for code shared by try_acquire_lock and
          acquire_lock().
        - Due to fact that now VICTIM signal is sent even if victim
          is the context which has initiated deadlock detection
          find_deadlock() no longer needs a return value.
      sql/sql_base.cc:
        Implemented new approach to acquiring metadata locks in
        open_tables(). We no longer perform back-off when conflicting
        metadata lock is encountered. Instead we wait for this lock
        to go away while holding all locks which were acquired so
        far. Back-off is only used in situation when further waiting
        will cause a deadlock which could be avoided by performing
        back-off and restarting open_tables() process. Absence of
        waiting between back-off and restart of acquiring metadata
        locks can't lead to livelocks as MDL subsystem was changed
        to make release of lock and granting it to waiting lock
        an atomic action, so back-off will automatically give way
        to other participants of deadlock loop.
        Accordingly:
        - open_table_get_mdl_lock() and open_and_process_routine()
          were changed to wait for conflicting metadata lock to
          go away without back-off. Only if such wait leads to a
          deadlock back-off is requested. As part of this change
          new error handler class was introduced which converts,
          if possible, ER_LOCK_DEADLOCK error to a request for
          back-off and re-start of open_tables() process.
        - Open_table_context::recover_from_failed_open() was changed
          not to wait in case of metadata lock conflict. Instead we
          immediately proceed to re-acquiring locks.
        - Open_table_context::request_backoff_action() now always
          emits error if back-off is requested in the middle of
          transaction as we can't be sure that releasing lock
          which were acquired only by current statement will
          resolve a deadlock. Before this patch such situations were
          successfully detected thanks to the fact that we called
          MDL_context::wait_for_lock() method in
          recover_from_failed_open().
        - In order to avoid deadlocks open_tables() code was adjusted
          to flush open HANDLERs for which there are pending requests
          for X locks before restarting the process of acquiring
          metadata locks.
        - Changed close_tables_for_reopen() not to reset MDL_request
          for tables belonging to the tail of prelocking list. It is
          no longer necessary as these MDL_request objects won't be
          used for any waiting.
        - Adjusted comment in tdc_wait_for_old_version() to avoid
          mentioning removed MDL_context::wait_for_lock() method.
      sql/sql_base.h:
        As we no longer wait for conflicting metadata lock away in
        Open_table_context::recover_from_failed_open() method,
        Open_table_context::OT_WAIT_MDL_LOCK action was renamed to
        OT_MDL_CONFLICT.
        Also Open_table_context::m_failed_mdl_request became
        unnecessary and was removed.
      sql/sql_plist.h:
        Extended I_P_List template to support efficient push_back()
        operation if it is parameterized with an appropriate policy
        class.
      sql/sql_show.cc:
        Adjusted code after removal of MDL_context::wait_for_lock()
        method. Now if one needs to acquire metadata lock with waiting
        one has to use a variant of MDL_context::acquire_lock() method.
      9dbd9ce1
  6. 06 Jun, 2010 1 commit
    • Jon Olav Hauglid's avatar
      manual merge from mysql-trunk-bugfixing · 142a162c
      Jon Olav Hauglid authored
      Conflicts:
      Text conflict in mysql-test/r/archive.result
      Contents conflict in mysql-test/r/innodb_bug38231.result
      Text conflict in mysql-test/r/mdl_sync.result
      Text conflict in mysql-test/suite/binlog/t/disabled.def
      Text conflict in mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result
      Text conflict in mysql-test/t/archive.test
      Contents conflict in mysql-test/t/innodb_bug38231.test
      Text conflict in mysql-test/t/mdl_sync.test
      Text conflict in sql/sp_head.cc
      Text conflict in sql/sql_show.cc
      Text conflict in sql/table.cc
      Text conflict in sql/table.h
      142a162c
  7. 05 Jun, 2010 1 commit
  8. 03 Jun, 2010 2 commits
    • Konstantin Osipov's avatar
      A follow up for the previous patch, titled: · cbf4019a
      Konstantin Osipov authored
      A code review comment for Bug#52289.
      Encapsulate the deadlock detection functionality into
      a visitor class...
      
      Remove a race introduced by omission: 
      initialize iterators under a read lock on the object.
      
      sql/mdl.cc:
        Initialize iterators under a read lock on the object.
      cbf4019a
    • Konstantin Osipov's avatar
      A code review comment for Bug#52289. · e7854c86
      Konstantin Osipov authored
      Encapsulate the deadlock detection functionality into 
      a visitor class, and separate it from the wait-for graph
      traversal code.
      
      Use "Internal iterator" and "Visitor" patterns to 
      achieve the desired separation of responsibilities.
      
      Add comments.
      
      sql/mdl.cc:
        Encapsulate deadlock detection into a class.
      sql/mdl.h:
        Adjust for a rename of a class.
      e7854c86
  9. 02 Jun, 2010 1 commit
  10. 01 Jun, 2010 3 commits
    • Konstantin Osipov's avatar
      A follow up patch for the fix for Bug#51263 "Deadlock between · 5fa66315
      Konstantin Osipov authored
      transactional SELECT and ALTER TABLE ...  REBUILD PARTITION".
      
      Make open flags part of Open_table_context.
      This allows to simplify some code and (in future)
      enforce the invariant that we don't, say, request a back 
      off on the table when there is MYSQL_OPEN_IGNORE_FLUSH 
      flag.
      
      
      
      sql/sql_base.cc:
        open_table() flags are part of Open_table_context.
        Remove dead code that would check for OPEN_VIEW_NO_PARSE,
        which is not an open table flag.
      sql/sql_base.h:
        Move flags to Open_table_context. Reorder Open_table_context
        members to compact the structure footprint.
      sql/sql_insert.cc:
        Update with a new calling signature of open_table().
      sql/sql_table.cc:
        Update with a new calling signature of open_table().
      5fa66315
    • Konstantin Osipov's avatar
      A follow up patch for the fix for Bug#51263 "Deadlock between · a96d23a5
      Konstantin Osipov authored
       transactional SELECT and ALTER TABLE ...  REBUILD PARTITION".
      
      Move declarations of sql_base.cc classes to sql_base.h
      (previously declared in sql_class.h).
      Became possible after a header file split.
      
      
      
      
      
      sql/sql_base.cc:
        Make sql_base.h the first include in sql_base.cc.
      sql/sql_base.h:
        Add declarations of Prelocking_strategy and Open_table_context.
      sql/sql_class.h:
        Remove declarations of Prelocking_strategy and Open_table_context
        (moved).
      a96d23a5
    • Konstantin Osipov's avatar
      A follow up patch for the fix for Bug#51263 "Deadlock between · b9aa51e2
      Konstantin Osipov authored
      transactional SELECT and ALTER TABLE ...  REBUILD PARTITION".
      
      Remove unused code - TL_WRITE_ALLOW_READ thr_lock.c lock.
      
      
      
      
      
      
      include/thr_lock.h:
        Remove TL_WRITE_ALLOW_READ.
      mysys/CMakeLists.txt:
        Add thr_lock test to the list of CMake executables to build.
      mysys/thr_lock.c:
        Remove TL_WRITE_ALLOW_READ thr_lock.c lock.
        Consequently, simplify lock compatibility rules.
        Remove unused code.
      sql/sql_test.cc:
        Remove TL_WRITE_ALLOW_READ lock.
      b9aa51e2
  11. 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
  12. 04 Jun, 2010 1 commit
  13. 03 Jun, 2010 4 commits
  14. 02 Jun, 2010 9 commits
    • He Zhenxing's avatar
      Auto merge · fa71264e
      He Zhenxing authored
      fa71264e
    • He Zhenxing's avatar
      Auto merge from 5.1-rep-semisync · c5425944
      He Zhenxing authored
      c5425944
    • Vasil Dimov's avatar
    • Vasil Dimov's avatar
      ee07d639
    • Alexander Barkov's avatar
      Bug#52520 Difference in tinytext utf column metadata · eed26e92
      Alexander Barkov authored
            Problems:
            - regression (compating to version 5.1) in metadata for BLOB types
            - inconsistency between length metadata in server and embedded for BLOB types
            - wrong max_length calculation in items derived from BLOB columns
           @ libmysqld/lib_sql.cc
              Calculating length metadata in embedded similary to server version,
              using new function char_to_byte_length_safe().
           @ mysql-test/r/ctype_utf16.result
              Adding tests
           @ mysql-test/r/ctype_utf32.result
              Adding tests
           @ mysql-test/r/ctype_utf8.result
              Adding tests
           @ mysql-test/r/ctype_utf8mb4.result
              Adding tests
           @ mysql-test/t/ctype_utf16.test
              Adding tests
           @ mysql-test/t/ctype_utf32.test
              Adding tests
           @ mysql-test/t/ctype_utf8.test
              Adding tests
           @ mysql-test/t/ctype_utf8mb4.test
              Adding tests
           @ sql/field.cc
              Overriding char_length() for Field_blob:
              unlike in generic Item::char_length() we don't
              divide to mbmaxlen for BLOBs.
           @ sql/field.h
              - Making Field::char_length() virtual
              - Adding prototype for Field_blob::char_length()
           @ sql/item.h
              - Adding new helper function char_to_byte_length_safe()
              - Using new function
           @ sql/protocol.cc
              Using new function char_to_byte_length_safe().
      
          modified:
            libmysqld/lib_sql.cc
            mysql-test/r/ctype_utf16.result
            mysql-test/r/ctype_utf32.result
            mysql-test/r/ctype_utf8.result
            mysql-test/r/ctype_utf8mb4.result
            mysql-test/t/ctype_utf16.test
            mysql-test/t/ctype_utf32.test
            mysql-test/t/ctype_utf8.test
            mysql-test/t/ctype_utf8mb4.test
            sql/field.cc
            sql/field.h
            sql/item.h
            sql/protocol.cc
      eed26e92
    • Vasil Dimov's avatar
      Fix the failing innodb.innodb test: · 4c1fe7eb
      Vasil Dimov authored
        innodb.innodb                            [ fail ]
                Test ended at 2010-06-02 15:04:06
        
        CURRENT_TEST: innodb.innodb
        --- /usr/w/mysql-trunk-innodb/mysql-test/suite/innodb/r/innodb.result	2010-05-23 23:10:26.576407000 +0300
        +++ /usr/w/mysql-trunk-innodb/mysql-test/suite/innodb/r/innodb.reject	2010-06-02 15:04:05.000000000 +0300
        @@ -2648,7 +2648,7 @@
         create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb;
         insert into t1 values (0x41),(0x4120),(0x4100);
         insert into t2 values (0x41),(0x4120),(0x4100);
        -ERROR 23000: Duplicate entry 'A\x00' for key 'PRIMARY'
        +ERROR 23000: Duplicate entry 'A' for key 'PRIMARY'
         insert into t2 values (0x41),(0x4120);
      
      The change in the printout was introduced in:
      
        ------------------------------------------------------------
        revno: 3008.6.2
        revision-id: sergey.glukhov@sun.com-20100527160143-57nas8nplzpj26dz
        parent: sergey.glukhov@sun.com-20100527155443-24vqi9o8rpnkyci7
        committer: Sergey Glukhov <Sergey.Glukhov@sun.com>
        branch nick: mysql-trunk-bugfixing
        timestamp: Thu 2010-05-27 20:01:43 +0400
        message:
          Bug#52430 Incorrect key in the error message for duplicate key error involving BINARY type
          For BINARY(N) strip trailing zeroes to make the error message nice-looking
        
         @ mysql-test/r/errors.result
            test case
        
         @ mysql-test/r/type_binary.result
            result fix
        
         @ mysql-test/t/errors.test
            test case
        
         @ sql/key.cc
            For BINARY(N) strip trailing zeroes to make the error message nice-looking
      
      and its author (Sergey) did not notice the test failure because that test
      has been disabled in his tree.
      4c1fe7eb
    • Marko Mäkelä's avatar
      eaf7013d
    • Marko Mäkelä's avatar
      Merge from mysql-5.1-innodb: · a2b95321
      Marko Mäkelä authored
      ------------------------------------------------------------
      revno: 3495
      committer: Marko Mäkelä <marko.makela@oracle.com>
      branch nick: 5.1-innodb
      timestamp: Wed 2010-06-02 13:37:14 +0300
      message:
        Bug#53674: InnoDB: Error: unlock row could not find a 4 mode lock on the record
      
        In semi-consistent read, only unlock freshly locked non-matching records.
      
        lock_rec_lock_fast(): Return LOCK_REC_SUCCESS,
        LOCK_REC_SUCCESS_CREATED, or LOCK_REC_FAIL instead of TRUE/FALSE.
      
        enum db_err: Add DB_SUCCESS_LOCKED_REC for indicating a successful
        operation where a record lock was created.
      
        lock_sec_rec_read_check_and_lock(),
        lock_clust_rec_read_check_and_lock(), lock_rec_enqueue_waiting(),
        lock_rec_lock_slow(), lock_rec_lock(), row_ins_set_shared_rec_lock(),
        row_ins_set_exclusive_rec_lock(), sel_set_rec_lock(),
        row_sel_get_clust_rec_for_mysql(): Return DB_SUCCESS_LOCKED_REC if a
        new record lock was created. Adjust callers.
      
        row_unlock_for_mysql(): Correct the function documentation.
      
        row_prebuilt_t::new_rec_locks: Correct the documentation.
      a2b95321
    • Marko Mäkelä's avatar
      Merge from mysql-5.1-innodb: · 8f5d78c2
      Marko Mäkelä authored
      ------------------------------------------------------------
      revno: 3493
      revision-id: marko.makela@oracle.com-20100602101940-60x32xiivtqj9va1
      parent: marko.makela@oracle.com-20100601135802-hgplcpr8089ura8g
      committer: Marko Mäkelä <marko.makela@oracle.com>
      branch nick: 5.1-innodb
      timestamp: Wed 2010-06-02 13:19:40 +0300
      message:
        fil_print_orphaned_tablespaces(): Unused function, remove.
      8f5d78c2