Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.6.22, 10.6.23
-
MariaDB 10.6.23 and 10.6.23 , JDBC driver version - 3.1.4
Description
Issue Summary:
A BatchUpdateException is thrown when inserting data into an intermediate table after an update query, but only on MariaDB 10.6.22 and 10.6.23. The same code works correctly on MariaDB 10.11.x and 11.8.3.
💡 Scenario Overview:
A JDBC connection fetches data from a source table, modifies it, and inserts the result into an intermediate table.
Insertion is done in batches — 10 batches of 10,000 rows each (100,000 total).
After the 10th batch is inserted, an UPDATE is executed that joins the intermediate table with another table to update some values.
After the update, the intermediate table is truncated.
The code attempts to insert the 11th batch into the intermediate table using executeBatch() — but it throws a BatchUpdateException.
📌 Other Details:
Each batch is inserted using PreparedStatement.addBatch() followed by executeBatch().
A separate PreparedStatement is used for each of the insert and update operations.
A single UPDATE is executed after the 10th batch.
On attempting to insert the 11th batch, executeBatch() fails with a BatchUpdateException.
No row locks or deadlocks are reported.
The same data and schema are used across all tested MariaDB versions.
🧪 Troubleshooting Steps Tried:
Calling clearBatch() before inserting the 11th batch → did not help
Explicit conn.commit() before and after update → no change
Confirmed no foreign key or data violations
No locks found in SHOW ENGINE INNODB STATUS
Output of BatchUpdateException.getUpdateCounts():
[-3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, +9,900 more]