Details
-
New Feature
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
None
Description
The rewriteBatchStatements connection property was removed in either version 3.0.0 ( from https://mariadb.com/kb/en/about-mariadb-connector-j/ ) or 3.0.3 ( from https://mariadb.com/docs/server/connect/programming-languages/java/batch/ ) of the connector.
Removal of this property causes code that uses SELECT LAST_INSERT_ID() to retrieve the last generated ID value to now return different values, which is a breaking change for our application.
I'll add some test code to this jira ticket that demonstrates the problem.
I would like to reintroduce this property to the mariadb 3.x connector; I already have some code to do so and would be interested in getting feedback on it so it can be merged into the upstream mariadb connector repository with whatever tests are required.
Background
The 3.0.3 release notes ( https://mariadb.com/kb/en/mariadb-connector-j-303-release-notes/ ) lists rewriteBatchedStatements as a removed option, with the comment “replaced by use of faster batching implementation ( COM_STMT_BULK)”
It appears mariadb (the server) now has a COM_STMT_BULK_EXECUTE command which provides improved performance for bulk operations. This is a mariadb-only extension to the mysql protocol, and is not provided by RDS MySQL
- Mysql protocol docs: https://dev.mysql.com/doc/dev/mysql-server/8.4.3/page_protocol_com_stmt_execute.html
- MariaDB mysql_com.h: https://github.com/MariaDB/server/blob/c92add291e636c797e6d6ddca605905541b2a441/include/mysql_com.h#L102
- Mysql my_command.h: https://github.com/mysql/mysql-server/blob/6b6d3ed3d5c6591b446276184642d7d0504ecc86/include/my_command.h#L75
There is already a closed issue in JIRA that requests reinstating this property. https://jira.mariadb.org/browse/CONJ-1077 mentions poor performance running against MySQL server, but does not mention the change in LAST_INSERT_ID() behaviour.
This ticket was marked closed, with a recommendation to switch to a MariaDB server, which is not an option for us.
Our hands are also tied in regards to using the MariaDB connector, due to the more favourable LGPL license, so it would be great if we can upgrade from our old connector to the newest version without having to rewrite a large amount of serverside code.
We had been stuck on version 1.8.0 of the connector due to timezone handling compatibility issues, which it appears is now resolved, but we can't use the latest connector due to the lack of rewriteBatchStatements support.
I'll add some comments to this ticket, and create a Draft PR that adds this functionality back in. Would appreciate any feedback.