Isolation Level: Read Uncommitted & Read Committed.
The behaviors of UPDATE for different rows are inconsistent. Just some of the rows are not updated while others are.
/* init */ drop table if exists t;
|
/* init */ create table t(a int, b int);
|
/* init */ insert into t values(null, 1), (2, 2), (null, null), (null, 3), (4, null);
|
|
/* s1 */ begin;
|
/* s1 */ update t set a = 10 where 1;
|
/* s2 */ begin;
|
/* s2 */ update t set b = 20 where a; -- blocked
|
/* s1 */ commit; -- s2 unblocked
|
/* s2 */ commit;
|
|
select * from t;
|
|
+------+------+
|
| a | b |
|
+------+------+
|
| 10 | 1 |
|
| 10 | 20 |
|
| 10 | 20 |
|
| 10 | 20 |
|
| 10 | 20 |
|
+------+------+
|
The field b of the first row is not updated but other rows are updated.
After several attempts, I found that the results depend on the distribution of the data in the table rather than the timing.
If the initial table is like:
+------+------+
|
| a | b |
|
+------+------+
|
| 1 | 1 |
|
| 2 | 2 |
|
| null | null |
|
| null | 3 |
|
| 4 | null |
|
+------+------+
|
then, the result will be
+------+------+
|
| a | b |
|
+------+------+
|
| 10 | 20 |
|
| 10 | 20 |
|
| 10 | 20 |
|
| 10 | 20 |
|
| 10 | 20 |
|
+------+------+
|
More specifically, if there exists a row whose column `a` is not NULL, and it is the first record from top to bottom whose column `a` is not NULL. Then, all rows before it with a NULL column `a` will not be updated, while all rows after it with a NULL column `a` will be updated. This means that even the execution of a single statement is not atomic.
This bug can be reproduced under Read Uncommitted and Read Committed.
{"report":{"fcp":1735.6000003814697,"ttfb":528.1000003814697,"pageVisibility":"visible","entityId":102859,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"1303eef6-e815-4207-93a7-16631db1f7ee","navigationType":0,"readyForUser":1855.9000000953674,"redirectCount":0,"resourceLoadedEnd":2177.5,"resourceLoadedStart":536.1000003814697,"resourceTiming":[{"duration":615.1999998092651,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":536.1000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":536.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1151.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":616.9000000953674,"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":536.4000000953674,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":536.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1153.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":682,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":536.6000003814697,"connectEnd":536.6000003814697,"connectStart":536.6000003814697,"domainLookupEnd":536.6000003814697,"domainLookupStart":536.6000003814697,"fetchStart":536.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":536.6000003814697,"responseEnd":1218.6000003814697,"responseStart":1218.6000003814697,"secureConnectionStart":536.6000003814697},{"duration":848.5999999046326,"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":536.7000002861023,"connectEnd":536.7000002861023,"connectStart":536.7000002861023,"domainLookupEnd":536.7000002861023,"domainLookupStart":536.7000002861023,"fetchStart":536.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":536.7000002861023,"responseEnd":1385.3000001907349,"responseStart":1385.3000001907349,"secureConnectionStart":536.7000002861023},{"duration":852.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":536.9000000953674,"connectEnd":536.9000000953674,"connectStart":536.9000000953674,"domainLookupEnd":536.9000000953674,"domainLookupStart":536.9000000953674,"fetchStart":536.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":536.9000000953674,"responseEnd":1389.8000001907349,"responseStart":1389.8000001907349,"secureConnectionStart":536.9000000953674},{"duration":853.0999999046326,"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":537.1000003814697,"connectEnd":537.1000003814697,"connectStart":537.1000003814697,"domainLookupEnd":537.1000003814697,"domainLookupStart":537.1000003814697,"fetchStart":537.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":537.1000003814697,"responseEnd":1390.2000002861023,"responseStart":1390.2000002861023,"secureConnectionStart":537.1000003814697},{"duration":853.4000000953674,"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":537.3000001907349,"connectEnd":537.3000001907349,"connectStart":537.3000001907349,"domainLookupEnd":537.3000001907349,"domainLookupStart":537.3000001907349,"fetchStart":537.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":537.3000001907349,"responseEnd":1390.7000002861023,"responseStart":1390.7000002861023,"secureConnectionStart":537.3000001907349},{"duration":863.9000000953674,"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":537.4000000953674,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":537.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1401.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":853.5999999046326,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":537.6000003814697,"connectEnd":537.6000003814697,"connectStart":537.6000003814697,"domainLookupEnd":537.6000003814697,"domainLookupStart":537.6000003814697,"fetchStart":537.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":537.6000003814697,"responseEnd":1391.2000002861023,"responseStart":1391.2000002861023,"secureConnectionStart":537.6000003814697},{"duration":863.6999998092651,"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":537.8000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":537.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1401.5,"responseStart":0,"secureConnectionStart":0},{"duration":854.3000001907349,"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":537.9000000953674,"connectEnd":537.9000000953674,"connectStart":537.9000000953674,"domainLookupEnd":537.9000000953674,"domainLookupStart":537.9000000953674,"fetchStart":537.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":537.9000000953674,"responseEnd":1392.2000002861023,"responseStart":1392.2000002861023,"secureConnectionStart":537.9000000953674},{"duration":1637.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":539.3000001907349,"connectEnd":539.3000001907349,"connectStart":539.3000001907349,"domainLookupEnd":539.3000001907349,"domainLookupStart":539.3000001907349,"fetchStart":539.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":539.3000001907349,"responseEnd":2177,"responseStart":2176.9000000953674,"secureConnectionStart":539.3000001907349},{"duration":1632.5999999046326,"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":544.9000000953674,"connectEnd":544.9000000953674,"connectStart":544.9000000953674,"domainLookupEnd":544.9000000953674,"domainLookupStart":544.9000000953674,"fetchStart":544.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":544.9000000953674,"responseEnd":2177.5,"responseStart":2177.5,"secureConnectionStart":544.9000000953674},{"duration":367.80000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1376.9000000953674,"connectEnd":1376.9000000953674,"connectStart":1376.9000000953674,"domainLookupEnd":1376.9000000953674,"domainLookupStart":1376.9000000953674,"fetchStart":1376.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":1376.9000000953674,"responseEnd":1744.7000002861023,"responseStart":1744.7000002861023,"secureConnectionStart":1376.9000000953674},{"duration":564.4000000953674,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1723.8000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1723.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":2288.2000002861023,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":327,"responseStart":528,"responseEnd":541,"domLoading":533,"domInteractive":2225,"domContentLoadedEventStart":2225,"domContentLoadedEventEnd":2283,"domComplete":2952,"loadEventStart":2952,"loadEventEnd":2953,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":2187},{"name":"bigPipe.sidebar-id.end","time":2187.9000000953674},{"name":"bigPipe.activity-panel-pipe-id.start","time":2188},{"name":"bigPipe.activity-panel-pipe-id.end","time":2194.800000190735},{"name":"activityTabFullyLoaded","time":2303.800000190735}],"measures":[],"correlationId":"6f68e0bc869b4b","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":133,"dbReadsTimeInMs":19,"dbConnsTimeInMs":28,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
This bug can also be reproduced in MySQL and has been verified by MySQL Verification Team.
https://bugs.mysql.com/bug.php?id=104833