Type:
Bug
Priority:
Critical
Resolution:
Fixed
Affects Version/s:
10.3(EOL) , 10.4(EOL) , 10.5 , 10.6 , 10.7(EOL) , 10.8(EOL)
created after CONJ-948
Synchronous connectors can rely on OK_Packet/EOF_Packet server status's SERVER_STATUS_IN_TRANS flag that explicitly indicate if a transaction is currently active.
Java connector use that information to avoid issuing a rollback/commit command, skipping the command if there is no transaction.
Problem concerns only MyISAM that never set SERVER_STATUS_IN_TRANS flag. Still there is some case when there is some kind of lock : ( example from serg: )
create table t1 (a int ) engine=myisam;
insert t1 values (1);
and in another
this DROP TABLE will wait until the transaction ends.
either MyISAM should return SERVER_STATUS_IN_TRANS flag, so connector know there is really a commit to be issued.
either MyISAM doesn't set any lock. (It may be just an issue : for some metadata locks are taken on the object name , before the table is opened, before we know it's a MyISAM table.)
Either way is ok.
(Another solution would be to always issue a COMMIT/ROLLBACK statement when there is no need, but that would degrade performance dramatically for some application. For example when connections are given back to pools, pools generally issues a connection.rollback() to ensure connection state, and there is lots of application where that command would represent 25% of the commands)
{"report":{"fcp":1671.6999998092651,"ttfb":311.59999990463257,"pageVisibility":"visible","entityId":111873,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"2b4514c6-4573-4fc3-9aa5-c7a24beb3022","navigationType":0,"readyForUser":1741.5999999046326,"redirectCount":0,"resourceLoadedEnd":1320.4000000953674,"resourceLoadedStart":328.80000019073486,"resourceTiming":[{"duration":53.09999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":328.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":328.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":381.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":61,"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":329.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":329.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":390.19999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":636.1999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":329.5,"connectEnd":329.5,"connectStart":329.5,"domainLookupEnd":329.5,"domainLookupStart":329.5,"fetchStart":329.5,"redirectEnd":0,"redirectStart":0,"requestStart":381.40000009536743,"responseEnd":965.6999998092651,"responseStart":444.5,"secureConnectionStart":329.5},{"duration":956.0999999046326,"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":329.90000009536743,"connectEnd":329.90000009536743,"connectStart":329.90000009536743,"domainLookupEnd":329.90000009536743,"domainLookupStart":329.90000009536743,"fetchStart":329.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":381.59999990463257,"responseEnd":1286,"responseStart":430.40000009536743,"secureConnectionStart":329.90000009536743},{"duration":123.60000038146973,"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":330.19999980926514,"connectEnd":330.19999980926514,"connectStart":330.19999980926514,"domainLookupEnd":330.19999980926514,"domainLookupStart":330.19999980926514,"fetchStart":330.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":382.30000019073486,"responseEnd":453.80000019073486,"responseStart":431.40000009536743,"secureConnectionStart":330.19999980926514},{"duration":123.39999961853027,"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":330.30000019073486,"connectEnd":330.30000019073486,"connectStart":330.30000019073486,"domainLookupEnd":330.30000019073486,"domainLookupStart":330.30000019073486,"fetchStart":330.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":381.80000019073486,"responseEnd":453.69999980926514,"responseStart":430.90000009536743,"secureConnectionStart":330.30000019073486},{"duration":122.90000009536743,"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":330.59999990463257,"connectEnd":330.59999990463257,"connectStart":330.59999990463257,"domainLookupEnd":330.59999990463257,"domainLookupStart":330.59999990463257,"fetchStart":330.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":382.69999980926514,"responseEnd":453.5,"responseStart":430,"secureConnectionStart":330.59999990463257},{"duration":59.5,"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":330.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":330.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":390.19999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":189,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":330.90000009536743,"connectEnd":330.90000009536743,"connectStart":330.90000009536743,"domainLookupEnd":330.90000009536743,"domainLookupStart":330.90000009536743,"fetchStart":330.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":383.30000019073486,"responseEnd":519.9000000953674,"responseStart":487.30000019073486,"secureConnectionStart":330.90000009536743},{"duration":59.200000286102295,"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":331.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":331.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":390.30000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":131.2000002861023,"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":331.09999990463257,"connectEnd":331.09999990463257,"connectStart":331.09999990463257,"domainLookupEnd":331.09999990463257,"domainLookupStart":331.09999990463257,"fetchStart":331.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":393.90000009536743,"responseEnd":462.30000019073486,"responseStart":456.59999990463257,"secureConnectionStart":331.09999990463257},{"duration":979.2000002861023,"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":340.59999990463257,"connectEnd":340.59999990463257,"connectStart":340.59999990463257,"domainLookupEnd":340.59999990463257,"domainLookupStart":340.59999990463257,"fetchStart":340.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":460.09999990463257,"responseEnd":1319.8000001907349,"responseStart":1310.9000000953674,"secureConnectionStart":340.59999990463257},{"duration":974.0999999046326,"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":346.30000019073486,"connectEnd":346.30000019073486,"connectStart":346.30000019073486,"domainLookupEnd":346.30000019073486,"domainLookupStart":346.30000019073486,"fetchStart":346.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":486.30000019073486,"responseEnd":1320.4000000953674,"responseStart":1314.1999998092651,"secureConnectionStart":346.30000019073486},{"duration":216,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1238,"connectEnd":1238,"connectStart":1238,"domainLookupEnd":1238,"domainLookupStart":1238,"fetchStart":1238,"redirectEnd":0,"redirectStart":0,"requestStart":1401.8000001907349,"responseEnd":1454,"responseStart":1452.8000001907349,"secureConnectionStart":1238},{"duration":293.90000009536743,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1569.5999999046326,"connectEnd":1569.5999999046326,"connectStart":1569.5999999046326,"domainLookupEnd":1569.5999999046326,"domainLookupStart":1569.5999999046326,"fetchStart":1569.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":1824.5999999046326,"responseEnd":1863.5,"responseStart":1861.8000001907349,"secureConnectionStart":1569.5999999046326},{"duration":258.1000003814697,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1654.1999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1654.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1912.3000001907349,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":41,"domainLookupEnd":88,"connectStart":88,"connectEnd":110,"secureConnectionStart":96,"requestStart":112,"responseStart":312,"responseEnd":347,"domLoading":323,"domInteractive":1988,"domContentLoadedEventStart":1988,"domContentLoadedEventEnd":2125,"domComplete":2318,"loadEventStart":2318,"loadEventEnd":2319,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1792},{"name":"bigPipe.sidebar-id.end","time":1792.8000001907349},{"name":"bigPipe.activity-panel-pipe-id.start","time":1792.9000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":1798.4000000953674},{"name":"activityTabFullyLoaded","time":2183.5}],"measures":[],"correlationId":"ddb98482afbf91","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":116,"dbReadsTimeInMs":20,"dbConnsTimeInMs":31,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
I added reporting server status and it is what we have now:
create table t1 (a int) engine=innodb;
set autocommit=0;
--- INNODB start transaction
start transaction;
affected rows: 0
status: 1
select * from t1;
a
affected rows: 0
status: 21
insert t1 values (1);
affected rows: 1
status: 1
select * from t1;
a
1
affected rows: 1
status: 21
drop table t1;
create table t1 (a int) engine=aria;
commit;
set autocommit=0;
--- ARIA start transaction
start transaction;
affected rows: 0
status: 1
select * from t1;
a
affected rows: 0
status: 1
insert t1 values (1);
affected rows: 1
status: 1
select * from t1;
a
1
affected rows: 1
status: 1
drop table t1;
create table t1 (a int) engine=innodb;
commit;
set autocommit=0;
--- INNODB autmatic transaction
select * from t1;
a
affected rows: 0
status: 21
insert t1 values (1);
affected rows: 1
status: 1
select * from t1;
a
1
affected rows: 1
status: 21
drop table t1;
create table t1 (a int) engine=aria;
commit;
set autocommit=0;
--- ARIA automatic transaction
select * from t1;
a
affected rows: 0
status: 0
insert t1 values (1);
affected rows: 1
status: 0
select * from t1;
a
1
affected rows: 1
status: 0
drop table t1;
test case:
--source include/have_innodb.inc
create table t1 (a int) engine=innodb;
set autocommit=0;
--echo --- INNODB start transaction
--enable_info
start transaction;
select * from t1;
insert t1 values (1);
select * from t1;
--disable_info
drop table t1;
create table t1 (a int) engine=aria;
commit;
set autocommit=0;
--echo --- ARIA start transaction
--enable_info
start transaction;
select * from t1;
insert t1 values (1);
select * from t1;
--disable_info
drop table t1;
create table t1 (a int) engine=innodb;
commit;
set autocommit=0;
--echo --- INNODB autmatic transaction
--enable_info
select * from t1;
insert t1 values (1);
select * from t1;
--disable_info
drop table t1;
create table t1 (a int) engine=aria;
commit;
set autocommit=0;
--echo --- ARIA automatic transaction
--enable_info
select * from t1;
insert t1 values (1);
select * from t1;
--disable_info
drop table t1;
diff:
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 2a6d4265e59..20b7762b0cf 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -7729,11 +7729,13 @@ void append_metadata(DYNAMIC_STRING *ds,
*/
void append_info(DYNAMIC_STRING *ds, ulonglong affected_rows,
- const char *info)
+ const char *info, unsigned int status)
{
char buf[40], buff2[21];
sprintf(buf,"affected rows: %s\n", llstr(affected_rows, buff2));
dynstr_append(ds, buf);
+ sprintf(buf,"status: %x\n", status);
+ dynstr_append(ds, buf);
if (info)
{
dynstr_append(ds, "info: ");
@@ -7985,7 +7987,8 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
query to find the warnings.
*/
if (!disable_info)
- append_info(ds, mysql_affected_rows(mysql), mysql_info(mysql));
+ append_info(ds, mysql_affected_rows(mysql), mysql_info(mysql),
+ mysql->server_status);
if (display_session_track_info)
append_session_track_info(ds, mysql);
@@ -8409,7 +8412,8 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
otherwise.
*/
if (!disable_info)
- append_info(ds, mysql_stmt_affected_rows(stmt), mysql_info(mysql));
+ append_info(ds, mysql_stmt_affected_rows(stmt), mysql_info(mysql),
+ mysql->server_status);
if (display_session_track_info)
append_session_track_info(ds, mysql);