The way how InnoDB writes undo log about CREATE TABLE and DROP TABLE introduces the limitation that only one table may be created or dropped within a transaction.
We should replace the current mechanism (around trx->table_id) and introduce new undo log records for the following:
delete-if-exists a file on rollback (when rolling back CREATE TABLE)
delete-if-exists a file on purge (after DROP TABLE has been committed)
Applying either operation must write MLOG_FILE_DELETE2 to the redo log before actually deleting any files.
To avoid name clashes between DROP TABLE and subsequent CREATE TABLE by the same name (before the old files were purged), we should probably rename the files to temporary names before dropping. Also the rename operation must be undo logged and redo logged. Furthermore, during normal operation we could delete the files for the dropped table. The deletion by the purge subsystem would only be a fall-back measure for crash recovery.
MDEV-34789Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, db.str, table_name.str, MDL_SHARED)' failed in mysql_rm_table_no_locks on DROP TABLE, including via scripts/mariadb-install-db
Closed
MDEV-8069DROP or rebuild of a large table may lock up InnoDB
Closed
MDEV-14398When innodb_encryption_rotate_key_age=0 is set, server won't encrypt tablespaces
Marko Mäkelä
added a comment - The following test currently leaves behind orphan FTS_ tables for the table t1 :
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
CREATE TABLE t1(a TEXT,b TEXT,FULLTEXT INDEX (a)) ENGINE=InnoDB;
CREATE TABLE t2(a TEXT,b TEXT,FULLTEXT INDEX (a)) ENGINE=InnoDB;
CREATE TABLE t3(a TEXT,b TEXT,FULLTEXT INDEX (a)) ENGINE=InnoDB;
connect (ddl1, localhost, root,,);
SET DEBUG_SYNC= 'innodb_inplace_alter_table_enter SIGNAL 1 WAIT_FOR ever' ;
send ALTER TABLE t1 ADD FULLTEXT INDEX (b);
connect (ddl2, localhost, root,,);
SET DEBUG_SYNC= 'innodb_inplace_alter_table_enter SIGNAL 2 WAIT_FOR ever' ;
send ALTER TABLE t2 DROP INDEX a, ADD FULLTEXT INDEX (b), FORCE ;
connect (ddl3, localhost, root,,);
SET DEBUG_SYNC= 'alter_table_before_rename_result_table SIGNAL 3 WAIT_FOR ever' ;
send ALTER TABLE t3 ADD FULLTEXT INDEX (b), ALGORITHM=COPY;
connection default ;
SET DEBUG_SYNC= 'now WAIT_FOR 1' ;
SET DEBUG_SYNC= 'now WAIT_FOR 2' ;
SET DEBUG_SYNC= 'now WAIT_FOR 3' ;
--let $shutdown_timeout=0
--source include/restart_mysqld.inc
disconnect ddl1;
disconnect ddl2;
disconnect ddl3;
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t2;
SHOW CREATE TABLE t3;
DROP TABLE t1,t2,t3;
SELECT * FROM information_schema.innodb_sys_tables where name like 'test/%' ;
# Cleanup until MDEV-25180 (Atomic ALTER TABLE ) has been done
--remove_files_wildcard `select @@datadir`/#sql-*.frm
The above test will need some improvement for the regression suite:
Especially if the server is built with cmake -DPLUGIN_PERFSCHEMA=NO, then the WAIT_FOR 2 or WAIT_FOR 3 would hang. This is because DEBUG_SYNC supports at most one signal being ‘in transit’. (That was improved in MySQL 5.7, but we can simply interleave the WAIT_FOR execution in the test.)
The .frm file cleanup is incorrect.
Marko Mäkelä
added a comment - - edited The above test will need some improvement for the regression suite:
Especially if the server is built with cmake -DPLUGIN_PERFSCHEMA=NO , then the WAIT_FOR 2 or WAIT_FOR 3 would hang. This is because DEBUG_SYNC supports at most one signal being ‘in transit’. ( That was improved in MySQL 5.7 , but we can simply interleave the WAIT_FOR execution in the test.)
The .frm file cleanup is incorrect.
The ALTER TABLE operations involving FULLTEXT INDEX are now atomic inside InnoDB. The test innodb_fts.crash_recovery covers that. The innodb_fts.crash_recovery,release variant (covering a server built using cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo) would trigger many different scenarios that are expected to be fixed by MDEV-24626 and MDEV-25180.
The test variant innodb_fts.crash_recovery,debug kills the server during a deterministic spot of 3 different ALTER TABLE, to exercise the revised recovery that would drop any internal FTS_%INDEX_% tables along with stubs created during prepare_inplace_alter_table_dict().
Marko Mäkelä
added a comment - The ALTER TABLE operations involving FULLTEXT INDEX are now atomic inside InnoDB. The test innodb_fts.crash_recovery covers that. The innodb_fts.crash_recovery,release variant (covering a server built using cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ) would trigger many different scenarios that are expected to be fixed by MDEV-24626 and MDEV-25180 .
The test variant innodb_fts.crash_recovery,debug kills the server during a deterministic spot of 3 different ALTER TABLE , to exercise the revised recovery that would drop any internal FTS_%INDEX_% tables along with stubs created during prepare_inplace_alter_table_dict() .
People
Marko Mäkelä
Marko Mäkelä
Votes:
2Vote for this issue
Watchers:
7Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":1131.7999997138977,"ttfb":368.19999980926514,"pageVisibility":"visible","entityId":72483,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"cef893ed-57bf-4b83-84bb-a02acb435971","navigationType":0,"readyForUser":1218,"redirectCount":0,"resourceLoadedEnd":1284.6999998092651,"resourceLoadedStart":375.7999997138977,"resourceTiming":[{"duration":256.80000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":375.7999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":375.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":632.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":256.80000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":376.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":376.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":632.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":270.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":376.2999997138977,"connectEnd":376.2999997138977,"connectStart":376.2999997138977,"domainLookupEnd":376.2999997138977,"domainLookupStart":376.2999997138977,"fetchStart":376.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":376.2999997138977,"responseEnd":647.0999999046326,"responseStart":647.0999999046326,"secureConnectionStart":376.2999997138977},{"duration":337.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/c32eb0da7ad9831253f8397e6cc26afd-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":376.40000009536743,"connectEnd":376.40000009536743,"connectStart":376.40000009536743,"domainLookupEnd":376.40000009536743,"domainLookupStart":376.40000009536743,"fetchStart":376.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":376.40000009536743,"responseEnd":714,"responseStart":714,"secureConnectionStart":376.40000009536743},{"duration":341.2000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/bc0bcb146314416123c992714ee00ff7-CDN/lu2bv2/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":376.7999997138977,"connectEnd":376.7999997138977,"connectStart":376.7999997138977,"domainLookupEnd":376.7999997138977,"domainLookupStart":376.7999997138977,"fetchStart":376.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":376.7999997138977,"responseEnd":718,"responseStart":718,"secureConnectionStart":376.7999997138977},{"duration":341.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":376.90000009536743,"connectEnd":376.90000009536743,"connectStart":376.90000009536743,"domainLookupEnd":376.90000009536743,"domainLookupStart":376.90000009536743,"fetchStart":376.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":376.90000009536743,"responseEnd":718.4000000953674,"responseStart":718.4000000953674,"secureConnectionStart":376.90000009536743},{"duration":341.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":377.09999990463257,"connectEnd":377.09999990463257,"connectStart":377.09999990463257,"domainLookupEnd":377.09999990463257,"domainLookupStart":377.09999990463257,"fetchStart":377.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":377.09999990463257,"responseEnd":718.7999997138977,"responseStart":718.7999997138977,"secureConnectionStart":377.09999990463257},{"duration":417.90000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bv2/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":377.2999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":377.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":795.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":341.7999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":377.5,"connectEnd":377.5,"connectStart":377.5,"domainLookupEnd":377.5,"domainLookupStart":377.5,"fetchStart":377.5,"redirectEnd":0,"redirectStart":0,"requestStart":377.5,"responseEnd":719.2999997138977,"responseStart":719.2999997138977,"secureConnectionStart":377.5},{"duration":417.7000002861023,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bv2/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":377.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":377.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":795.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":342,"initiatorType":"script","name":"https://jira.mariadb.org/s/719848dd97ebe0663199f49a3936487a-CDN/lu2bv2/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":377.90000009536743,"connectEnd":377.90000009536743,"connectStart":377.90000009536743,"domainLookupEnd":377.90000009536743,"domainLookupStart":377.90000009536743,"fetchStart":377.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":377.90000009536743,"responseEnd":719.9000000953674,"responseStart":719.9000000953674,"secureConnectionStart":377.90000009536743},{"duration":902.6000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":379.2999997138977,"connectEnd":379.2999997138977,"connectStart":379.2999997138977,"domainLookupEnd":379.2999997138977,"domainLookupStart":379.2999997138977,"fetchStart":379.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":379.2999997138977,"responseEnd":1281.9000000953674,"responseStart":1281.9000000953674,"secureConnectionStart":379.2999997138977},{"duration":905.1999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":379.5,"connectEnd":379.5,"connectStart":379.5,"domainLookupEnd":379.5,"domainLookupStart":379.5,"fetchStart":379.5,"redirectEnd":0,"redirectStart":0,"requestStart":379.5,"responseEnd":1284.6999998092651,"responseStart":1284.6999998092651,"secureConnectionStart":379.5},{"duration":475.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":806.7999997138977,"connectEnd":806.7999997138977,"connectStart":806.7999997138977,"domainLookupEnd":806.7999997138977,"domainLookupStart":806.7999997138977,"fetchStart":806.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":806.7999997138977,"responseEnd":1282.2999997138977,"responseStart":1282.2999997138977,"secureConnectionStart":806.7999997138977},{"duration":226.30000019073486,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1122.1999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1122.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1348.5,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":161,"responseStart":368,"responseEnd":370,"domLoading":372,"domInteractive":1387,"domContentLoadedEventStart":1387,"domContentLoadedEventEnd":1435,"domComplete":1745,"loadEventStart":1745,"loadEventEnd":1746,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1357.0999999046326},{"name":"bigPipe.sidebar-id.end","time":1358},{"name":"bigPipe.activity-panel-pipe-id.start","time":1358.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":1361.5},{"name":"activityTabFullyLoaded","time":1455.9000000953674}],"measures":[],"correlationId":"464758c2cfa805","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":141,"dbReadsTimeInMs":28,"dbConnsTimeInMs":39,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
It turns out that many operations involving FULLTEXT INDEX still are not atomic.