Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
3.3.3
-
None
-
mariadb server docker 10.11, happens both over localhost and remote database.
Description
We ran into an undocumented transactional issue last week with a connection with autocommit set to true. We did a single large batched insert statement using a single executeBatch call. Another program managed to read a part of this insertion, which then later caused it to skip the rest due to a `updated_at >` WHERE statement.
We looked into the source code of the driver as we expected autocommit=true to commit each query (which we read as each single call of executeBatch()) separately. It turns out the BulkExecutePacket/PacketWriter classes splits large batches into blocks of 16 MB, each of which is sent to the database and committed separately. Our large insert went over this limit, resulting in the other application reading a partial insert.
We managed to reproduce this with the following settings:
- mariadb 10.11 containerized, running with --max-allowed-packet=60000000
- single large executeBatch insert that results in a packet greater than 16 MB
- 1 of the insertion parameters is a SLEEP call, which allowed us to see that after some time it is possible to read a part of the total insertion count from the table
- all of this with transaction isolation repeatable read
When using any kind of actual transaction management this issue does not appear, which is why I marked this as minor.
What I'd like to see from mariadb here is mostly some form of documentation about this behaviour with autocommit=true (maybe in the overview of connection parameters?), as I understand that the setting mostly exists for reads and small inserts/updates.