on
[springbatch]-[Error] pxc_strict_mode = ENFORCING
[springbatch]-[Error] pxc_strict_mode = ENFORCING
테스트 개발 환경에서 잘 구동되었던 springbatch가 상용에 적용시 아래 오류가 발생 하엿다.
Caused by: java.sql.SQLException: Percona-XtraDB-Cluster doesn't recommend using SERIALIZABLE isolation with pxc_strict_mode = ENFORCING
해당건으로 구굴신에게 문의시 생각보다 관련 내용이 없어 DBA와 상의후 ISOLATION_DEFAULT가 DB에 기본으로 적용되있다하여
관련 검색어로 구굴링 하니 결과가 나왔다
대부분의 원인은 여러개의 Spring Batch Job이 하나의 JobRepository를 가지고 동시에 실행이 될 때 발생할 수 있는 문제라고는 나오는데 우리 환경은 위 원인과는 다른 환경이 였다
상용은 mysql로 cluster 구성 환경으로 관련해서 오류가 난부분으로 오류 내용은 같아서
위 오류 처리건을 참고 하여 전체 모든 Job에 반영될수 있도록 아래처럼 처리한후 위 오류는 해결 되었다.
@RequiredArgsConstructor @Configuration @EnableBatchProcessing class BatchConfig extends DefaultBatchConfigurer { private final PlatformTransactionManager transactionManager; private final DataSource dataSource; @Override protected JobRepository createJobRepository() throws Exception { JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean(); factory.setDataSource(dataSource); factory.setTransactionManager(new DataSourceTransactionManager(dataSource)); factory.setIsolationLevelForCreate("ISOLATION_DEFAULT"); factory.setTablePrefix("BATCH_"); factory.afterPropertiesSet(); return factory.getObject(); } }
from http://hiphopddori.tistory.com/96 by ccl(A) rewrite - 2021-11-30 18:02:51