summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2018-02-19 11:27:21 +0200
committerMonty <monty@mariadb.org>2018-02-19 11:27:21 +0200
commitef3147b1d64b298486fc6f77f9e84b28a9d1c5b3 (patch)
tree9a76c58e89ec5634a4f267baee02c4c37e4a4a2d
parent06ba07c269bc4731bf571c12c5fc364b487b6086 (diff)
downloadmariadb-git-ef3147b1d64b298486fc6f77f9e84b28a9d1c5b3.tar.gz
Fix for MDEV-15105 (memory loss with LOCK sequence)
MDEV 15105 "Bytes lost and Assertion `global_status_var.global_memory_used == 0' fails on shutdown after attempts to LOCK/RENAME sequence"
-rw-r--r--mysql-test/suite/sql_sequence/rename.result6
-rw-r--r--mysql-test/suite/sql_sequence/rename.test6
-rw-r--r--sql/sql_sequence.cc2
3 files changed, 13 insertions, 1 deletions
diff --git a/mysql-test/suite/sql_sequence/rename.result b/mysql-test/suite/sql_sequence/rename.result
new file mode 100644
index 00000000000..26f529b57ef
--- /dev/null
+++ b/mysql-test/suite/sql_sequence/rename.result
@@ -0,0 +1,6 @@
+CREATE SEQUENCE seq1;
+RENAME TABLE seq1 TO seq2, seq3 TO seq4;
+ERROR 42S02: Table 'test.seq3' doesn't exist
+LOCK TABLE seq1 READ;
+UNLOCK TABLES;
+drop table seq1;
diff --git a/mysql-test/suite/sql_sequence/rename.test b/mysql-test/suite/sql_sequence/rename.test
new file mode 100644
index 00000000000..232a1bda5ea
--- /dev/null
+++ b/mysql-test/suite/sql_sequence/rename.test
@@ -0,0 +1,6 @@
+CREATE SEQUENCE seq1;
+--error ER_NO_SUCH_TABLE
+RENAME TABLE seq1 TO seq2, seq3 TO seq4;
+LOCK TABLE seq1 READ;
+UNLOCK TABLES;
+drop table seq1;
diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc
index 540b5cb7f09..720b347f445 100644
--- a/sql/sql_sequence.cc
+++ b/sql/sql_sequence.cc
@@ -439,7 +439,7 @@ int SEQUENCE::read_initial_values(TABLE *table)
DBUG_ASSERT(table->reginfo.lock_type == TL_READ);
if (!(error= read_stored_values(table)))
initialized= SEQ_READY_TO_USE;
- mysql_unlock_tables(thd, lock, 0);
+ mysql_unlock_tables(thd, lock);
if (mdl_lock_used)
thd->mdl_context.release_lock(mdl_request.ticket);