1. 12 Feb, 2010 1 commit
    • Dmitry Lenev's avatar
      Fix for bug #50908 "Assertion `handler_tables_hash.records == 0' · 0ec868ca
      Dmitry Lenev authored
      failed in enter_locked_tables_mode".
      
      Server was aborted due to assertion failure when one tried to 
      execute statement requiring prelocking (i.e. firing triggers
      or using stored functions) while having open HANDLERs.
      
      The problem was that THD::enter_locked_tables_mode() method
      which was called at the beginning of execution of prelocked 
      statement assumed there are no open HANDLERs. It had to do 
      so because corresponding THD::leave_locked_tables_mode()
      method was unable to properly restore MDL sentinel when
      leaving LOCK TABLES/prelocked mode in the presence of open 
      HANDLERs.
      
      This patch solves this problem by changing the latter method
      to properly restore MDL sentinel and thus removing need for 
      this assumption. As a side-effect, it lifts unjustified
      limitation by allowing to keep HANDLERs open when entering 
      LOCK TABLES mode.
      0ec868ca
  2. 11 Feb, 2010 5 commits
    • Konstantin Osipov's avatar
      next-4284 tree: · bca1fec8
      Konstantin Osipov authored
      fix lock_sync.test failure in row based replication mode.
      bca1fec8
    • Konstantin Osipov's avatar
      Fix a sporadic failure of rpl_sp.test in next-4284 tree: when doing · 8bd1e19d
      Konstantin Osipov authored
      SELECT * FROM t1 on slave, first make sure that the slave has received
      the CREATE TABLE from the master.
      8bd1e19d
    • Konstantin Osipov's avatar
      next-4284 tree: fix the failures of processlist_val_* tests, · 08df87e4
      Konstantin Osipov authored
      update the condition to wait for in wait_condition
      to reflect type-of-operation aware metadata locks.
      08df87e4
    • Jon Olav Hauglid's avatar
      Followup to Bug#34604 handler::ha_rnd_end(): Assertion `inited==RND' failed. · affdd533
      Jon Olav Hauglid authored
      The test case for this bug relies on getting a ER_LOCK_WAIT_TIMEOUT
      error. However with the introduction of MDL, the test would hang
      forever since the metadata locks would not timeout.
      
      MDL timeouts are now introduced in the scope of Bug#45225. This
      patch changes the testcase for Bug#34604 to set the new server
      variable "lock_wait_timeout" to one second which makes the test
      generate the necessary timeout again.
      affdd533
    • Jon Olav Hauglid's avatar
      Bug #45225 Locking: hang if drop table with no timeout · 5bb67f34
      Jon Olav Hauglid authored
      This patch introduces timeouts for metadata locks. 
      
      The timeout is specified in seconds using the new dynamic system 
      variable  "lock_wait_timeout" which has both GLOBAL and SESSION
      scopes. Allowed values range from 1 to 31536000 seconds (= 1 year). 
      The default value is 1 year.
      
      The new server parameter "lock-wait-timeout" can be used to set
      the default value parameter upon server startup.
      
      "lock_wait_timeout" applies to all statements that use metadata locks.
      These include DML and DDL operations on tables, views, stored procedures
      and stored functions. They also include LOCK TABLES, FLUSH TABLES WITH
      READ LOCK and HANDLER statements.
      
      The patch also changes thr_lock.c code (table data locks used by MyISAM
      and other simplistic engines) to use the same system variable.
      InnoDB row locks are unaffected.
      
      One exception to the handling of the "lock_wait_timeout" variable
      is delayed inserts. All delayed inserts are executed with a timeout
      of 1 year regardless of the setting for the global variable. As the
      connection issuing the delayed insert gets no notification of 
      delayed insert timeouts, we want to avoid unnecessary timeouts.
      
      It's important to note that the timeout value is used for each lock
      acquired and that one statement can take more than one lock.
      A statement can therefore block for longer than the lock_wait_timeout 
      value before reporting a timeout error. When lock timeout occurs, 
      ER_LOCK_WAIT_TIMEOUT is reported.
      
      Test case added to lock_multi.test.
      5bb67f34
  3. 10 Feb, 2010 2 commits
    • Alexander Nozdrin's avatar
      Update result file. · 65808c91
      Alexander Nozdrin authored
      65808c91
    • Dmitry Lenev's avatar
      Fix for bug #50998 "Deadlock in MDL code during test · f229ac07
      Dmitry Lenev authored
      rqg_mdl_stability".
      
      When start of statement's waiting on a metadata lock 
      created more than one loop in waiters graph server might 
      have entered deadlock condition.
      
      The problem was that in the case described above MDL deadlock 
      detector had to perform several searches for deadlock but
      forgot to reset Deadlock_detection_context before performing 
      new search. 
      Failure to do so has broken assumption in code resposible for 
      choosing victim that if Deadlock_detection_context::victim
      is set we also have read lock on m_waiting_for_lock for this
      context. As result this lock could have been unlocked more
      times than it was acquired which corrupted rwlock's state
      which led to server deadlock.
      
      This fix ensures that such reset is done before each attempt
      to find a deadlock.
      f229ac07
  4. 09 Feb, 2010 5 commits
  5. 08 Feb, 2010 4 commits
    • Joerg Bruehe's avatar
      Upmerge "configure.in" text change from 5.1 to 5.5 ("trunk"), · fc5e9a4a
      Joerg Bruehe authored
      fixing bug#50950.
      fc5e9a4a
    • Joerg Bruehe's avatar
      Upmerge "configure.in" text change from 5.0 to 5.1, · f6df1770
      Joerg Bruehe authored
      fixing bug#50950.
      f6df1770
    • Dmitry Lenev's avatar
      Fix for bug #50913 "Deadlock between open_and_lock_tables_derived · c7e7a7d2
      Dmitry Lenev authored
      and MDL".
      
      Concurrent execution of a multi-DELETE statement and ALTER
      TABLE statement which affected one of the tables used in
      the multi-DELETE sometimes led to deadlock.
      Similar deadlocks might have occured when one performed
      INSERT/UPDATE/DELETE on a view and concurrently executed
      ALTER TABLE for the view's underlying table, or when one
      concurrently executed TRUNCATE TABLE for InnoDB table and
      ALTER TABLE for the same table.
      
      These deadlocks were caused by a discrepancy between types of
      metadata and thr_lock.cc locks acquired by those statements.
      
      What happened was that multi-DELETE/TRUNCATE/DML-through-the-
      view statement in the first connection acquired SR lock on a
      table, then ALTER TABLE would come in in the second connection
      and acquire SNW metadata lock and TL_WRITE_ALLOW_READ
      thr_lock.c lock and then would start waiting for the first
      connection during lock upgrade. After that the statement in
      the first connection would try to acquire TL_WRITE lock on
      table and would start waiting for the second connection,
      creating a deadlock.
      
      This patch solves this problem by ensuring that we acquire
      SW metadata lock in all cases in which we acquiring write
      thr_lock.c lock. This guarantees that deadlocks like the
      one described above won't occur since all lock conflicts
      in such situation are resolved within MDL subsystem.
      
      This patch also adds assert which should guarantee that
      such situations won't arise in future.
      c7e7a7d2
    • Joerg Bruehe's avatar
      Bug#50950 Obsolete reference to www.mysql.com · 15728d07
      Joerg Bruehe authored
                      in message printed at end of configure
      
      New text for the success message of "configure".
      15728d07
  6. 06 Feb, 2010 3 commits
    • Konstantin Osipov's avatar
      Merge next-4284 -> next-4284-merge · f750b5f1
      Konstantin Osipov authored
      f750b5f1
    • Konstantin Osipov's avatar
      Merge next-mr -> next-4284. · 9c030fe5
      Konstantin Osipov authored
      9c030fe5
    • Jon Olav Hauglid's avatar
      Bug #50912 Assertion `ticket->m_type >= mdl_request->type' · a4819c5d
      Jon Olav Hauglid authored
                 failed on HANDLER + I_S
      
      This assert was triggered when an I_S query tried to acquire a
      metadata lock on a table which was already locked by a HANDLER
      statement in the same connection.
      
      First the HANDLER took a MDL_SHARED lock. Afterwards, the I_S query
      requested a MDL_SHARED_HIGH_PRIO lock. The existing MDL_SHARED ticket
      is found in find_ticket() since it satisfies 
      ticket->has_stronger_or_equal_type(mdl_request->type) as MDL_SHARED
      and MDL_SHARED_HIGH_PRIO have equal strengths, just different priority.
      
      However, two asserts later check lock type strengths using relational
      operators (>= and <=) rather than MDL_ticket::has_stronger_or_equal_type().
      These asserts are triggered since MDL_SHARED >= MDL_SHARED_HIGH_PRIORITY
      is false (mapped to 1 and 2 respectively).
      
      This patch updates the asserts to use MDL_ticket::has_stronger_or_equal_type()
      rather than relational operators to check lock type strength.
      
      Test case added to include/handler.inc.
      a4819c5d
  7. 05 Feb, 2010 12 commits
  8. 04 Feb, 2010 8 commits