1. 16 Jun, 2010 2 commits
  2. 15 Jun, 2010 3 commits
  3. 14 Jun, 2010 1 commit
  4. 11 Jun, 2010 4 commits
    • Konstantin Osipov's avatar
      Fix the cmake rule that builds heap tests, added · 7c634812
      Konstantin Osipov authored
      to cmake build with the patch for WL#5419.
      Add missing libraries.
      7c634812
    • Konstantin Osipov's avatar
      WL#5419 "LOCK_open scalability: make tdc_refresh_version · b1404566
      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.
      b1404566
    • Dmitry Lenev's avatar
      Fix for bug #46785 "main.truncate_coverage fails · 218bf86c
      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.
      218bf86c
    • Jon Olav Hauglid's avatar
      This patch backports test coverage for: · 2b0c42f8
      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.
      2b0c42f8
  5. 10 Jun, 2010 3 commits
    • Alexander Nozdrin's avatar
      Revert a patch for Bug#54334 (Double initialization of mysys mutexes). · b985f884
      Alexander Nozdrin authored
      Revision ID of the patch: marc.alff@oracle.com-20100608124148-lr1ult7lwo75niev
      b985f884
    • Konstantin Osipov's avatar
      A pre-requisite for WL#5419 "LOCK_open scalability: · 41d95c50
      Konstantin Osipov authored
      make tdc_refresh_version an 
      atomic counter".
      Backport the trivial changes from mysql-trunk-iplus.
      41d95c50
    • Konstantin Osipov's avatar
      A pre-requisite patch for WL#5419 "LOCK_open scalability: · df9ab0ff
      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.
      df9ab0ff
  6. 09 Jun, 2010 2 commits
  7. 08 Jun, 2010 4 commits
    • Magne Mahre's avatar
      Bug#20837 Apparent change of isolation level during transaction · 0cb90edf
      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
      0cb90edf
    • Marc Alff's avatar
      Bug#54334 Double initialization of mysys mutexes · ddf6a665
      Marc Alff authored
      Prior to this fix, mysys mutexes such as THR_LOCK_lock could be initialized
      twice by a call to my_init().
      The root cause was out of place initialization in my_basic_init(),
      calling my_thread_global_init().
      
      With this fix,
      - my_basic_init() properly initializes the mutex implementation itself,
      for SAFE or FAST mutexes, and for platform dependent initializations,
      before initialiazing a mutex.
      - my_init() properly initializes mysys mutexes once,
      when making the first call to my_thread_global_init().
      ddf6a665
    • Konstantin Osipov's avatar
      Merge with trunk-runtime. · 85391c90
      Konstantin Osipov authored
      85391c90
    • Konstantin Osipov's avatar
      WL#4441 "LOCK_open: Remove requirement of mutex protecting · 4b6b69d2
      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.
      4b6b69d2
  8. 07 Jun, 2010 6 commits
    • Jon Olav Hauglid's avatar
      Bug #54282 Crash in MDL_context::upgrade_shared_lock_to_exclusive · b5a038a5
      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.
      b5a038a5
    • Konstantin Osipov's avatar
      Backport two small cleanups from trunk-iplus tree: · 51968211
      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.
      51968211
    • Konstantin Osipov's avatar
      Apply: · 666f5544
      Konstantin Osipov authored
      3413 Davi Arnaut	2010-06-03
           Don't enable safemalloc for valgrind builds, it's too slow.
      to trunk-runtime.
      666f5544
    • Dmitry Lenev's avatar
      Follow-up for bug#52289 "performance regression · 83121c6c
      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.
      83121c6c
    • Konstantin Osipov's avatar
      A fix for Bug#52432 "Crash in check_table_is_closed on an · eb752765
      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.
      eb752765
    • Dmitry Lenev's avatar
      Patch that changes approach to how we acquire metadata · 571acc87
      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.
      571acc87
  9. 06 Jun, 2010 1 commit
    • Jon Olav Hauglid's avatar
      manual merge from mysql-trunk-bugfixing · 1af11051
      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
      1af11051
  10. 05 Jun, 2010 1 commit
  11. 03 Jun, 2010 2 commits
    • Konstantin Osipov's avatar
      A follow up for the previous patch, titled: · ec97ce95
      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.
      ec97ce95
    • Konstantin Osipov's avatar
      A code review comment for Bug#52289. · f29298d9
      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.
      f29298d9
  12. 02 Jun, 2010 1 commit
  13. 01 Jun, 2010 3 commits
  14. 31 May, 2010 1 commit
    • Davi Arnaut's avatar
      Bug#53445: Build with -Wall and fix warnings that it generates · 5dec0c96
      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).
      5dec0c96
  15. 04 Jun, 2010 1 commit
  16. 03 Jun, 2010 4 commits
  17. 02 Jun, 2010 1 commit