[CONJ-948] Under certain circumstances, Connector J does not send "commit" Created: 2022-03-28  Updated: 2022-06-13  Resolved: 2022-06-13

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: None
Fix Version/s: N/A

Type: Bug Priority: Critical
Reporter: Edward Stoever Assignee: Diego Dupin
Resolution: Won't Fix Votes: 0
Labels: None

Attachments: PDF File CS0390392-explanation.pdf    
Issue Links:
Problem/Incident
is caused by MDEV-28820 MyISAM wrong server status flags Closed
Relates
relates to CONJ-978 useBatchMultiSend setting as jdbc par... Closed

 Description   

Explanation, with necessary screenshots is attached as a pdf.

Summary:
Start a session. Turn off autocommit. Select on a table with engine=myisam.
This starts a transaction and locks the table.
Send commit using connection.commit() method. This is ignored by connector J.



 Comments   
Comment by Sergei Golubchik [ 2022-04-25 ]

I suspect it was always like that. If a table is used in a transaction its metadata is locked until the end of transaction. For example, if you do in one connection

create table t1 (a int) engine=myisam;
start transaction;
insert t1 values (1);

and in another

drop table t1;

this DROP TABLE will wait until the transaction ends. I think (but may be I'm missing something) that it doesn't make much sense as far as MyISAM is concerned. But metadata locks are taken on the object name, before the table is opened, before we know it's a MyISAM table.

If I'm not wrong, and this behavior is, indeed, redundant, we could release MDL_TRANSACTION locks at the end of the statement for non-transactional tables.

Comment by Diego Dupin [ 2022-04-25 ]

If there is some lock done, there seem to be 2 solutions:

  • either MyISAM should return SERVER_STATUS_IN_TRANS flag, so connector know there is really a commit to be issued.
  • either MyISAM release the transaction lock.

Other solution would be to always issue a COMMIT/ROLLBACK statement when there is no need, and since most pools issue a ROLLBACK command when a connection is given back to pool, that would degrade performance dramatically for some application using hibernate.

Comment by Diego Dupin [ 2022-06-13 ]

closing. Will be corrected server side with MDEV-28820

Generated at Thu Feb 08 03:19:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.