Partitions get corrupted: internal error 160.
Unable to repair (with Alter table).
Symptom: The AutoIncrement value goes wild (from a few thousand, to numbers with 20+ digits).
Viewing an allegedly uncorrupted partition shows extremely distorted data.
Fault appears to follow adding a new partition (partitions by date) although the new
partition is for a future date, so not yet used.
Only fix discovered, so far, is to drop the table.
Not yet isolated the exact trigger.
Tables schema: ARIA ROW_FORMAT=PAGE TRANSACTIONAL=1 PAGE_CHECKSUM=1
(FYI: same application code using MyISAM does not fail)
What causes internal error 160?
Given my test case, I suppose the combination of indexes was important there, otherwise I would have removed unnecessary ones. It's most likely not the only combination which contributes to the failure, but it might be the factor that makes some of your tables get corrupted while others remain intact.
Elena Stepanova
added a comment - Given my test case, I suppose the combination of indexes was important there, otherwise I would have removed unnecessary ones. It's most likely not the only combination which contributes to the failure, but it might be the factor that makes some of your tables get corrupted while others remain intact.
So, hopes high, I tried removing all indices, except the pk. No improvement. All my tables have the same pk. Pity!
Is this row,date pk the issue?
Andy Middleton
added a comment - So, hopes high, I tried removing all indices, except the pk. No improvement. All my tables have the same pk. Pity!
Is this row,date pk the issue?
You are right. Even with different keys, there is still corruption (with my test case too), it just looked less obvious, easier to miss, e.g. if I remove the secondary index and replace PK with UNIQUE, I get this:
CREATETABLE t1 (
pk BIGINTNOTNULL AUTO_INCREMENT,
dt DATETIME DEFAULTNULL,
UNIQUE (pk, dt)
) ENGINE=Aria ROW_FORMAT=PAGE
PARTITION BY RANGE COLUMNS(dt) (
PARTITION `P20171231` VALUES LESS THAN ('2017-12-31'),
PARTITION `P20181231` VALUES LESS THAN ('2018-12-31')
);
INSERTINTO t1 VALUES (1,'2017-09-28 15:12:00');
MariaDB [test]> SELECT * FROM t1;
+----+---------------------+
| pk | dt |
+----+---------------------+
| 1 | 2017-09-28 15:12:00 |
+----+---------------------+
1 row inset (0.00 sec)
MariaDB [test]> ALTERTABLE t1 DROP PARTITION P20181231;
Query OK, 0 rows affected (0.55 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [test]> SELECT * FROM t1;
+----+------+
| pk | dt |
+----+------+
| 1 | NULL |
+----+------+
1 row inset (0.00 sec)
So yes, if you can afford altering tables, the best chance is replacing ROW_FORMAT=PAGE with e.g. ROW_FORMAT=FIXED.
Elena Stepanova
added a comment - You are right. Even with different keys, there is still corruption (with my test case too), it just looked less obvious, easier to miss, e.g. if I remove the secondary index and replace PK with UNIQUE, I get this:
CREATE TABLE t1 (
pk BIGINT NOT NULL AUTO_INCREMENT,
dt DATETIME DEFAULT NULL ,
UNIQUE (pk, dt)
) ENGINE=Aria ROW_FORMAT=PAGE
PARTITION BY RANGE COLUMNS(dt) (
PARTITION `P20171231` VALUES LESS THAN ( '2017-12-31' ),
PARTITION `P20181231` VALUES LESS THAN ( '2018-12-31' )
);
INSERT INTO t1 VALUES (1, '2017-09-28 15:12:00' );
MariaDB [test]> SELECT * FROM t1;
+ ----+---------------------+
| pk | dt |
+ ----+---------------------+
| 1 | 2017-09-28 15:12:00 |
+ ----+---------------------+
1 row in set (0.00 sec)
MariaDB [test]> ALTER TABLE t1 DROP PARTITION P20181231;
Query OK, 0 rows affected (0.55 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [test]> SELECT * FROM t1;
+ ----+------+
| pk | dt |
+ ----+------+
| 1 | NULL |
+ ----+------+
1 row in set (0.00 sec)
So yes, if you can afford altering tables, the best chance is replacing ROW_FORMAT=PAGE with e.g. ROW_FORMAT=FIXED .
Thanks, but I particularly wanted "crash proof" tables: According to this page: https://mariadb.com/kb/en/library/aria-faq/
"In the current development phase Aria tables created with TRANSACTIONAL=1 are crashsafe":
But setting that forces "Page" format. "Fixed" behaves like MyISAM, I believe, and won't help me survive those pesky bugchecks/inquistive finger resets.
What I don't know; is ARIA in "fixed" still better than MyISAM?
Am I the only person using ARIA with partitions for logging time based data? ooohh, the excitement!
Andy Middleton
added a comment - Thanks, but I particularly wanted "crash proof" tables: According to this page: https://mariadb.com/kb/en/library/aria-faq/
"In the current development phase Aria tables created with TRANSACTIONAL=1 are crashsafe":
But setting that forces "Page" format. "Fixed" behaves like MyISAM, I believe, and won't help me survive those pesky bugchecks/inquistive finger resets.
What I don't know; is ARIA in "fixed" still better than MyISAM?
Am I the only person using ARIA with partitions for logging time based data? ooohh, the excitement!
I don't see it in the KB though, greenman, could you please make sure the limitation is documented?
Elena Stepanova
added a comment - The thing is, TRANSACTIONAL=1 is not supported for partitioned tables, so you are probably not getting much out of it anyway:
MariaDB [test]> create table t1 (a int ) engine=Aria transactional=1 partition by hash(a) partitions 2;
Query OK, 0 rows affected, 1 warning (0.67 sec)
MariaDB [test]> show warnings;
+ ---------+------+---------------------------------------------------------------------------------------+
| Level | Code | Message |
+ ---------+------+---------------------------------------------------------------------------------------+
| Warning | 1478 | Table storage engine 'partition' does not support the create option 'TRANSACTIONAL=1' |
+ ---------+------+---------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
I don't see it in the KB though, greenman , could you please make sure the limitation is documented?
People
Sergei Golubchik
Andy Middleton
Votes:
0Vote for this issue
Watchers:
3Start 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":823.0999994277954,"ttfb":207.5,"pageVisibility":"visible","entityId":63392,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"2fa3d928-b085-4acd-9894-b43e8308f608","navigationType":0,"readyForUser":893.7999992370605,"redirectCount":0,"resourceLoadedEnd":1058.3999996185303,"resourceLoadedStart":213.29999923706055,"resourceTiming":[{"duration":72.40000057220459,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":213.29999923706055,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":213.29999923706055,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":285.69999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":72.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/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":213.5999994277954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":213.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":286.0999994277954,"responseStart":0,"secureConnectionStart":0},{"duration":126.90000057220459,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":213.79999923706055,"connectEnd":213.79999923706055,"connectStart":213.79999923706055,"domainLookupEnd":213.79999923706055,"domainLookupStart":213.79999923706055,"fetchStart":213.79999923706055,"redirectEnd":0,"redirectStart":0,"requestStart":213.79999923706055,"responseEnd":340.69999980926514,"responseStart":340.69999980926514,"secureConnectionStart":213.79999923706055},{"duration":218.60000038146973,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/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":213.89999961853027,"connectEnd":213.89999961853027,"connectStart":213.89999961853027,"domainLookupEnd":213.89999961853027,"domainLookupStart":213.89999961853027,"fetchStart":213.89999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":213.89999961853027,"responseEnd":432.5,"responseStart":432.5,"secureConnectionStart":213.89999961853027},{"duration":222.19999980926514,"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":214.0999994277954,"connectEnd":214.0999994277954,"connectStart":214.0999994277954,"domainLookupEnd":214.0999994277954,"domainLookupStart":214.0999994277954,"fetchStart":214.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":214.0999994277954,"responseEnd":436.29999923706055,"responseStart":436.29999923706055,"secureConnectionStart":214.0999994277954},{"duration":222.4000005722046,"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":214.29999923706055,"connectEnd":214.29999923706055,"connectStart":214.29999923706055,"domainLookupEnd":214.29999923706055,"domainLookupStart":214.29999923706055,"fetchStart":214.29999923706055,"redirectEnd":0,"redirectStart":0,"requestStart":214.29999923706055,"responseEnd":436.69999980926514,"responseStart":436.69999980926514,"secureConnectionStart":214.29999923706055},{"duration":222.5999994277954,"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":214.5,"connectEnd":214.5,"connectStart":214.5,"domainLookupEnd":214.5,"domainLookupStart":214.5,"fetchStart":214.5,"redirectEnd":0,"redirectStart":0,"requestStart":214.5,"responseEnd":437.0999994277954,"responseStart":437.0999994277954,"secureConnectionStart":214.5},{"duration":269.1000003814697,"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":214.5999994277954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":214.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":483.69999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":222.70000076293945,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":214.79999923706055,"connectEnd":214.79999923706055,"connectStart":214.79999923706055,"domainLookupEnd":214.79999923706055,"domainLookupStart":214.79999923706055,"fetchStart":214.79999923706055,"redirectEnd":0,"redirectStart":0,"requestStart":214.79999923706055,"responseEnd":437.5,"responseStart":437.5,"secureConnectionStart":214.79999923706055},{"duration":269,"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":214.89999961853027,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":214.89999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":483.8999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":223,"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":215.0999994277954,"connectEnd":215.0999994277954,"connectStart":215.0999994277954,"domainLookupEnd":215.0999994277954,"domainLookupStart":215.0999994277954,"fetchStart":215.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":215.0999994277954,"responseEnd":438.0999994277954,"responseStart":438.0999994277954,"secureConnectionStart":215.0999994277954},{"duration":841.1999998092651,"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":216,"connectEnd":216,"connectStart":216,"domainLookupEnd":216,"domainLookupStart":216,"fetchStart":216,"redirectEnd":0,"redirectStart":0,"requestStart":216,"responseEnd":1057.1999998092651,"responseStart":1057.1999998092651,"secureConnectionStart":216},{"duration":838.1000003814697,"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":220.29999923706055,"connectEnd":220.29999923706055,"connectStart":220.29999923706055,"domainLookupEnd":220.29999923706055,"domainLookupStart":220.29999923706055,"fetchStart":220.29999923706055,"redirectEnd":0,"redirectStart":0,"requestStart":220.29999923706055,"responseEnd":1058.3999996185303,"responseStart":1058.3999996185303,"secureConnectionStart":220.29999923706055},{"duration":106.29999923706055,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":495.5,"connectEnd":495.5,"connectStart":495.5,"domainLookupEnd":495.5,"domainLookupStart":495.5,"fetchStart":495.5,"redirectEnd":0,"redirectStart":0,"requestStart":495.5,"responseEnd":601.7999992370605,"responseStart":601.7999992370605,"secureConnectionStart":495.5}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":43,"responseStart":207,"responseEnd":212,"domLoading":210,"domInteractive":1090,"domContentLoadedEventStart":1090,"domContentLoadedEventEnd":1137,"domComplete":1740,"loadEventStart":1740,"loadEventEnd":1741,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1062.1999998092651},{"name":"bigPipe.sidebar-id.end","time":1063.0999994277954},{"name":"bigPipe.activity-panel-pipe-id.start","time":1063.2999992370605},{"name":"bigPipe.activity-panel-pipe-id.end","time":1066.3999996185303},{"name":"activityTabFullyLoaded","time":1154.1999998092651}],"measures":[],"correlationId":"602c91cc2d9a56","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":103,"dbReadsTimeInMs":9,"dbConnsTimeInMs":17,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Given my test case, I suppose the combination of indexes was important there, otherwise I would have removed unnecessary ones. It's most likely not the only combination which contributes to the failure, but it might be the factor that makes some of your tables get corrupted while others remain intact.