Reputation: 1
During migrating from infinispan v9.3 to v13, getting error in putAll() cache update with Derby Database.
I am using derby 10.14 as my persistance store, when i am tyring to update a batch of data using putAll() method. It is failing with below error.
[blocking-thread-testnode-p3-t1] TRACE org.infinispan.persistence.jdbc.common.sql.BaseTableOperations - Running batch upsert sql 'MERGE INTO "ISPN_STRING_TABLE_KEYCHAIN" USING (VALUES (?, ?, ?)) AS tmp (DATA_COLUMN, TIMESTAMP_COLUMN, ID_COLUMN) ON (DATA_COLUMN = tmp.DATA_COLUMN) WHEN MATCHED THEN UPDATE SET TIMESTAMP_COLUMN = tmp.TIMESTAMP_COLUMN, ID_COLUMN = tmp.ID_COLUMN WHEN NOT MATCHED THEN INSERT (DATA_COLUMN, TIMESTAMP_COLUMN, ID_COLUMN) VALUES (tmp.DATA_COLUMN, tmp.TIMESTAMP_COLUMN, tmp.ID_COLUMN)'
15722 [blocking-thread-testnode-p3-t1] TRACE org.infinispan.persistence.jdbc.common.sql.BaseTableOperations - Running batch delete sql 'DELETE FROM "ISPN_STRING_TABLE_KEYCHAIN" WHERE ID_COLUMN = ?'
15732 [non-blocking-thread-testnode-p2-t14] ERROR org.infinispan.interceptors.impl.InvocationContextInterceptor - ISPN000136: Error executing command PutMapCommand on Cache 'KEYCHAIN', writing keys [key40, key44, key43, key42, key41, key37, key36, key35...<92 other elements>]
org.infinispan.persistence.spi.PersistenceException: ISPN008037: Error while writing entries in batch to the database:
at org.infinispan.persistence.jdbc.common.impl.BaseJdbcStore.lambda$batch$7(BaseJdbcStore.java:199)
at java.util.concurrent.CompletableFuture$AsyncRun.run$$$capture(CompletableFuture.java:1640)
at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLSyntaxErrorException: The source table of a MERGE statement must be a base table or table function.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement42.<init>(Unknown Source)
at org.apache.derby.jdbc.Driver42.newEmbedPreparedStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
at org.infinispan.persistence.jdbc.common.sql.BaseTableOperations.batchUpdates(BaseTableOperations.java:179)
at org.infinispan.persistence.jdbc.common.impl.BaseJdbcStore.lambda$batch$7(BaseJdbcStore.java:196)
... 7 more
Caused by: ERROR 42XAL: The source table of a MERGE statement must be a base table or table function.
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.impl.sql.compile.MergeNode.bindStatement(Unknown Source)
at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
... 14 more
I checked the query, it is using to update is coming from infinispan, below is the query for which it is complaining.
MERGE INTO "ISPN_STRING_TABLE_KEYCHAIN" USING (VALUES (?, ?, ?)) AS tmp (DATA_COLUMN, TIMESTAMP_COLUMN, ID_COLUMN) ON (DATA_COLUMN = tmp.DATA_COLUMN) WHEN MATCHED THEN UPDATE SET TIMESTAMP_COLUMN = tmp.TIMESTAMP_COLUMN, ID_COLUMN = tmp.ID_COLUMN WHEN NOT MATCHED THEN INSERT (DATA_COLUMN, TIMESTAMP_COLUMN, ID_COLUMN) VALUES (tmp.DATA_COLUMN, tmp.TIMESTAMP_COLUMN, tmp.ID_COLUMN)'
Any configuration changes i am missing because the query is hardcoded in the infinispan 13 code base. The same query get generated in infinispan9.3 but it doesn't complain in batch update there.
Thanks in Advance.
I am able to put single entry cache but batch update is complaining. The same query get generated in infinispan 9.3 but it doesn't complain there.
Upvotes: 0
Views: 25