CREATE TABLE t(c INT) ENGINE=InnoDB;
|
ALTER TABLE t DISCARD TABLESPACE;
|
RENAME TABLE t TO u;
|
TRUNCATE u;
|
TRUNCATE u;
|
Leads to:
10.5.6 c5517cd86440b6669509211b1ad10f837a929952 (Debug)
|
mysqld: /test/10.5_dbg/storage/innobase/row/row0mysql.cc:3694: dberr_t row_drop_table_for_mysql(const char*, trx_t*, enum_sql_command, bool, bool): Assertion `table->data_dir_path || !space' failed.
|
10.5.6 c5517cd86440b6669509211b1ad10f837a929952 (Debug)
|
Core was generated by `/test/MD080920-mariadb-10.5.6-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
|
Program terminated with signal SIGABRT, Aborted.
|
#0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
|
at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
|
[Current thread is 1 (Thread 0x14a736165700 (LWP 3580839))]
|
(gdb) bt
|
#0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
|
#1 0x000055e79331f4e8 in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:424
|
#2 0x000055e792ae656b in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330
|
#3 <signal handler called>
|
#4 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
|
#5 0x000014a7343fb8b1 in __GI_abort () at abort.c:79
|
#6 0x000014a7343eb42a in __assert_fail_base (fmt=0x14a734572a38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55e793773338 "table->data_dir_path || !space", file=file@entry=0x55e793770ee0 "/test/10.5_dbg/storage/innobase/row/row0mysql.cc", line=line@entry=3694, function=function@entry=0x55e793774220 <row_drop_table_for_mysql(char const*, trx_t*, enum_sql_command, bool, bool)::__PRETTY_FUNCTION__> "dberr_t row_drop_table_for_mysql(const char*, trx_t*, enum_sql_command, bool, bool)") at assert.c:92
|
#7 0x000014a7343eb4a2 in __GI___assert_fail (assertion=assertion@entry=0x55e793773338 "table->data_dir_path || !space", file=file@entry=0x55e793770ee0 "/test/10.5_dbg/storage/innobase/row/row0mysql.cc", line=line@entry=3694, function=function@entry=0x55e793774220 <row_drop_table_for_mysql(char const*, trx_t*, enum_sql_command, bool, bool)::__PRETTY_FUNCTION__> "dberr_t row_drop_table_for_mysql(const char*, trx_t*, enum_sql_command, bool, bool)") at assert.c:101
|
#8 0x000055e793029375 in row_drop_table_for_mysql (name=<optimized out>, name@entry=0x14a736162de0 "test/#sql-ib22", trx=trx@entry=0x14a721003548, sqlcom=sqlcom@entry=SQLCOM_TRUNCATE, create_failed=create_failed@entry=false, nonatomic=<optimized out>, nonatomic@entry=true) at /test/10.5_dbg/storage/innobase/row/row0mysql.cc:3694
|
#9 0x000055e792eccf7a in ha_innobase::delete_table (this=this@entry=0x14a7135246a0, name=<optimized out>, name@entry=0x14a7134570a0 "test/#sql-ib22", sqlcom=sqlcom@entry=SQLCOM_TRUNCATE) at /test/10.5_dbg/storage/innobase/handler/ha_innodb.cc:13210
|
#10 0x000055e792ec417d in ha_innobase::truncate (this=0x14a7135246a0) at /test/10.5_dbg/storage/innobase/handler/ha_innodb.cc:13603
|
#11 0x000055e792af4ddf in handler::ha_truncate (this=0x14a7135246a0) at /test/10.5_dbg/sql/handler.cc:4693
|
#12 0x000055e7929bdbda in Sql_cmd_truncate_table::handler_truncate (this=this@entry=0x14a713474830, thd=thd@entry=0x14a713415088, table_ref=table_ref@entry=0x14a713474158, is_tmp_table=is_tmp_table@entry=false) at /test/10.5_dbg/sql/sql_truncate.cc:238
|
#13 0x000055e7929be806 in Sql_cmd_truncate_table::truncate_table (this=this@entry=0x14a713474830, thd=thd@entry=0x14a713415088, table_ref=table_ref@entry=0x14a713474158) at /test/10.5_dbg/sql/sql_truncate.cc:461
|
#14 0x000055e7929be958 in Sql_cmd_truncate_table::execute (this=0x14a713474830, thd=0x14a713415088) at /test/10.5_dbg/sql/sql_truncate.cc:517
|
#15 0x000055e792838b44 in mysql_execute_command (thd=thd@entry=0x14a713415088) at /test/10.5_dbg/sql/sql_parse.cc:5952
|
#16 0x000055e7928404b8 in mysql_parse (thd=thd@entry=0x14a713415088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14a736164350, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7994
|
#17 0x000055e79282cee8 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14a713415088, packet=packet@entry=0x14a713467089 "TRUNCATE u", packet_length=packet_length@entry=10, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1867
|
#18 0x000055e79282b6d2 in do_command (thd=0x14a713415088) at /test/10.5_dbg/sql/sql_parse.cc:1348
|
#19 0x000055e79298aa27 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x14a7150d42c8, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1410
|
#20 0x000055e79298b14b in handle_one_connection (arg=arg@entry=0x14a7150d42c8) at /test/10.5_dbg/sql/sql_connect.cc:1312
|
#21 0x000055e792df5784 in pfs_spawn_thread (arg=0x14a733046508) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
|
#22 0x000014a7350de6db in start_thread (arg=0x14a736165700) at pthread_create.c:463
|
#23 0x000014a7344dca3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
Bug confirmed present in:
MariaDB: 10.2.34 (dbg), 10.3.25 (dbg), 10.4.15 (dbg), 10.5.6 (dbg)
Bug confirmed not present in:
MariaDB: 10.1.47 (dbg), 10.1.47 (opt), 10.2.34 (opt), 10.3.25 (opt), 10.4.15 (opt), 10.5.6 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)
{"report":{"fcp":1546.6999998092651,"ttfb":241.5,"pageVisibility":"visible","entityId":91542,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"ef24858d-ef1a-4ab0-84ed-ec09cd414538","navigationType":0,"readyForUser":1650.3999996185303,"redirectCount":0,"resourceLoadedEnd":1227.0999999046326,"resourceLoadedStart":257.7999997138977,"resourceTiming":[{"duration":167.7000002861023,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":257.7999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":257.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":425.5,"responseStart":0,"secureConnectionStart":0},{"duration":167.59999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":258.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":258.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":425.69999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":781,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":258.19999980926514,"connectEnd":258.19999980926514,"connectStart":258.19999980926514,"domainLookupEnd":258.19999980926514,"domainLookupStart":258.19999980926514,"fetchStart":258.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":435.2999997138977,"responseEnd":1039.1999998092651,"responseStart":488.7999997138977,"secureConnectionStart":258.19999980926514},{"duration":968.7000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":258.3999996185303,"connectEnd":258.3999996185303,"connectStart":258.3999996185303,"domainLookupEnd":258.3999996185303,"domainLookupStart":258.3999996185303,"fetchStart":258.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":435.3999996185303,"responseEnd":1227.0999999046326,"responseStart":491.8999996185303,"secureConnectionStart":258.3999996185303},{"duration":234.2999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":258.59999990463257,"connectEnd":258.59999990463257,"connectStart":258.59999990463257,"domainLookupEnd":258.59999990463257,"domainLookupStart":258.59999990463257,"fetchStart":258.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":435.59999990463257,"responseEnd":492.8999996185303,"responseStart":491.19999980926514,"secureConnectionStart":258.59999990463257},{"duration":239.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":258.69999980926514,"connectEnd":258.69999980926514,"connectStart":258.69999980926514,"domainLookupEnd":258.69999980926514,"domainLookupStart":258.69999980926514,"fetchStart":258.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":435.69999980926514,"responseEnd":498.5,"responseStart":493,"secureConnectionStart":258.69999980926514},{"duration":240.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":258.8999996185303,"connectEnd":258.8999996185303,"connectStart":258.8999996185303,"domainLookupEnd":258.8999996185303,"domainLookupStart":258.8999996185303,"fetchStart":258.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":435.8999996185303,"responseEnd":499.19999980926514,"responseStart":494.59999990463257,"secureConnectionStart":258.8999996185303},{"duration":167.89999961853027,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":259,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":259,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":426.8999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":241.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":259.2999997138977,"connectEnd":259.2999997138977,"connectStart":259.2999997138977,"domainLookupEnd":259.2999997138977,"domainLookupStart":259.2999997138977,"fetchStart":259.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":438.69999980926514,"responseEnd":500.8999996185303,"responseStart":499.5,"secureConnectionStart":259.2999997138977},{"duration":170.2000002861023,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/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":259.3999996185303,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":259.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":429.59999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":270.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/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":259.59999990463257,"connectEnd":259.59999990463257,"connectStart":259.59999990463257,"domainLookupEnd":259.59999990463257,"domainLookupStart":259.59999990463257,"fetchStart":259.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":447,"responseEnd":530,"responseStart":500.19999980926514,"secureConnectionStart":259.59999990463257},{"duration":939.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":263.8999996185303,"connectEnd":263.8999996185303,"connectStart":263.8999996185303,"domainLookupEnd":263.8999996185303,"domainLookupStart":263.8999996185303,"fetchStart":263.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":584.1999998092651,"responseEnd":1203.3999996185303,"responseStart":1175,"secureConnectionStart":263.8999996185303},{"duration":926.7000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":278.7999997138977,"connectEnd":278.7999997138977,"connectStart":278.7999997138977,"domainLookupEnd":278.7999997138977,"domainLookupStart":278.7999997138977,"fetchStart":278.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":714.2999997138977,"responseEnd":1205.5,"responseStart":1198.2999997138977,"secureConnectionStart":278.7999997138977},{"duration":210.30000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1204.6999998092651,"connectEnd":1204.6999998092651,"connectStart":1204.6999998092651,"domainLookupEnd":1204.6999998092651,"domainLookupStart":1204.6999998092651,"fetchStart":1204.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":1355.3999996185303,"responseEnd":1415,"responseStart":1390.7999997138977,"secureConnectionStart":1204.6999998092651}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":40,"responseStart":241,"responseEnd":280,"domLoading":250,"domInteractive":1744,"domContentLoadedEventStart":1744,"domContentLoadedEventEnd":1807,"domComplete":2700,"loadEventStart":2700,"loadEventEnd":2701,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1699.1999998092651},{"name":"bigPipe.sidebar-id.end","time":1700.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.start","time":1700.2999997138977},{"name":"bigPipe.activity-panel-pipe-id.end","time":1704.5},{"name":"activityTabFullyLoaded","time":1824}],"measures":[],"correlationId":"a8df16e5bfdce4","effectiveType":"4g","downlink":9.7,"rtt":0,"serverDuration":110,"dbReadsTimeInMs":14,"dbConnsTimeInMs":24,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
This is a rather interesting bug. The DATA DIRECTORY flag will be wrongly set. And not only that, the table->data_dir_path will have been truncated to "./t":
10.2 e05650e6868eab2dbb9f58c4786bcc71afc4ffce
Thread 3 hit Watchpoint 8: table->data_dir_path[3]
Old value = 101 'e'
New value = 0 '\000'
os_file_make_data_dir_path (data_dir_path=<optimized out>) at /mariadb/10.2o/storage/innobase/os/os0file.cc:1393
1393 }
(rr) bt
#0 os_file_make_data_dir_path (data_dir_path=<optimized out>) at /mariadb/10.2o/storage/innobase/os/os0file.cc:1393
#1 0x000055685158363d in dict_save_data_dir_path (table=0x7f635816c6b0, filepath=<optimized out>) at /mariadb/10.2o/storage/innobase/dict/dict0load.cc:2724
#2 dict_get_and_save_data_dir_path (table=0x7f635816c6b0, dict_mutex_own=false) at /mariadb/10.2o/storage/innobase/dict/dict0load.cc:2755
#3 0x00005568512eeaa2 in ha_innobase::truncate (this=0x7f6358091f60) at /mariadb/10.2o/storage/innobase/handler/ha_innodb.cc:13706
I was suspecting heap-use-after-free, but WITH_ASAN will not flag anything before the assertion failure. We seem to get this truncated data_file_name = "./t" on the first invocation of ha_innobase::truncate().