MDEV-14168 changed behaviour in an undesired way. If the test of the feature is executed on MariaDB Server 10.2 or earlier, it will fail:
CURRENT_TEST: innodb.alter_not_null
|
mysqltest: At line 8: query 'ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL' failed: 1138: Invalid use of NULL value
|
If I change the statement to use ALGORITHM=COPY, it will fail with a different message (in both 10.2 and 10.3):
CURRENT_TEST: innodb.alter_not_null
|
mysqltest: At line 8: query 'ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL, ALGORITHM=COPY' failed: 1265: Data truncated for column 'f1' at row 1
|
The invariant should be that ALGORITHM=INPLACE and ALGORITHM=COPY produce the same result. After MDEV-14168, ALGORITHM=INPLACE would incorrectly convert the NULL value to the implicit default value 0 of the INT data type.
With SQL_MODE='' (not STRICT_TRANS_TABLES), warnings would be reported for each row in ALGORITHM=COPY:
+ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL, ALGORITHM=COPY;
|
+affected rows: 1
|
+info: Records: 1 Duplicates: 0 Warnings: 1
|
+Warnings:
|
+Warning 1265 Data truncated for column 'f1' at row 1
|
Similarly, warnings will be reported by ALTER IGNORE TABLE, also for SQL_MODE='STRICT_TRANS_TABLES' values.
I think that ALGORITHM=INPLACE should be fixed so that it will report errors or warnings for the affected rows.
As part of the fix, the following code (which I expected MDEV-14168 to remove) should be removed:
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
|
index 769eced242c..94545321052 100644
|
--- a/storage/innobase/handler/handler0alter.cc
|
+++ b/storage/innobase/handler/handler0alter.cc
|
@@ -913,18 +913,6 @@ ha_innobase::check_if_supported_inplace_alter(
|
DBUG_RETURN(HA_ALTER_INPLACE_INSTANT);
|
}
|
|
- /* Only support NULL -> NOT NULL change if strict table sql_mode
|
- is set. Fall back to COPY for conversion if not strict tables.
|
- In-Place will fail with an error when trying to convert
|
- NULL to a NOT NULL value. */
|
- if ((ha_alter_info->handler_flags
|
- & ALTER_COLUMN_NOT_NULLABLE)
|
- && !thd_is_strict_mode(m_user_thd)) {
|
- ha_alter_info->unsupported_reason = my_get_err_msg(
|
- ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL);
|
- DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
|
- }
|
-
|
/* DROP PRIMARY KEY is only allowed in combination with ADD
|
PRIMARY KEY. */
|
if ((ha_alter_info->handler_flags
|
{"report":{"fcp":2426.800000190735,"ttfb":264.5,"pageVisibility":"visible","entityId":67904,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":32,"apdex":0.5,"journeyId":"b2c3be34-3ab5-46ae-81b0-b769649e9947","navigationType":0,"readyForUser":2626,"redirectCount":0,"resourceLoadedEnd":3388.2000002861023,"resourceLoadedStart":271.09999990463257,"resourceTiming":[{"duration":1166.4000000953674,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":271.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":271.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1437.5,"responseStart":0,"secureConnectionStart":0},{"duration":1166.7999997138977,"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":271.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":271.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1438.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":1184,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":271.59999990463257,"connectEnd":271.59999990463257,"connectStart":271.59999990463257,"domainLookupEnd":271.59999990463257,"domainLookupStart":271.59999990463257,"fetchStart":271.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":271.59999990463257,"responseEnd":1455.5999999046326,"responseStart":1455.5999999046326,"secureConnectionStart":271.59999990463257},{"duration":1273.6999998092651,"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":271.80000019073486,"connectEnd":271.80000019073486,"connectStart":271.80000019073486,"domainLookupEnd":271.80000019073486,"domainLookupStart":271.80000019073486,"fetchStart":271.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":271.80000019073486,"responseEnd":1545.5,"responseStart":1545.5,"secureConnectionStart":271.80000019073486},{"duration":1283.9000000953674,"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":272,"connectEnd":272,"connectStart":272,"domainLookupEnd":272,"domainLookupStart":272,"fetchStart":272,"redirectEnd":0,"redirectStart":0,"requestStart":272,"responseEnd":1555.9000000953674,"responseStart":1555.9000000953674,"secureConnectionStart":272},{"duration":1285,"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":272.2000002861023,"connectEnd":272.2000002861023,"connectStart":272.2000002861023,"domainLookupEnd":272.2000002861023,"domainLookupStart":272.2000002861023,"fetchStart":272.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":272.2000002861023,"responseEnd":1557.2000002861023,"responseStart":1557.2000002861023,"secureConnectionStart":272.2000002861023},{"duration":1286.1999998092651,"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":272.40000009536743,"connectEnd":272.40000009536743,"connectStart":272.40000009536743,"domainLookupEnd":272.40000009536743,"domainLookupStart":272.40000009536743,"fetchStart":272.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":272.40000009536743,"responseEnd":1558.5999999046326,"responseStart":1558.5999999046326,"secureConnectionStart":272.40000009536743},{"duration":1498.6000003814697,"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":272.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":272.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1771.2000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":1286.4000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":272.80000019073486,"connectEnd":272.80000019073486,"connectStart":272.80000019073486,"domainLookupEnd":272.80000019073486,"domainLookupStart":272.80000019073486,"fetchStart":272.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":272.80000019073486,"responseEnd":1559.2000002861023,"responseStart":1559.2000002861023,"secureConnectionStart":272.80000019073486},{"duration":1497.8999996185303,"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":273.7000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":273.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1771.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":1285.9000000953674,"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":274,"connectEnd":274,"connectStart":274,"domainLookupEnd":274,"domainLookupStart":274,"fetchStart":274,"redirectEnd":0,"redirectStart":0,"requestStart":274,"responseEnd":1559.9000000953674,"responseStart":1559.9000000953674,"secureConnectionStart":274},{"duration":3102,"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":281.5,"connectEnd":281.5,"connectStart":281.5,"domainLookupEnd":281.5,"domainLookupStart":281.5,"fetchStart":281.5,"redirectEnd":0,"redirectStart":0,"requestStart":281.5,"responseEnd":3383.5,"responseStart":3383.5,"secureConnectionStart":281.5},{"duration":3106.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":281.59999990463257,"connectEnd":281.59999990463257,"connectStart":281.59999990463257,"domainLookupEnd":281.59999990463257,"domainLookupStart":281.59999990463257,"fetchStart":281.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":281.59999990463257,"responseEnd":3388.2000002861023,"responseStart":3388.2000002861023,"secureConnectionStart":281.59999990463257},{"duration":848.3000001907349,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1828.4000000953674,"connectEnd":1828.4000000953674,"connectStart":1828.4000000953674,"domainLookupEnd":1828.4000000953674,"domainLookupStart":1828.4000000953674,"fetchStart":1828.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":1828.4000000953674,"responseEnd":2676.7000002861023,"responseStart":2676.7000002861023,"secureConnectionStart":1828.4000000953674}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":107,"responseStart":264,"responseEnd":274,"domLoading":269,"domInteractive":3419,"domContentLoadedEventStart":3419,"domContentLoadedEventEnd":3481,"domComplete":4899,"loadEventStart":4899,"loadEventEnd":4901,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":3397.5999999046326},{"name":"bigPipe.sidebar-id.end","time":3398.5},{"name":"bigPipe.activity-panel-pipe-id.start","time":3398.800000190735},{"name":"bigPipe.activity-panel-pipe-id.end","time":3401.4000000953674},{"name":"activityTabFullyLoaded","time":3488.2000002861023}],"measures":[],"correlationId":"706db5701d12d8","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":95,"dbReadsTimeInMs":12,"dbConnsTimeInMs":21,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}