When importing a dump created by mysqldump with default options meta-data like Rows and Avg_row_length are 0 and Data_length is 16 KB and indexes are not available anymore which leads to long running or locking queries. Only after executing an optimize table afterwards corrects this or whem using the option skip-disable-keys for creating dump.
In the following example the Data_length is always 16 KB, because of the small table:
Test Table
mysql -e 'CREATE DATABASE testdb;'
mysql testdb -e 'CREATE TABLE testtable ( id int, a int,PRIMARY KEY (id)) ENGINE=InnoDB;'
mysql testdb -e 'INSERT INTO testtable VALUES (1,2),(2,3),(3,4);'
Import with default dump
mysqldump testdb testtable > dump1.sql
mysql -e 'DROP DATABASE IF EXISTS testdb;CREATE DATABASE testdb;'
mysql testdb < dump1.sql
mysql testdb -e 'SHOW TABLE STATUS LIKE "testtable"\G'
Rows: 0
Avg_row_length: 0
Recreate Table
mysql testdb -e 'OPTIMIZE TABLE testtable;'
mysql testdb -e 'SHOW TABLE STATUS LIKE "testtable"\G'
Rows: 3
Avg_row_length: 5461
Import with dump without disabled keys
mysqldump --skip-disable-keys testdb testtable > dump2.sql
mysql -e 'DROP DATABASE IF EXISTS testdb;CREATE DATABASE testdb;'
mysql testdb < dump2.sql
mysql testdb -e 'SHOW TABLE STATUS LIKE "testtable"\G'
Reproduceable also with 10.6.8, 10.6.9 and latest 10.6.10. However, the behavior is different: After a restart it is working for some time, once it fails at 10.6.7 every further request will fail, but with 10.6.8, 10.6.9, 10.6.10 further requests will work again but it will fail again afterwards.
Tested with the following shell-script:
#!/bin/bash
systemctl restart mariadb
mysql -V
while :
do
mysql -e 'DROP DATABASE IF EXISTS testdb;CREATE DATABASE testdb;'
mysql testdb < dump1.sql
echo `date` - `mysql testdb -e 'SHOW TABLE STATUS LIKE "testtable"\G' | grep Rows`
Alex
added a comment - - edited Reproduceable also with 10.6.8, 10.6.9 and latest 10.6.10. However, the behavior is different: After a restart it is working for some time, once it fails at 10.6.7 every further request will fail, but with 10.6.8, 10.6.9, 10.6.10 further requests will work again but it will fail again afterwards.
Tested with the following shell-script:
#!/bin/bash
systemctl restart mariadb
mysql -V
while :
do
mysql -e 'DROP DATABASE IF EXISTS testdb;CREATE DATABASE testdb;'
mysql testdb < dump1.sql
echo ` date ` - `mysql testdb -e 'SHOW TABLE STATUS LIKE "testtable"\G' | grep Rows`
sleep 10
done
Attached output of 10.6.7, .8, .9 and latest .10: metadata-test.txt
SELECT TABLE_ROWS, AVG_ROW_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'AND TABLE_SCHEMA='test';
+------------+----------------+
| TABLE_ROWS | AVG_ROW_LENGTH |
+------------+----------------+
| 3 | 5461 |
+------------+----------------+
Alexander Barkov
added a comment - - edited A similar problem is repeatable with 10.7.6:
The row statistics is empty if I set UNIQUE_CHECKS and FOREIGN_KEY_CHECKS to 0:
SET UNIQUE_CHECKS=0;
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`id` int (11) NOT NULL ,
`a` int (11) DEFAULT NULL ,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE =latin1_swedish_ci;
INSERT INTO `t1` VALUES (1,2),(2,3),(3,4);
SELECT TABLE_ROWS, AVG_ROW_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 't1' AND TABLE_SCHEMA= 'test' ;
+------------+----------------+
| TABLE_ROWS | AVG_ROW_LENGTH |
+------------+----------------+
| 0 | 0 |
+------------+----------------+
The row statistics is not empty if I set UNIQUE_CHECKS and FOREIGN_KEY_CHECKS to 1:
SET UNIQUE_CHECKS=1;
SET FOREIGN_KEY_CHECKS=1;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`id` int (11) NOT NULL ,
`a` int (11) DEFAULT NULL ,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE =latin1_swedish_ci;
INSERT INTO `t1` VALUES (1,2),(2,3),(3,4);
SELECT TABLE_ROWS, AVG_ROW_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 't1' AND TABLE_SCHEMA= 'test' ;
+------------+----------------+
| TABLE_ROWS | AVG_ROW_LENGTH |
+------------+----------------+
| 3 | 5461 |
+------------+----------------+
Repeatable with 10.6.10 and 10.7.6 with the following MTR test:
--source include/have_innodb.inc
CREATEDATABASE db1;
CREATETABLE db1.t1 (id int, a int,PRIMARYKEY (id)) ENGINE=InnoDB;
INSERTINTO db1.t1 VALUES (1,2),(2,3),(3,4);
--let $file = $MYSQLTEST_VARDIR/tmp/dump.sql
--exec $MYSQL_DUMP db1 t1 >$file
DROPDATABASEIF EXISTS db1;
CREATEDATABASE db1;
--exec $MYSQL db1 < $file
--remove_file $file
SELECT TABLE_ROWS, AVG_ROW_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME='t1'AND TABLE_SCHEMA='db1';
OPTIMIZE TABLE db1.t1;
SELECT TABLE_ROWS, AVG_ROW_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME='t1'AND TABLE_SCHEMA='db1';
DROPDATABASE db1;
This is the output:
worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
CREATE DATABASE db1;
CREATE TABLE db1.t1 (id int, a int,PRIMARY KEY (id)) ENGINE=InnoDB;
INSERT INTO db1.t1 VALUES (1,2),(2,3),(3,4);
DROP DATABASE IF EXISTS db1;
CREATE DATABASE db1;
SELECT TABLE_ROWS, AVG_ROW_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='db1';
TABLE_ROWS AVG_ROW_LENGTH
0 0
OPTIMIZE TABLE db1.t1;
Table Op Msg_type Msg_text
db1.t1 optimize note Table does not support optimize, doing recreate + analyze instead
db1.t1 optimize status OK
SELECT TABLE_ROWS, AVG_ROW_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='db1';
TABLE_ROWS AVG_ROW_LENGTH
3 5461
DROP DATABASE db1;
main.AAA 'innodb' [ pass ] 82
Alexander Barkov
added a comment - - edited Repeatable with 10.6.10 and 10.7.6 with the following MTR test:
--source include/have_innodb.inc
CREATE DATABASE db1;
CREATE TABLE db1.t1 (id int , a int , PRIMARY KEY (id)) ENGINE=InnoDB;
INSERT INTO db1.t1 VALUES (1,2),(2,3),(3,4);
--let $file = $MYSQLTEST_VARDIR/tmp/dump.sql
--exec $MYSQL_DUMP db1 t1 >$file
DROP DATABASE IF EXISTS db1;
CREATE DATABASE db1;
--exec $MYSQL db1 < $file
--remove_file $file
SELECT TABLE_ROWS, AVG_ROW_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME= 't1' AND TABLE_SCHEMA= 'db1' ;
OPTIMIZE TABLE db1.t1;
SELECT TABLE_ROWS, AVG_ROW_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME= 't1' AND TABLE_SCHEMA= 'db1' ;
DROP DATABASE db1;
This is the output:
worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
CREATE DATABASE db1;
CREATE TABLE db1.t1 (id int, a int,PRIMARY KEY (id)) ENGINE=InnoDB;
INSERT INTO db1.t1 VALUES (1,2),(2,3),(3,4);
DROP DATABASE IF EXISTS db1;
CREATE DATABASE db1;
SELECT TABLE_ROWS, AVG_ROW_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='db1';
TABLE_ROWS AVG_ROW_LENGTH
0 0
OPTIMIZE TABLE db1.t1;
Table Op Msg_type Msg_text
db1.t1 optimize note Table does not support optimize, doing recreate + analyze instead
db1.t1 optimize status OK
SELECT TABLE_ROWS, AVG_ROW_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='db1';
TABLE_ROWS AVG_ROW_LENGTH
3 5461
DROP DATABASE db1;
main.AAA 'innodb' [ pass ] 82
MDEV-28327 InnoDB persistent statistics fail to update after bulk insert
So it appeared that this problem duplicates MDEV-28327.
Alexander Barkov
added a comment - - edited The problem is not repeatable in 10.6.11 after this patch:
commit f70960c3482073d2edd4a809899adee56c94ec24 (HEAD -> 10.6)
Author: Thirunarayanan Balathandayuthapani <thiru@mariadb.com>
Date: Tue Oct 25 12:12:33 2022 +0530
MDEV-28327 InnoDB persistent statistics fail to update after bulk insert
So it appeared that this problem duplicates MDEV-28327 .
Alexander Barkov
added a comment - Hi marko , can you please review a patch?
https://github.com/MariaDB/server/commit/aa1a9e21895b675c01133a74493c3abaa3b6dee1
Thanks.
It looks like MDEV-28327 is very similar to this issue. However, I can reproduce this issue also with the latest version 10.6.11.
I have also tried the test in MDEV-28327 which is reproduceable in 10.6.10 but not in 10.6.11, as it has been fixed.
@bar You wrote that it is not reproduceable with 10.6.11, have you tried my shell-script?
Attached is a new test-report with 10.6.10 and 10.6.11, where it can be seen that the issue is still existing.
So can you please reopen it.
Alex
added a comment - It looks like MDEV-28327 is very similar to this issue. However, I can reproduce this issue also with the latest version 10.6.11.
I have also tried the test in MDEV-28327 which is reproduceable in 10.6.10 but not in 10.6.11, as it has been fixed.
@bar You wrote that it is not reproduceable with 10.6.11, have you tried my shell-script?
Attached is a new test-report with 10.6.10 and 10.6.11, where it can be seen that the issue is still existing.
So can you please reopen it.
metadata-test2.txt
People
Alexander Barkov
Alex
Votes:
4Vote for this issue
Watchers:
9Start 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":1202.0999999046326,"ttfb":321.69999980926514,"pageVisibility":"visible","entityId":105864,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"f06c8ac5-b61c-4d36-b5c8-34ff6e2ed2ef","navigationType":0,"readyForUser":1310.2999997138977,"redirectCount":0,"resourceLoadedEnd":840.2999997138977,"resourceLoadedStart":341.19999980926514,"resourceTiming":[{"duration":65.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":341.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":341.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":406.69999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":98.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":341.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":341.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":440.19999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":359,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":341.69999980926514,"connectEnd":341.69999980926514,"connectStart":341.69999980926514,"domainLookupEnd":341.69999980926514,"domainLookupStart":341.69999980926514,"fetchStart":341.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":442.09999990463257,"responseEnd":700.6999998092651,"responseStart":554.7999997138977,"secureConnectionStart":341.69999980926514},{"duration":497,"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":341.90000009536743,"connectEnd":341.90000009536743,"connectStart":341.90000009536743,"domainLookupEnd":341.90000009536743,"domainLookupStart":341.90000009536743,"fetchStart":341.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":442,"responseEnd":838.9000000953674,"responseStart":508.5,"secureConnectionStart":341.90000009536743},{"duration":144.40000009536743,"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":342.09999990463257,"connectEnd":342.09999990463257,"connectStart":342.09999990463257,"domainLookupEnd":342.09999990463257,"domainLookupStart":342.09999990463257,"fetchStart":342.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":442.19999980926514,"responseEnd":486.5,"responseStart":484.19999980926514,"secureConnectionStart":342.09999990463257},{"duration":158.40000009536743,"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":342.2999997138977,"connectEnd":342.2999997138977,"connectStart":342.2999997138977,"domainLookupEnd":342.2999997138977,"domainLookupStart":342.2999997138977,"fetchStart":342.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":442.2999997138977,"responseEnd":500.69999980926514,"responseStart":498,"secureConnectionStart":342.2999997138977},{"duration":146.5,"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":342.5,"connectEnd":342.5,"connectStart":342.5,"domainLookupEnd":342.5,"domainLookupStart":342.5,"fetchStart":342.5,"redirectEnd":0,"redirectStart":0,"requestStart":442.5,"responseEnd":489,"responseStart":487.2999997138977,"secureConnectionStart":342.5},{"duration":98.80000019073486,"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":342.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":342.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":441.40000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":182.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":342.90000009536743,"connectEnd":342.90000009536743,"connectStart":342.90000009536743,"domainLookupEnd":342.90000009536743,"domainLookupStart":342.90000009536743,"fetchStart":342.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":448.2999997138977,"responseEnd":525.0999999046326,"responseStart":520.1999998092651,"secureConnectionStart":342.90000009536743},{"duration":98.59999990463257,"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":343,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":343,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":441.59999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":154.69999980926514,"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":343.09999990463257,"connectEnd":343.09999990463257,"connectStart":343.09999990463257,"domainLookupEnd":343.09999990463257,"domainLookupStart":343.09999990463257,"fetchStart":343.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":449.7999997138977,"responseEnd":497.7999997138977,"responseStart":488,"secureConnectionStart":343.09999990463257},{"duration":489.19999980926514,"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":349.5,"connectEnd":349.5,"connectStart":349.5,"domainLookupEnd":349.5,"domainLookupStart":349.5,"fetchStart":349.5,"redirectEnd":0,"redirectStart":0,"requestStart":519.5999999046326,"responseEnd":838.6999998092651,"responseStart":825.9000000953674,"secureConnectionStart":349.5},{"duration":490.69999980926514,"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":349.59999990463257,"connectEnd":349.59999990463257,"connectStart":349.59999990463257,"domainLookupEnd":349.59999990463257,"domainLookupStart":349.59999990463257,"fetchStart":349.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":659.5999999046326,"responseEnd":840.2999997138977,"responseStart":835.5,"secureConnectionStart":349.59999990463257},{"duration":331.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":852.4000000953674,"connectEnd":852.4000000953674,"connectStart":852.4000000953674,"domainLookupEnd":852.4000000953674,"domainLookupStart":852.4000000953674,"fetchStart":852.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":1144.2999997138977,"responseEnd":1183.9000000953674,"responseStart":1179.6999998092651,"secureConnectionStart":852.4000000953674}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":83,"responseStart":322,"responseEnd":348,"domLoading":335,"domInteractive":1420,"domContentLoadedEventStart":1420,"domContentLoadedEventEnd":1495,"domComplete":3143,"loadEventStart":3143,"loadEventEnd":3143,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1369.5999999046326},{"name":"bigPipe.sidebar-id.end","time":1370.4000000953674},{"name":"bigPipe.activity-panel-pipe-id.start","time":1370.5999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":1376.4000000953674},{"name":"activityTabFullyLoaded","time":1519.1999998092651}],"measures":[],"correlationId":"dde05164ebe4de","effectiveType":"4g","downlink":9.6,"rtt":0,"serverDuration":148,"dbReadsTimeInMs":16,"dbConnsTimeInMs":26,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Same behaviour on 10.6.7