Type:
Bug
Priority:
Major
Resolution:
Fixed
Affects Version/s:
10.6 , 10.7(EOL) , 10.8(EOL) , 10.9(EOL) , 10.10(EOL) , 10.11
An upgrade test related to MDEV-25004 triggered the following:
…
2022-12-15 15:22:32 3 [ERROR] InnoDB: Table `mysql`.`innodb_index_stats` is corrupted. Please drop the table and recreate.
2022-12-15 15:22:32 3 [ERROR] InnoDB: Table `mysql`.`innodb_table_stats` is corrupted. Please drop the table and recreate.
2022-12-15 15:22:32 0x7f999f7686c0 InnoDB: Assertion failure in file /mariadb/10.6m/storage/innobase/pars/pars0pars.cc line 771
InnoDB: Failing assertion: sym_node->table != NULL
The server had been started up with a subset of a 10.3 data directory. According to the InnoDB data dictionary, the statistics tables exist, but the .ibd files for them had been omitted. After MDEV-13542 was fixed, InnoDB is not expected to crash on any corruption, but it did here:
#4 0x000055bb9490ce23 in ut_dbg_assertion_failed (
expr=expr@entry=0x55bb910ed760 "sym_node->table != NULL",
file=file@entry=0x55bb910ec7e0 "/mariadb/10.6m/storage/innobase/pars/pars0pars.cc", line=line@entry=771) at /mariadb/10.6m/storage/innobase/ut/ut0dbg.cc:60
#5 0x000055bb9460a356 in pars_retrieve_table_def (
sym_node=sym_node@entry=0x629000c174d0)
at /mariadb/10.6m/storage/innobase/pars/pars0pars.cc:771
#6 0x000055bb946117c7 in pars_update_statement (node=0x629000c175d8,
cursor_sym=cursor_sym@entry=0x0,
search_cond=search_cond@entry=0x629000c17ba8)
at /mariadb/10.6m/storage/innobase/pars/pars0pars.cc:1182
#7 0x000055bb94617596 in yyparse () at /dev/shm/10.6mu/pars0grm.y:372
#8 0x000055bb9460ee6b in pars_sql (info=info@entry=0x61700012fb20,
str=str@entry=0x55bb91031680 "PROCEDURE DELETE_FROM_TABLE_STATS () IS\nBEGIN\nDELETE FROM \"mysql/innodb_table_stats\" WHERE\ndatabase_name = :database_name AND\ntable_name = :table_name;\nEND;\n")
at /mariadb/10.6m/storage/innobase/pars/pars0pars.cc:1986
#9 0x000055bb94632227 in que_eval_sql (info=info@entry=0x61700012fb20,
sql=sql@entry=0x55bb91031680 "PROCEDURE DELETE_FROM_TABLE_STATS () IS\nBEGIN\nDELETE FROM \"mysql/innodb_table_stats\" WHERE\ndatabase_name = :database_name AND\ntable_name = :table_name;\nEND;\n", trx=trx@entry=0x7f99a5aefe40)
at /mariadb/10.6m/storage/innobase/que/que0que.cc:705
#10 0x000055bb94230804 in dict_stats_exec_sql (
pinfo=pinfo@entry=0x61700012fb20,
sql=sql@entry=0x55bb91031680 "PROCEDURE DELETE_FROM_TABLE_STATS () IS\nBEGIN\nDELETE FROM \"mysql/innodb_table_stats\" WHERE\ndatabase_name = :database_name AND\ntable_name = :table_name;\nEND;\n", trx=trx@entry=0x7f99a5aefe40)
at /mariadb/10.6m/storage/innobase/dict/dict0stats.cc:532
#11 0x000055bb94230934 in dict_stats_delete_from_table_stats (
database_name=database_name@entry=0x7f999f762330 "test",
table_name=table_name@entry=0x7f999f762440 "articles2",
trx=trx@entry=0x7f99a5aefe40)
at /mariadb/10.6m/storage/innobase/dict/dict0stats.cc:4244
#12 0x000055bb942a782d in trx_t::drop_table_statistics (
this=this@entry=0x7f99a5aefe40,
name=@0x7f999f762600: {m_name = 0x61e000056620 "test/articles2"})
at /mariadb/10.6m/storage/innobase/dict/drop.cc:133
#13 0x000055bb943dfee4 in commit_try_rebuild (
ha_alter_info=ha_alter_info@entry=0x7f999f763820,
ctx=ctx@entry=0x62b0000c6830,
altered_table=altered_table@entry=0x7f999f7643a0,
old_table=old_table@entry=0x6190000ca898, trx=trx@entry=0x7f99a5aefe40,
table_name=table_name@entry=0x61b00010a655 "articles2")
at /mariadb/10.6m/storage/innobase/handler/handler0alter.cc:10191
I tried but failed to create a simple test case of this. The fix is simple: avoid the call when the statistics tables could not be opened.
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index f91c0a23c08..dd83ed49af0 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -10101,6 +10101,7 @@ commit_try_rebuild(
ha_innobase_inplace_ctx*ctx,
TABLE* altered_table,
const TABLE* old_table,
+ bool statistics_exist,
trx_t* trx,
const char* table_name)
{
@@ -10171,7 +10172,9 @@ commit_try_rebuild(
if (error == DB_SUCCESS) {
/* The statistics for the surviving indexes will be
re-inserted in alter_stats_rebuild(). */
- error = trx->drop_table_statistics(old_name);
+ if (statistics_exist) {
+ error = trx->drop_table_statistics(old_name);
+ }
if (error == DB_SUCCESS) {
error = trx->drop_table(*user_table);
}
@@ -11316,6 +11319,7 @@ ha_innobase::commit_inplace_alter_table(
if (commit_try_rebuild(ha_alter_info, ctx,
altered_table, table,
+ table_stats && index_stats,
trx,
table_share->table_name.str)) {
goto fail;
On TRUNCATE TABLE , a corresponding check was already in place:
if (err == DB_SUCCESS && table_stats && index_stats)
err= trx->drop_table_statistics(table->name);
blocks
MDEV-25004
Missing row in FTS_DOC_ID_INDEX during DELETE HISTORY
Closed
{"report":{"fcp":1117.5,"ttfb":245.7000002861023,"pageVisibility":"visible","entityId":117711,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"17ceb113-2272-4d70-b18a-f33dfe95a65d","navigationType":0,"readyForUser":1200.7000002861023,"redirectCount":0,"resourceLoadedEnd":1356.2000002861023,"resourceLoadedStart":252,"resourceTiming":[{"duration":351.59999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":252,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":252,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":603.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":351.7999997138977,"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":252.2000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":252.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":604,"responseStart":0,"secureConnectionStart":0},{"duration":363,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":252.40000009536743,"connectEnd":252.40000009536743,"connectStart":252.40000009536743,"domainLookupEnd":252.40000009536743,"domainLookupStart":252.40000009536743,"fetchStart":252.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":252.40000009536743,"responseEnd":615.4000000953674,"responseStart":615.4000000953674,"secureConnectionStart":252.40000009536743},{"duration":410.80000019073486,"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":252.59999990463257,"connectEnd":252.59999990463257,"connectStart":252.59999990463257,"domainLookupEnd":252.59999990463257,"domainLookupStart":252.59999990463257,"fetchStart":252.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":252.59999990463257,"responseEnd":663.4000000953674,"responseStart":663.4000000953674,"secureConnectionStart":252.59999990463257},{"duration":414.90000009536743,"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":252.80000019073486,"connectEnd":252.80000019073486,"connectStart":252.80000019073486,"domainLookupEnd":252.80000019073486,"domainLookupStart":252.80000019073486,"fetchStart":252.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":252.80000019073486,"responseEnd":667.7000002861023,"responseStart":667.7000002861023,"secureConnectionStart":252.80000019073486},{"duration":415.2000002861023,"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":253,"connectEnd":253,"connectStart":253,"domainLookupEnd":253,"domainLookupStart":253,"fetchStart":253,"redirectEnd":0,"redirectStart":0,"requestStart":253,"responseEnd":668.2000002861023,"responseStart":668.2000002861023,"secureConnectionStart":253},{"duration":415.09999990463257,"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":253.7000002861023,"connectEnd":253.7000002861023,"connectStart":253.7000002861023,"domainLookupEnd":253.7000002861023,"domainLookupStart":253.7000002861023,"fetchStart":253.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":253.7000002861023,"responseEnd":668.8000001907349,"responseStart":668.8000001907349,"secureConnectionStart":253.7000002861023},{"duration":415.69999980926514,"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":253.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":253.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":669.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":415.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":254,"connectEnd":254,"connectStart":254,"domainLookupEnd":254,"domainLookupStart":254,"fetchStart":254,"redirectEnd":0,"redirectStart":0,"requestStart":254,"responseEnd":669.5999999046326,"responseStart":669.5999999046326,"secureConnectionStart":254},{"duration":416.19999980926514,"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":254.2000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":254.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":670.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":415.90000009536743,"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":254.30000019073486,"connectEnd":254.30000019073486,"connectStart":254.30000019073486,"domainLookupEnd":254.30000019073486,"domainLookupStart":254.30000019073486,"fetchStart":254.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":254.30000019073486,"responseEnd":670.2000002861023,"responseStart":670.2000002861023,"secureConnectionStart":254.30000019073486},{"duration":581.9000000953674,"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":255.5,"connectEnd":255.5,"connectStart":255.5,"domainLookupEnd":255.5,"domainLookupStart":255.5,"fetchStart":255.5,"redirectEnd":0,"redirectStart":0,"requestStart":255.5,"responseEnd":837.4000000953674,"responseStart":837.4000000953674,"secureConnectionStart":255.5},{"duration":1100.6000003814697,"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":255.59999990463257,"connectEnd":255.59999990463257,"connectStart":255.59999990463257,"domainLookupEnd":255.59999990463257,"domainLookupStart":255.59999990463257,"fetchStart":255.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":255.59999990463257,"responseEnd":1356.2000002861023,"responseStart":1356.2000002861023,"secureConnectionStart":255.59999990463257},{"duration":470.1000003814697,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":884.0999999046326,"connectEnd":884.0999999046326,"connectStart":884.0999999046326,"domainLookupEnd":884.0999999046326,"domainLookupStart":884.0999999046326,"fetchStart":884.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":884.0999999046326,"responseEnd":1354.2000002861023,"responseStart":1354.2000002861023,"secureConnectionStart":884.0999999046326},{"duration":285.90000009536743,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1093.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1093.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1379.4000000953674,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":70,"responseStart":246,"responseEnd":249,"domLoading":250,"domInteractive":1381,"domContentLoadedEventStart":1381,"domContentLoadedEventEnd":1420,"domComplete":2332,"loadEventStart":2332,"loadEventEnd":2333,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1363},{"name":"bigPipe.sidebar-id.end","time":1363.9000000953674},{"name":"bigPipe.activity-panel-pipe-id.start","time":1364.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":1366.7000002861023},{"name":"activityTabFullyLoaded","time":1464}],"measures":[],"correlationId":"9aadcc0a8faeac","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":106,"dbReadsTimeInMs":11,"dbConnsTimeInMs":20,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}