From ddd3e261b253856720bd9dc2343a655ecc297e81 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 May 2012 14:27:44 +0200 Subject: [PATCH] MDEV-254: Server hang with FLUSH TABLES WITH READ LOCK AND DISABLE CHECKPOINT The code to re-enable checkpointing after UNLOCK TABLES was lost in the 5.5 merge, so re-add it back in. --- mysql-test/r/flush-innodb.result | 5 +++++ mysql-test/t/flush-innodb.test | 9 +++++++++ sql/lock.cc | 9 +++++++++ 3 files changed, 23 insertions(+) create mode 100644 mysql-test/r/flush-innodb.result create mode 100644 mysql-test/t/flush-innodb.test diff --git a/mysql-test/r/flush-innodb.result b/mysql-test/r/flush-innodb.result new file mode 100644 index 00000000000..cea4f81e2a2 --- /dev/null +++ b/mysql-test/r/flush-innodb.result @@ -0,0 +1,5 @@ +FLUSH TABLES WITH READ LOCK AND DISABLE CHECKPOINT; +UNLOCK TABLES; +CREATE TABLE t1 ( m MEDIUMTEXT ) ENGINE=InnoDB; +INSERT INTO t1 VALUES ( REPEAT('i',1048576) ); +DROP TABLE t1; diff --git a/mysql-test/t/flush-innodb.test b/mysql-test/t/flush-innodb.test new file mode 100644 index 00000000000..207032b1acb --- /dev/null +++ b/mysql-test/t/flush-innodb.test @@ -0,0 +1,9 @@ +--source include/have_innodb.inc + +# MDEV-254: Server hang with FLUSH TABLES WITH READ LOCK AND DISABLE CHECKPOINT +FLUSH TABLES WITH READ LOCK AND DISABLE CHECKPOINT; +UNLOCK TABLES; +CREATE TABLE t1 ( m MEDIUMTEXT ) ENGINE=InnoDB; +INSERT INTO t1 VALUES ( REPEAT('i',1048576) ); + +DROP TABLE t1; diff --git a/sql/lock.cc b/sql/lock.cc index c5a4674bfb0..3a1a6d41ce3 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -1041,6 +1041,15 @@ void Global_read_lock::unlock_global_read_lock(THD *thd) DBUG_ASSERT(m_mdl_global_shared_lock && m_state); + if (thd->global_disable_checkpoint) + { + thd->global_disable_checkpoint= 0; + if (!--global_disable_checkpoint) + { + ha_checkpoint_state(0); // Enable checkpoints + } + } + if (m_mdl_blocks_commits_lock) { thd->mdl_context.release_lock(m_mdl_blocks_commits_lock);