Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-1004

`ANALYZE TABLE` query executed by spring-data stopped working in mariadb-java-client 3.0.x

Details

    Description

      Hi, we used to have a scheduled job that were executing the ANALYZE TABLE & OPTIMIZE TABLE for several tables.
      Queries were coded using spring-data `@Query` annotation, which under the hood was invoking maria-db-client.

      @Modifying
      @Query(value = "ANALYZE TABLE xyz", nativeQuery = true)
      void analyze();
      

      In maria-db-client 2.7.x it worked correctly, however after upgrading to 3.0.5 the query stopped working. Stacktrace pointed us to ServerPreparedStatement#executeLargeUpdate.

      Caused by: java.sql.SQLException: (conn=261028) the given SQL statement produces an unexpected ResultSet object
      	at org.mariadb.jdbc.export.ExceptionFactory.createException(ExceptionFactory.java:297)
      	at org.mariadb.jdbc.export.ExceptionFactory.create(ExceptionFactory.java:345)
      	at org.mariadb.jdbc.ServerPreparedStatement.executeLargeUpdate(ServerPreparedStatement.java:470)
      	at org.mariadb.jdbc.ServerPreparedStatement.executeUpdate(ServerPreparedStatement.java:442)
      

      So the query itself is correct, however what does not look correct is handling of result in ServerPreparedStatement, because in case of ANALYZE TABLE/OPTIMIZE TABLE the result is CompleteResult type (query succeeded tho), so it goes to the if condition that throws an exception.

      Attachments

        Activity

          Transition Time In Source Status Execution Times
          Diego Dupin made transition -
          Open Confirmed
          1d 6h 27m 1
          Diego Dupin made transition -
          Confirmed Open
          2m 57s 1
          Diego Dupin made transition -
          Open Closed
          12m 54s 1

          People

            diego dupin Diego Dupin
            mmatejko Mikołaj Matejko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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