[MDEV-10315] Online ALTER TABLE may get stuck in tdc_remove_table Created: 2016-07-01  Updated: 2016-09-22  Resolved: 2016-09-22

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Locking
Affects Version/s: 10.0.26, 10.1.14
Fix Version/s: 10.1.18, 10.0.28

Type: Bug Priority: Major
Reporter: Sergey Vojtovich Assignee: Sergey Vojtovich
Resolution: Fixed Votes: 0
Labels: None

Sprint: 10.1.18

 Description   

Test case:

--source include/have_xtradb.inc
 
CREATE TABLE t1(a INT) ENGINE=InnoDB;
SELECT * FROM t1;
--send SET @@global.table_open_cache=400;
 
connect(con1, localhost, root);
ALTER TABLE t1 COMMENT='abc';
disconnect con1;
 
connection default;
--reap
DROP TABLE t1;

Apply this patch to make it stuck reliably:

diff --git a/sql/table_cache.cc b/sql/table_cache.cc
index 097f37d..b46a620 100644
--- a/sql/table_cache.cc
+++ b/sql/table_cache.cc
@@ -865,6 +865,8 @@ void tdc_release_share(TABLE_SHARE *share)
   }
   mysql_mutex_unlock(&share->tdc.LOCK_table_share);
 
+  if (!strcmp(share->table_name.str, "t1") && !share->tdc.flushed)
+    sleep(1);
   mysql_mutex_lock(&LOCK_unused_shares);
   mysql_mutex_lock(&share->tdc.LOCK_table_share);
   if (share->tdc.flushed)



 Comments   
Comment by Sergey Vojtovich [ 2016-07-01 ]

serg, please review fix for this bug.

Comment by Sergei Golubchik [ 2016-09-21 ]

ok to push

Generated at Thu Feb 08 07:41:16 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.