It is obvious from MDEV-16546 specification (although unfortunately not from the variable name) that system_versioning_insert_history only applies to timestamp-based versioning.
However, --dump-history option in mysqldump applies to both timestamp-based and precision versioning, and it dumps the history for all versioned tables.
So, the dump would contain a mix of current and historical records. Upon loading it, the values for row start/row end in precision-versioned tables will be ignored, and depending on the structure and data, the table will either end up with outdated values, or INSERT will fail due to duplicate keys.
--source include/have_innodb.inc
createtable t1 (a int, f varchar(8), s bigint unsigned as row start, e bigint unsigned as row end, period for system_time(s,e)) engine=InnoDB with system versioning;
insertinto t1 (a,f) values (1,'foo');
update t1 set f = 'bar';
createtable t2 (pk intprimarykey, f varchar(8), s bigint unsigned as row start, e bigint unsigned as row end, period for system_time(s,e)) engine=InnoDB with system versioning;
insertinto t2 (pk,f) values (1,'foo');
update t2 set f = 'bar';
--exec $MYSQL_DUMP test --dump-history --tables t1 > $MYSQL_TMP_DIR/t1.dump
--exec $MYSQL_DUMP test --dump-history --tables t2 > $MYSQL_TMP_DIR/t2.dump
select * from t1;
droptable t1;
--echo # Loading t1 dump
--exec $MYSQL test < $MYSQL_TMP_DIR/t1.dump
select * from t1;
select * from t2;
droptable t2;
--echo # Loading t2 dump
--exec $MYSQL test < $MYSQL_TMP_DIR/t2.dump
select * from t2;
# Cleanup
droptable t1, t2;
bb-10.11-MDEV-16546 2b1d3242
select * from t1;
a f s e
1 bar 25 18446744073709551615
droptable t1;
# Loading t1 dump
select * from t1;
a f s e
1 bar 50 18446744073709551615
1 foo 50 18446744073709551615
select * from t2;
pk f s e
1 bar 38 18446744073709551615
droptable t2;
# Loading t2 dump
mysqltest: At line 22: execof'<basedir>/client//mysql --defaults-file=<basedir>/mysql-test/var/my.cnf test < <basedir>/mysql-test/var/tmp/t2.dump' failed, error: 256, status: 1, errno: 11
select * from t2;
pk f s e
Attachments
Issue Links
is caused by
MDEV-16029mysqldump: dump and restore historical data
Closed
relates to
MDEV-16546System versioning setting to allow history modification
After the fix 6ff8151111, mysqldump throws an error if it runs with --dump-history and encounters a precision-versioned table, and aborts or, in --force mode, proceeds and eventually exits with a non-zero code.
This all is fine, but when it proceeds with --force, it still dumps the history of a precision-versioned table, so the final dump will still have the same initial problem. It leaves no usable way to dump/load a database which contains a mix of temporal and precision-transaction versioned tables, especially if there are a lot of each kind and it's impractical to list them all explicitly.
I think it would make more sense if in --force mode, after throwing the error, mysqldump treated the precision-versioned table as a usual non-versioned table, doing normal SELECT and only dumping the current data.
Also, I think the error message could be improved. Now it is
bb-10.11-MDEV-16546 32090722c
mysqldump: Cannot use --dump-history for table `t1`
Since it's thrown in a specific case of precision-versioned table, there is no reason to make the user guess what the problem is, it would be better just say so, that it cannot use --dump-history because the table is precision-versioned (or whatever they are officially named). Also, a schema name would be nice.
Elena Stepanova
added a comment - - edited After the fix 6ff8151111 , mysqldump throws an error if it runs with --dump-history and encounters a precision-versioned table, and aborts or, in --force mode, proceeds and eventually exits with a non-zero code.
This all is fine, but when it proceeds with --force , it still dumps the history of a precision-versioned table, so the final dump will still have the same initial problem. It leaves no usable way to dump/load a database which contains a mix of temporal and precision-transaction versioned tables, especially if there are a lot of each kind and it's impractical to list them all explicitly.
I think it would make more sense if in --force mode, after throwing the error, mysqldump treated the precision-versioned table as a usual non-versioned table, doing normal SELECT and only dumping the current data.
Also, I think the error message could be improved. Now it is
bb-10.11-MDEV-16546 32090722c
mysqldump: Cannot use --dump-history for table `t1`
Since it's thrown in a specific case of precision-versioned table, there is no reason to make the user guess what the problem is, it would be better just say so, that it cannot use --dump-history because the table is precision-versioned (or whatever they are officially named). Also, a schema name would be nice.
no reason to make the user guess what the problem is — done
schema name would be nice — not done. there are many error messages in mysqldump and in get_table_structure() specifically, none includes a schema name. I can change them all at once, but only only one out of many.
Sergei Golubchik
added a comment -
treat as a usual non-versioned table — done
no reason to make the user guess what the problem is — done
schema name would be nice — not done. there are many error messages in mysqldump and in get_table_structure() specifically, none includes a schema name. I can change them all at once, but only only one out of many.
People
Sergei Golubchik
Elena Stepanova
Votes:
0Vote for this issue
Watchers:
2Start 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":1179.2000000476837,"ttfb":384.40000009536743,"pageVisibility":"visible","entityId":115301,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"26104505-7606-456d-bf6d-550943c3a954","navigationType":0,"readyForUser":1291.6000001430511,"redirectCount":0,"resourceLoadedEnd":1399.7000000476837,"resourceLoadedStart":389.7999999523163,"resourceTiming":[{"duration":268.30000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":389.7999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":389.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":658.1000001430511,"responseStart":0,"secureConnectionStart":0},{"duration":268.39999985694885,"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":390.10000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":390.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":658.5,"responseStart":0,"secureConnectionStart":0},{"duration":318.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":390.2000000476837,"connectEnd":390.2000000476837,"connectStart":390.2000000476837,"domainLookupEnd":390.2000000476837,"domainLookupStart":390.2000000476837,"fetchStart":390.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":390.2000000476837,"responseEnd":708.6000001430511,"responseStart":708.6000001430511,"secureConnectionStart":390.2000000476837},{"duration":385.2000000476837,"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":390.40000009536743,"connectEnd":390.40000009536743,"connectStart":390.40000009536743,"domainLookupEnd":390.40000009536743,"domainLookupStart":390.40000009536743,"fetchStart":390.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":390.40000009536743,"responseEnd":775.6000001430511,"responseStart":775.6000001430511,"secureConnectionStart":390.40000009536743},{"duration":389.39999985694885,"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":390.60000014305115,"connectEnd":390.60000014305115,"connectStart":390.60000014305115,"domainLookupEnd":390.60000014305115,"domainLookupStart":390.60000014305115,"fetchStart":390.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":390.60000014305115,"responseEnd":780,"responseStart":780,"secureConnectionStart":390.60000014305115},{"duration":389.90000009536743,"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":390.7000000476837,"connectEnd":390.7000000476837,"connectStart":390.7000000476837,"domainLookupEnd":390.7000000476837,"domainLookupStart":390.7000000476837,"fetchStart":390.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":390.7000000476837,"responseEnd":780.6000001430511,"responseStart":780.6000001430511,"secureConnectionStart":390.7000000476837},{"duration":389.90000009536743,"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":391,"connectEnd":391,"connectStart":391,"domainLookupEnd":391,"domainLookupStart":391,"fetchStart":391,"redirectEnd":0,"redirectStart":0,"requestStart":391,"responseEnd":780.9000000953674,"responseStart":780.9000000953674,"secureConnectionStart":391},{"duration":462.59999990463257,"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":391.2000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":391.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":853.7999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":390.10000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":391.2999999523163,"connectEnd":391.2999999523163,"connectStart":391.2999999523163,"domainLookupEnd":391.2999999523163,"domainLookupStart":391.2999999523163,"fetchStart":391.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":391.2999999523163,"responseEnd":781.4000000953674,"responseStart":781.2999999523163,"secureConnectionStart":391.2999999523163},{"duration":462.40000009536743,"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":391.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":391.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":853.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":390.2999999523163,"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":391.7000000476837,"connectEnd":391.7000000476837,"connectStart":391.7000000476837,"domainLookupEnd":391.7000000476837,"domainLookupStart":391.7000000476837,"fetchStart":391.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":391.7000000476837,"responseEnd":782,"responseStart":782,"secureConnectionStart":391.7000000476837},{"duration":768.7999999523163,"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":397.2000000476837,"connectEnd":397.2000000476837,"connectStart":397.2000000476837,"domainLookupEnd":397.2000000476837,"domainLookupStart":397.2000000476837,"fetchStart":397.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":397.2000000476837,"responseEnd":1166,"responseStart":1166,"secureConnectionStart":397.2000000476837},{"duration":923.5,"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":397.2999999523163,"connectEnd":397.2999999523163,"connectStart":397.2999999523163,"domainLookupEnd":397.2999999523163,"domainLookupStart":397.2999999523163,"fetchStart":397.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":397.2999999523163,"responseEnd":1320.7999999523163,"responseStart":1320.7999999523163,"secureConnectionStart":397.2999999523163},{"duration":300.80000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":865.7999999523163,"connectEnd":865.7999999523163,"connectStart":865.7999999523163,"domainLookupEnd":865.7999999523163,"domainLookupStart":865.7999999523163,"fetchStart":865.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":865.7999999523163,"responseEnd":1166.6000001430511,"responseStart":1166.6000001430511,"secureConnectionStart":865.7999999523163},{"duration":204.89999985694885,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1172.1000001430511,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1172.1000001430511,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1377,"responseStart":0,"secureConnectionStart":0},{"duration":181.60000014305115,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1195,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1195,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1376.6000001430511,"responseStart":0,"secureConnectionStart":0},{"duration":203.79999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1195.9000000953674,"connectEnd":1195.9000000953674,"connectStart":1195.9000000953674,"domainLookupEnd":1195.9000000953674,"domainLookupStart":1195.9000000953674,"fetchStart":1195.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":1195.9000000953674,"responseEnd":1399.7000000476837,"responseStart":1399.7000000476837,"secureConnectionStart":1195.9000000953674},{"duration":225.89999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/097ae97cb8fbec7d6ea4bbb1f26955b9-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":1196.4000000953674,"connectEnd":1196.4000000953674,"connectStart":1196.4000000953674,"domainLookupEnd":1196.4000000953674,"domainLookupStart":1196.4000000953674,"fetchStart":1196.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":1196.4000000953674,"responseEnd":1422.2999999523163,"responseStart":1422.2999999523163,"secureConnectionStart":1196.4000000953674}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":204,"responseStart":385,"responseEnd":389,"domLoading":388,"domInteractive":1415,"domContentLoadedEventStart":1415,"domContentLoadedEventEnd":1461,"domComplete":1678,"loadEventStart":1678,"loadEventEnd":1679,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1381.5},{"name":"bigPipe.sidebar-id.end","time":1382.2999999523163},{"name":"bigPipe.activity-panel-pipe-id.start","time":1382.4000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":1385.7000000476837},{"name":"activityTabFullyLoaded","time":1478.1000001430511}],"measures":[],"correlationId":"2e22d600cef313","effectiveType":"4g","downlink":9,"rtt":0,"serverDuration":113,"dbReadsTimeInMs":15,"dbConnsTimeInMs":24,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
After the fix 6ff8151111, mysqldump throws an error if it runs with --dump-history and encounters a precision-versioned table, and aborts or, in --force mode, proceeds and eventually exits with a non-zero code.
This all is fine, but when it proceeds with --force, it still dumps the history of a precision-versioned table, so the final dump will still have the same initial problem. It leaves no usable way to dump/load a database which contains a mix of temporal and precision-transaction versioned tables, especially if there are a lot of each kind and it's impractical to list them all explicitly.
I think it would make more sense if in --force mode, after throwing the error, mysqldump treated the precision-versioned table as a usual non-versioned table, doing normal SELECT and only dumping the current data.
Also, I think the error message could be improved. Now it is
bb-10.11-MDEV-16546 32090722c
mysqldump: Cannot use --dump-history for table `t1`
Since it's thrown in a specific case of precision-versioned table, there is no reason to make the user guess what the problem is, it would be better just say so, that it cannot use --dump-history because the table is precision-versioned (or whatever they are officially named). Also, a schema name would be nice.