반응형
테스트 개발 환경에서 잘 구동되었던 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();
}
}
반응형
'BackEnd > spring' 카테고리의 다른 글
[이슈 해결] JPA save 와 Stomp 메세지 처리 이슈 (0) | 2022.04.03 |
---|---|
Reactive Kafka in Spring Kafka (0) | 2022.03.16 |
@JsonSetter (0) | 2021.07.10 |
layer dockerfile (0) | 2021.06.28 |
Springboot dockerfile 없이 이미지 생성하기 bootBuildImage (0) | 2021.06.28 |