This started off in MXS-5527 where I noticed that INSERT ... RETURNING does not return the value of last_gtid the same way it is for a plain INSERT statement.
Here's a network dump where the behavior is seen. The GTID 0-3000-11 is returned but the GTID
T 127.0.0.1:39908 -> 127.0.0.1:3000 [AP] #24
23 00 00 00 03 63 72 65 61 74 65 20 6f 72 20 72 #....create or r
65 70 6c 61 63 65 20 74 61 62 6c 65 20 74 31 28 eplace table t1(
69 64 20 69 6e 74 29 id int)
#
T 127.0.0.1:3000 -> 127.0.0.1:39908 [AP] #25
1f 00 00 01 00 00 00 02 40 00 00 00 16 00 14 09 ........@.......
6c 61 73 74 5f 67 74 69 64 09 30 2d 33 30 30 30 last_gtid.0-3000
2d 31 33 -13
##
T 127.0.0.1:39908 -> 127.0.0.1:3000 [AP] #27
27 00 00 00 03 69 6e 73 65 72 74 20 69 6e 74 6f '....insert into
20 74 31 20 76 61 6c 75 65 73 20 28 31 29 20 72 t1 values (1) r
65 74 75 72 6e 69 6e 67 20 69 64 eturning id
#
T 127.0.0.1:3000 -> 127.0.0.1:39908 [AP] #28
02 00 00 01 01 01 23 00 00 02 03 64 65 66 04 74 ......#....def.t
65 73 74 02 74 31 02 74 31 02 69 64 02 69 64 00 est.t1.t1.id.id.
0c 3f 00 0b 00 00 00 03 00 00 00 00 00 05 00 00 .?..............
03 fe 00 00 02 00 02 00 00 04 01 31 05 00 00 05 ...........1....
fe 00 00 02 40 ....@
##
T 127.0.0.1:39908 -> 127.0.0.1:3000 [AP] #30
13 00 00 00 03 73 65 6c 65 63 74 20 40 40 6c 61 .....select @@la
73 74 5f 67 74 69 64 st_gtid
#
T 127.0.0.1:3000 -> 127.0.0.1:39908 [AP] #31
02 00 00 01 01 01 22 00 00 02 03 64 65 66 00 00 ......"....def..
00 0b 40 40 6c 61 73 74 5f 67 74 69 64 00 00 0c ..@@last_gtid...
21 00 1b 00 00 00 fd 00 00 27 00 00 05 00 00 03 !........'......
fe 00 00 02 00 0a 00 00 04 09 30 2d 33 30 30 30 ..........0-3000
2d 31 34 05 00 00 05 fe 00 00 02 00 -14.........
##
T 127.0.0.1:39908 -> 127.0.0.1:3000 [AP] #33
1a 00 00 00 03 69 6e 73 65 72 74 20 69 6e 74 6f .....insert into
20 74 31 20 76 61 6c 75 65 73 20 28 32 29 t1 values (2)
#
T 127.0.0.1:3000 -> 127.0.0.1:39908 [AP] #34
1f 00 00 01 00 01 00 02 40 00 00 00 16 00 14 09 ........@.......
6c 61 73 74 5f 67 74 69 64 09 30 2d 33 30 30 30 last_gtid.0-3000
2d 31 35 -15
##
T 127.0.0.1:39908 -> 127.0.0.1:3000 [AP] #36
13 00 00 00 03 73 65 6c 65 63 74 20 40 40 6c 61 .....select @@la
73 74 5f 67 74 69 64 st_gtid
#
T 127.0.0.1:3000 -> 127.0.0.1:39908 [AP] #37
02 00 00 01 01 01 22 00 00 02 03 64 65 66 00 00 ......"....def..
00 0b 40 40 6c 61 73 74 5f 67 74 69 64 00 00 0c ..@@last_gtid...
21 00 1b 00 00 00 fd 00 00 27 00 00 05 00 00 03 !........'......
fe 00 00 02 00 0a 00 00 04 09 30 2d 33 30 30 30 ..........0-3000
2d 31 35 05 00 00 05 fe 00 00 02 00 -15.........
blocks
MXS-5527
The "INSERT INTO...RETURNING" syntax breaks causal_reads
Closed
markus makela
made changes -
2025-02-25 14:06
Field
Original Value
New Value
Description
This started off in MXS-5527 where I noticed that {{INSERT ... RETURNING}} does not return the value of {{last_gtid}} the same way it is for a plain {{INSERT}} statement.
This started off in MXS-5527 where I noticed that {{INSERT ... RETURNING}} does not return the value of {{last_gtid}} the same way it is for a plain {{INSERT}} statement.
Here's a network dump where the behavior is seen. The GTID 0-3000-11 is returned but the GTID
{code}
T 127.0.0.1:39908 -> 127.0.0.1:3000 [AP] #24
23 00 00 00 03 63 72 65 61 74 65 20 6f 72 20 72 #....create or r
65 70 6c 61 63 65 20 74 61 62 6c 65 20 74 31 28 eplace table t1(
69 64 20 69 6e 74 29 id int)
#
T 127.0.0.1:3000 -> 127.0.0.1:39908 [AP] #25
1f 00 00 01 00 00 00 02 40 00 00 00 16 00 14 09 ........@.......
6c 61 73 74 5f 67 74 69 64 09 30 2d 33 30 30 30 last_gtid.0-3000
2d 31 33 -13
##
T 127.0.0.1:39908 -> 127.0.0.1:3000 [AP] #27
27 00 00 00 03 69 6e 73 65 72 74 20 69 6e 74 6f '....insert into
20 74 31 20 76 61 6c 75 65 73 20 28 31 29 20 72 t1 values (1) r
65 74 75 72 6e 69 6e 67 20 69 64 eturning id
#
T 127.0.0.1:3000 -> 127.0.0.1:39908 [AP] #28
02 00 00 01 01 01 23 00 00 02 03 64 65 66 04 74 ......#....def.t
65 73 74 02 74 31 02 74 31 02 69 64 02 69 64 00 est.t1.t1.id.id.
0c 3f 00 0b 00 00 00 03 00 00 00 00 00 05 00 00 .?..............
03 fe 00 00 02 00 02 00 00 04 01 31 05 00 00 05 ...........1....
fe 00 00 02 40 ....@
##
T 127.0.0.1:39908 -> 127.0.0.1:3000 [AP] #30
13 00 00 00 03 73 65 6c 65 63 74 20 40 40 6c 61 .....select @@la
73 74 5f 67 74 69 64 st_gtid
#
T 127.0.0.1:3000 -> 127.0.0.1:39908 [AP] #31
02 00 00 01 01 01 22 00 00 02 03 64 65 66 00 00 ......"....def..
00 0b 40 40 6c 61 73 74 5f 67 74 69 64 00 00 0c ..@@last_gtid...
21 00 1b 00 00 00 fd 00 00 27 00 00 05 00 00 03 !........'......
fe 00 00 02 00 0a 00 00 04 09 30 2d 33 30 30 30 ..........0-3000
2d 31 34 05 00 00 05 fe 00 00 02 00 -14.........
##
T 127.0.0.1:39908 -> 127.0.0.1:3000 [AP] #33
1a 00 00 00 03 69 6e 73 65 72 74 20 69 6e 74 6f .....insert into
20 74 31 20 76 61 6c 75 65 73 20 28 32 29 t1 values (2)
#
T 127.0.0.1:3000 -> 127.0.0.1:39908 [AP] #34
1f 00 00 01 00 01 00 02 40 00 00 00 16 00 14 09 ........@.......
6c 61 73 74 5f 67 74 69 64 09 30 2d 33 30 30 30 last_gtid.0-3000
2d 31 35 -15
##
T 127.0.0.1:39908 -> 127.0.0.1:3000 [AP] #36
13 00 00 00 03 73 65 6c 65 63 74 20 40 40 6c 61 .....select @@la
73 74 5f 67 74 69 64 st_gtid
#
T 127.0.0.1:3000 -> 127.0.0.1:39908 [AP] #37
02 00 00 01 01 01 22 00 00 02 03 64 65 66 00 00 ......"....def..
00 0b 40 40 6c 61 73 74 5f 67 74 69 64 00 00 0c ..@@last_gtid...
21 00 1b 00 00 00 fd 00 00 27 00 00 05 00 00 03 !........'......
fe 00 00 02 00 0a 00 00 04 09 30 2d 33 30 30 30 ..........0-3000
2d 31 35 05 00 00 05 fe 00 00 02 00 -15.........
{code}
markus makela
made changes -
2025-02-25 14:06
Affects Version/s
11.4.4
[ 29907
]
Elena Stepanova
made changes -
2025-02-25 22:10
Component/s
Server
[ 13907
]
Fix Version/s
10.11
[ 27614
]
Fix Version/s
11.4
[ 29301
]
Assignee
Oleksandr Byelkin
[ sanja
]
markus makela
made changes -
2025-02-26 05:33
Fix Version/s
N/A
[ 14700
]
Fix Version/s
10.11
[ 27614
]
Fix Version/s
11.4
[ 29301
]
Resolution
Not a Bug
[ 6
]
Status
Open
[ 1
]
Closed
[ 6
]
{"report":{"fcp":1392,"ttfb":280.90000009536743,"pageVisibility":"visible","entityId":132998,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"fb86a992-8ff9-46f2-b596-b4d9a38925e0","navigationType":0,"readyForUser":1487.2000002861023,"redirectCount":0,"resourceLoadedEnd":1635.0999999046326,"resourceLoadedStart":290.7000002861023,"resourceTiming":[{"duration":537.1999998092651,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":290.7000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":290.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":827.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":537.2000002861023,"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":291,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":291,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":828.2000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":550.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":291.2000002861023,"connectEnd":291.2000002861023,"connectStart":291.2000002861023,"domainLookupEnd":291.2000002861023,"domainLookupStart":291.2000002861023,"fetchStart":291.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":291.2000002861023,"responseEnd":841.7000002861023,"responseStart":841.7000002861023,"secureConnectionStart":291.2000002861023},{"duration":617.5,"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":291.40000009536743,"connectEnd":291.40000009536743,"connectStart":291.40000009536743,"domainLookupEnd":291.40000009536743,"domainLookupStart":291.40000009536743,"fetchStart":291.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":291.40000009536743,"responseEnd":908.9000000953674,"responseStart":908.9000000953674,"secureConnectionStart":291.40000009536743},{"duration":621.1999998092651,"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":291.7000002861023,"connectEnd":291.7000002861023,"connectStart":291.7000002861023,"domainLookupEnd":291.7000002861023,"domainLookupStart":291.7000002861023,"fetchStart":291.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":291.7000002861023,"responseEnd":912.9000000953674,"responseStart":912.9000000953674,"secureConnectionStart":291.7000002861023},{"duration":621.5999999046326,"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":291.80000019073486,"connectEnd":291.80000019073486,"connectStart":291.80000019073486,"domainLookupEnd":291.80000019073486,"domainLookupStart":291.80000019073486,"fetchStart":291.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":291.80000019073486,"responseEnd":913.4000000953674,"responseStart":913.4000000953674,"secureConnectionStart":291.80000019073486},{"duration":621.7000002861023,"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":292.09999990463257,"connectEnd":292.09999990463257,"connectStart":292.09999990463257,"domainLookupEnd":292.09999990463257,"domainLookupStart":292.09999990463257,"fetchStart":292.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":292.09999990463257,"responseEnd":913.8000001907349,"responseStart":913.8000001907349,"secureConnectionStart":292.09999990463257},{"duration":696.6999998092651,"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":292.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":292.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":989,"responseStart":0,"secureConnectionStart":0},{"duration":621.9000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":292.40000009536743,"connectEnd":292.40000009536743,"connectStart":292.40000009536743,"domainLookupEnd":292.40000009536743,"domainLookupStart":292.40000009536743,"fetchStart":292.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":292.40000009536743,"responseEnd":914.3000001907349,"responseStart":914.3000001907349,"secureConnectionStart":292.40000009536743},{"duration":696.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":292.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":292.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":989.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":622.2999997138977,"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":292.7000002861023,"connectEnd":292.7000002861023,"connectStart":292.7000002861023,"domainLookupEnd":292.7000002861023,"domainLookupStart":292.7000002861023,"fetchStart":292.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":292.7000002861023,"responseEnd":915,"responseStart":915,"secureConnectionStart":292.7000002861023},{"duration":917.0999999046326,"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":293.5,"connectEnd":293.5,"connectStart":293.5,"domainLookupEnd":293.5,"domainLookupStart":293.5,"fetchStart":293.5,"redirectEnd":0,"redirectStart":0,"requestStart":293.5,"responseEnd":1210.5999999046326,"responseStart":1210.5999999046326,"secureConnectionStart":293.5},{"duration":1340.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":293.59999990463257,"connectEnd":293.59999990463257,"connectStart":293.59999990463257,"domainLookupEnd":293.59999990463257,"domainLookupStart":293.59999990463257,"fetchStart":293.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":293.59999990463257,"responseEnd":1634.2000002861023,"responseStart":1634.2000002861023,"secureConnectionStart":293.59999990463257},{"duration":210.7000002861023,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1001.5999999046326,"connectEnd":1001.5999999046326,"connectStart":1001.5999999046326,"domainLookupEnd":1001.5999999046326,"domainLookupStart":1001.5999999046326,"fetchStart":1001.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":1001.5999999046326,"responseEnd":1212.3000001907349,"responseStart":1212.3000001907349,"secureConnectionStart":1001.5999999046326},{"duration":346.2999997138977,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1288.8000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1288.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1635.0999999046326,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":106,"responseStart":281,"responseEnd":286,"domLoading":288,"domInteractive":1671,"domContentLoadedEventStart":1671,"domContentLoadedEventEnd":1721,"domComplete":2311,"loadEventStart":2311,"loadEventEnd":2312,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1639.0999999046326},{"name":"bigPipe.sidebar-id.end","time":1640},{"name":"bigPipe.activity-panel-pipe-id.start","time":1640.2000002861023},{"name":"bigPipe.activity-panel-pipe-id.end","time":1642.5},{"name":"activityTabFullyLoaded","time":1738.9000000953674}],"measures":[],"correlationId":"2fbeb713a337d4","effectiveType":"4g","downlink":9.1,"rtt":0,"serverDuration":108,"dbReadsTimeInMs":16,"dbConnsTimeInMs":25,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}