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":1275,"ttfb":466,"pageVisibility":"visible","entityId":67904,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"4341af51-4631-41a4-bc55-3e6e6fd80b5b","navigationType":0,"readyForUser":1362.8000001907349,"redirectCount":0,"resourceLoadedEnd":1400.3000001907349,"resourceLoadedStart":474.80000019073486,"resourceTiming":[{"duration":253.7999997138977,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":474.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":474.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":728.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":254.30000019073486,"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":475,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":475,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":729.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":311.6000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":475.19999980926514,"connectEnd":475.19999980926514,"connectStart":475.19999980926514,"domainLookupEnd":475.19999980926514,"domainLookupStart":475.19999980926514,"fetchStart":475.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":475.19999980926514,"responseEnd":786.8000001907349,"responseStart":786.8000001907349,"secureConnectionStart":475.19999980926514},{"duration":398.19999980926514,"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":475.40000009536743,"connectEnd":475.40000009536743,"connectStart":475.40000009536743,"domainLookupEnd":475.40000009536743,"domainLookupStart":475.40000009536743,"fetchStart":475.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":475.40000009536743,"responseEnd":873.5999999046326,"responseStart":873.5999999046326,"secureConnectionStart":475.40000009536743},{"duration":402.09999990463257,"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":475.59999990463257,"connectEnd":475.59999990463257,"connectStart":475.59999990463257,"domainLookupEnd":475.59999990463257,"domainLookupStart":475.59999990463257,"fetchStart":475.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":475.59999990463257,"responseEnd":877.6999998092651,"responseStart":877.6999998092651,"secureConnectionStart":475.59999990463257},{"duration":402.3999996185303,"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":475.80000019073486,"connectEnd":475.80000019073486,"connectStart":475.80000019073486,"domainLookupEnd":475.80000019073486,"domainLookupStart":475.80000019073486,"fetchStart":475.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":475.80000019073486,"responseEnd":878.1999998092651,"responseStart":878.1999998092651,"secureConnectionStart":475.80000019073486},{"duration":402.59999990463257,"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":476,"connectEnd":476,"connectStart":476,"domainLookupEnd":476,"domainLookupStart":476,"fetchStart":476,"redirectEnd":0,"redirectStart":0,"requestStart":476,"responseEnd":878.5999999046326,"responseStart":878.5999999046326,"secureConnectionStart":476},{"duration":464.7000002861023,"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":476.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":476.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":940.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":402.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":476.40000009536743,"connectEnd":476.40000009536743,"connectStart":476.40000009536743,"domainLookupEnd":476.40000009536743,"domainLookupStart":476.40000009536743,"fetchStart":476.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":476.40000009536743,"responseEnd":879.0999999046326,"responseStart":879.0999999046326,"secureConnectionStart":476.40000009536743},{"duration":464.5,"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":476.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":476.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":941,"responseStart":0,"secureConnectionStart":0},{"duration":403,"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":476.69999980926514,"connectEnd":476.69999980926514,"connectStart":476.69999980926514,"domainLookupEnd":476.69999980926514,"domainLookupStart":476.69999980926514,"fetchStart":476.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":476.69999980926514,"responseEnd":879.6999998092651,"responseStart":879.6999998092651,"secureConnectionStart":476.69999980926514},{"duration":920.6999998092651,"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":477.80000019073486,"connectEnd":477.80000019073486,"connectStart":477.80000019073486,"domainLookupEnd":477.80000019073486,"domainLookupStart":477.80000019073486,"fetchStart":477.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":477.80000019073486,"responseEnd":1398.5,"responseStart":1398.5,"secureConnectionStart":477.80000019073486},{"duration":922.4000000953674,"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":477.90000009536743,"connectEnd":477.90000009536743,"connectStart":477.90000009536743,"domainLookupEnd":477.90000009536743,"domainLookupStart":477.90000009536743,"fetchStart":477.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":477.90000009536743,"responseEnd":1400.3000001907349,"responseStart":1400.3000001907349,"secureConnectionStart":477.90000009536743},{"duration":334.1000003814697,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":957.6999998092651,"connectEnd":957.6999998092651,"connectStart":957.6999998092651,"domainLookupEnd":957.6999998092651,"domainLookupStart":957.6999998092651,"fetchStart":957.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":957.6999998092651,"responseEnd":1291.8000001907349,"responseStart":1291.8000001907349,"secureConnectionStart":957.6999998092651},{"duration":191.69999980926514,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1268.3000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1268.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1460,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":299,"responseStart":466,"responseEnd":467,"domLoading":473,"domInteractive":1464,"domContentLoadedEventStart":1464,"domContentLoadedEventEnd":1513,"domComplete":2839,"loadEventStart":2839,"loadEventEnd":2841,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1440.8000001907349},{"name":"bigPipe.sidebar-id.end","time":1441.6999998092651},{"name":"bigPipe.activity-panel-pipe-id.start","time":1441.9000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":1444.8000001907349},{"name":"activityTabFullyLoaded","time":1562.1999998092651}],"measures":[],"correlationId":"2042a39f2f29e4","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":102,"dbReadsTimeInMs":14,"dbConnsTimeInMs":23,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}