Spring Batch - 由于事务之间的读/写依赖关系,无法序列化访问

问题描述 投票:0回答:1

我在事务上面临 Spring Batch 元数据表的一些问题。


org.springframework.dao.CannotAcquireLockException: PreparedStatementCallback; SQL [INSERT INTO BATCH_JOB_EXECUTION_CONTEXT (SHORT_CONTEXT, SERIALIZED_CONTEXT, JOB_EXECUTION_ID)
    VALUES(?, ?, ?)
]; ERROR: could not serialize access due to read/write dependencies among transactions
  Detail: Reason code: Canceled on identification as a pivot, during conflict in checking.
  Hint: The transaction might succeed if retried.
    at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:115)

caused by: org.postgresql.util.PSQLException: ERROR: could not serialize access due to read/write dependencies among transactions
  Detail: Reason code: Canceled on identification as a pivot, during conflict in checking.
  Hint: The transaction might succeed if retried.
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2725)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2412)

我什至还在配置中添加了以下内容

隔离_读_已提交

我需要一些帮助。

java spring-boot spring-data-jpa spring-batch spring-batch-tasklet
1个回答
0
投票

根据评论,我已经使用了

ISOLATION_READ_UNCOMMITTED
,它现在可以正常工作,没有任何问题。

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.