Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-36411

BatchUpdateExceptions while inserting into a partioned table during partition create

Details

    Description

      Since mariadb 10.11.10, we are seeing occasional exceptions in our java clients when they insert to a table at the same time a partition is reorganized into a new day-partition and 'future' partition. Mariadb java client simply returns an error code of 0, the database has no relevant logs that I can see.

      Sequence:

      • java client does an INSERT or REPLACE on a table, not with data that spans multiple partitions.
      • simultaneously, another program responsible for creating partitions runs an alter table command reorganizing the same table into a new partition and a 'future' partition. The future partition and the new partition are both empty at this time
      • the java client insert fails sometimes with the following message

      java.sql.BatchUpdateException: (conn=59560) 
      	at org.mariadb.jdbc.export.ExceptionFactory.createBatchUpdate(ExceptionFactory.java:181)
      	at org.mariadb.jdbc.ClientPreparedStatement.executeBatchBulk(ClientPreparedStatement.java:187)
      	at org.mariadb.jdbc.ClientPreparedStatement.executeInternalPreparedBatch(ClientPreparedStatement.java:121)
      	at org.mariadb.jdbc.ClientPreparedStatement.executeBatch(ClientPreparedStatement.java:474)
      	at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:128)
      	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java)
      	at com.example.Writer.run(Writer.java:128)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
      	at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:358)
      	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
      	at java.base/java.lang.Thread.run(Thread.java:1583)
      Caused by: java.sql.BatchUpdateException: (conn=59560) 
      	at org.mariadb.jdbc.export.ExceptionFactory.createBatchUpdate(ExceptionFactory.java:221)
      	at org.mariadb.jdbc.client.impl.StandardClient.executePipeline(StandardClient.java:680)
      	at org.mariadb.jdbc.ClientPreparedStatement.executeBatchBulk(ClientPreparedStatement.java:156)
      	... 12 more
      Caused by: java.sql.SQLException: (conn=59560) 
      	at org.mariadb.jdbc.export.ExceptionFactory.createException(ExceptionFactory.java:306)
      	at org.mariadb.jdbc.export.ExceptionFactory.create(ExceptionFactory.java:378)
      	at org.mariadb.jdbc.message.ClientMessage.readPacket(ClientMessage.java:172)
      	at org.mariadb.jdbc.client.impl.StandardClient.readPacket(StandardClient.java:915)
      	at org.mariadb.jdbc.client.impl.StandardClient.readResults(StandardClient.java:854)
      	at org.mariadb.jdbc.client.impl.StandardClient.readResponse(StandardClient.java:773)
      	at org.mariadb.jdbc.client.impl.StandardClient.executePipeline(StandardClient.java:613)
      

      Some additional info about the query itself:

      INSERT INTO sometable (partition_id, key, time, value)
      VALUES
      (?, ?, ?, ?)ON DUPLICATE KEY UPDATE value = VALUES(value)', 
       
      parameters:[2025032603,324234,'2025-03-26 23:29:10.476607',455.2]}
      

      Using mariadb-java-client 3.3.3.

      I'm putting this under mariadb-server, since the same version of the client started throwing these errors after the upgrade of the server.

      Attachments

        Activity

          People

            Unassigned Unassigned
            bh-tt123 Bert
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.