When I tested serializable isolation levels on Mariadb, I found a write skew exception.
The test cases and results are as follows.
The execution demonstrates a write skew exception (A5B: r1[x] ... .r2[y] ... .w1[y] ... .w2[x] ... (c1 and c2 occur), ANSI).
Also, the result of this execution contains a circle of read-write dependencies, which is against the serializable isolation level.
In other words, the two concurrent transactions are not equivalent to the result of the serialized execution of the transaction. This is a contradiction to the definition of serializability.
Therefore, it seems to me that this is a logical bug for the isolation level.
--- session 0 ---
CREATE TABLE tYv10enE (ID INT AUTO_INCREMENT UNIQUE , VAL INT , c0 INT NULL UNIQUE KEY );
INSERT INTO tYv10enE (VAL, c0) VALUES ((ROUND (RAND() * 100000)), 10989748);
INSERT INTO tYv10enE (VAL, c0) VALUES ((ROUND (RAND() * 100000)), -1404643822);
INSERT INTO tYv10enE (VAL, c0) VALUES ((ROUND (RAND() * 100000)), -335483076);
INSERT INTO tYv10enE (VAL, c0) VALUES ((ROUND (RAND() * 100000)), 942162931);
--- session 1 ---
BEGIN ;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE ;
--- session 2 ---
BEGIN ;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE ;
--- session 1 ---
BEGIN ;
--- session 2 ---
BEGIN ;
--- session 1 ---
SELECT * FROM tYv10enE WHERE (! ((1) | (1))) OR ( c0 <= 1 );
+ ----+-------+-------------+
| ID | VAL | c0 |
+ ----+-------+-------------+
| 2 | 58093 | -1404643822 |
| 3 | 67578 | -335483076 |
+ ----+-------+-------------+
2 rows in set (0.00 sec)
--- session 2 ---
SELECT * FROM tYv10enE WHERE ((1) | (0)) IS UNKNOWN OR ( c0 >= 889101988 );
+ ----+-------+-----------+
| ID | VAL | c0 |
+ ----+-------+-----------+
| 4 | 63609 | 942162931 |
+ ----+-------+-----------+
1 row in set (0.00 sec)
--- session 1 ---
DELETE FROM tYv10enE WHERE FALSE OR ( c0 >= 889101988 );
Query OK, 1 row affected (0.00 sec)
--- session 2 ---
DELETE FROM tYv10enE WHERE FALSE OR ( c0 <= 1 );
Query OK, 2 rows affected (0.00 sec)
--- session 1 ---
COMMIT ;
--- session 2 ---
COMMIT ;
Sergei Golubchik
made changes -
2024-11-13 19:21
Assignee
Sergei Golubchik
[ serg
]
Sergei Golubchik
made changes -
2024-11-13 19:25
Summary
Write skew exception at serializable isolation level
implicit commit at START TRANSACTION doesn't reset characteristics
Sergei Golubchik
made changes -
2024-11-13 19:35
Status
Open
[ 1
]
In Progress
[ 3
]
Sergei Golubchik
made changes -
2024-11-13 19:35
Status
In Progress
[ 3
]
Stalled
[ 10000
]
Sergei Golubchik
made changes -
2024-11-14 18:30
Status
Stalled
[ 10000
]
In Testing
[ 10301
]
Sergei Golubchik
made changes -
2025-01-09 11:18
Component/s
Server
[ 13907
]
Fix Version/s
10.6.21
[ 29953
]
Fix Version/s
10.11.11
[ 29954
]
Fix Version/s
11.4.5
[ 29956
]
Fix Version/s
11.7.2
[ 29914
]
Fix Version/s
10.6
[ 24028
]
Resolution
Fixed
[ 1
]
Status
In Testing
[ 10301
]
Closed
[ 6
]
{"report":{"fcp":1261.9000000953674,"ttfb":400.80000019073486,"pageVisibility":"visible","entityId":131476,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"3f19b262-3807-455b-a09d-ec94262a33bd","navigationType":0,"readyForUser":1375.3000001907349,"redirectCount":0,"resourceLoadedEnd":998.9000000953674,"resourceLoadedStart":426.30000019073486,"resourceTiming":[{"duration":101.69999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":426.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":426.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":528,"responseStart":0,"secureConnectionStart":0},{"duration":101.7000002861023,"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":426.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":426.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":528.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":400.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":426.80000019073486,"connectEnd":426.80000019073486,"connectStart":426.80000019073486,"domainLookupEnd":426.80000019073486,"domainLookupStart":426.80000019073486,"fetchStart":426.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":532.9000000953674,"responseEnd":827.3000001907349,"responseStart":570.4000000953674,"secureConnectionStart":426.80000019073486},{"duration":532.8000001907349,"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":427,"connectEnd":427,"connectStart":427,"domainLookupEnd":427,"domainLookupStart":427,"fetchStart":427,"redirectEnd":0,"redirectStart":0,"requestStart":532.3000001907349,"responseEnd":959.8000001907349,"responseStart":563.5999999046326,"secureConnectionStart":427},{"duration":145.30000019073486,"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":427.19999980926514,"connectEnd":427.19999980926514,"connectStart":427.19999980926514,"domainLookupEnd":427.19999980926514,"domainLookupStart":427.19999980926514,"fetchStart":427.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":533.3000001907349,"responseEnd":572.5,"responseStart":569.5,"secureConnectionStart":427.19999980926514},{"duration":162.59999990463257,"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":427.40000009536743,"connectEnd":427.40000009536743,"connectStart":427.40000009536743,"domainLookupEnd":427.40000009536743,"domainLookupStart":427.40000009536743,"fetchStart":427.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":563.0999999046326,"responseEnd":590,"responseStart":587.5999999046326,"secureConnectionStart":427.40000009536743},{"duration":162.09999990463257,"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":427.5,"connectEnd":427.5,"connectStart":427.5,"domainLookupEnd":427.5,"domainLookupStart":427.5,"fetchStart":427.5,"redirectEnd":0,"redirectStart":0,"requestStart":563.4000000953674,"responseEnd":589.5999999046326,"responseStart":587,"secureConnectionStart":427.5},{"duration":121,"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":427.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":427.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":548.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":164,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":427.90000009536743,"connectEnd":427.90000009536743,"connectStart":427.90000009536743,"domainLookupEnd":427.90000009536743,"domainLookupStart":427.90000009536743,"fetchStart":427.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":566.6999998092651,"responseEnd":591.9000000953674,"responseStart":588.0999999046326,"secureConnectionStart":427.90000009536743},{"duration":120.80000019073486,"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":428.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":428.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":548.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":163.89999961853027,"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":428.30000019073486,"connectEnd":428.30000019073486,"connectStart":428.30000019073486,"domainLookupEnd":428.30000019073486,"domainLookupStart":428.30000019073486,"fetchStart":428.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":568.1999998092651,"responseEnd":592.1999998092651,"responseStart":590.1999998092651,"secureConnectionStart":428.30000019073486},{"duration":555,"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":434.09999990463257,"connectEnd":434.09999990463257,"connectStart":434.09999990463257,"domainLookupEnd":434.09999990463257,"domainLookupStart":434.09999990463257,"fetchStart":434.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":803,"responseEnd":989.0999999046326,"responseStart":961.5999999046326,"secureConnectionStart":434.09999990463257},{"duration":560.7000002861023,"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":438.19999980926514,"connectEnd":438.19999980926514,"connectStart":438.19999980926514,"domainLookupEnd":438.19999980926514,"domainLookupStart":438.19999980926514,"fetchStart":438.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":820.4000000953674,"responseEnd":998.9000000953674,"responseStart":977.5,"secureConnectionStart":438.19999980926514},{"duration":174.39999961853027,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":990.8000001907349,"connectEnd":990.8000001907349,"connectStart":990.8000001907349,"domainLookupEnd":990.8000001907349,"domainLookupStart":990.8000001907349,"fetchStart":990.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":1131.5999999046326,"responseEnd":1165.1999998092651,"responseStart":1164.5999999046326,"secureConnectionStart":990.8000001907349}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":204,"responseStart":400,"responseEnd":438,"domLoading":407,"domInteractive":1571,"domContentLoadedEventStart":1572,"domContentLoadedEventEnd":1643,"domComplete":2722,"loadEventStart":2722,"loadEventEnd":2722,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1469.5},{"name":"bigPipe.sidebar-id.end","time":1470.3000001907349},{"name":"bigPipe.activity-panel-pipe-id.start","time":1470.5},{"name":"bigPipe.activity-panel-pipe-id.end","time":1473.0999999046326},{"name":"activityTabFullyLoaded","time":1662.0999999046326}],"measures":[],"correlationId":"1fd9cdeb98ff2c","effectiveType":"4g","downlink":9.9,"rtt":0,"serverDuration":125,"dbReadsTimeInMs":22,"dbConnsTimeInMs":31,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}