스프링 배치가 잘못된 항목을 분리하는 데 필수적이며 기본적으로 청크를 롤백하고 각 항목을 커밋 비율 = 1로 작성하여 잘못된 프로세서 또는 프로세서 중 하나를 찾습니다 (
).
는 spring batch forum comment to similar problem
관련 부분
--> 5 items read, processing starts
<processor called:15>
<processor called:16>
<processor called:17> will throw an error on write
<processor called:18>
<processor called:19>
<before write:[15, 16, 17, 18, 19]>
<on write error>
--> error on item 17, but it was in the list, lets find it
--> rollback
<before chunk>
--> spring batch goes through all items of the chunk again to find the bad item
--> basically it runs now with commit-rate="1" (only for this chunk)
<processor called:15>
<after write:[15]>
<after chunk>
<before chunk>
<processor called:16>
<after write:[16]>
<after chunk>
<before chunk>
<processor called:17> called again for the bad item, because it's still unknown to spring batch, that this is the bad one
--> no write, because itemWriter.write() was called with the bad item only and did throw an exception (again)
--> but now spring batch knows the bad item
<before chunk>
안녕 마이클를 참조하십시오. 답장을 보내 주셔서 감사합니다. 승인. 너의 요점이있어. 작성자가 첫 번째 예외를 치면 롤백이 발생합니다. 그 예외가 1000 레코드 중 레코드 4에서 발생한다고 가정 해보십시오. 그래서 작가는 커밋 간격 1로 글쓰기를 시작하고 네 번째 항목을 찾습니다. 남은 996 개의 레코드를 청크로 다시 작성하는 것이 현명하지 않아야합니까 ?? 그것은 가능합니까 ??? – Nik
JIRA 티켓으로 시도해 볼 수 있습니다. 실용적인 접근법, 재시작 가능성, 결정 론적 동작 또는 여러 오류가 발생할 경우 복잡한 청크 컨트롤 같은 잠재적 인 문제를 볼 수 있습니다. 결국 동적/적응 청크 개념이 필요합니다. ... 멋진 소리 btw –
답장을 보내 주셔서 감사합니다! 나는 초보자이므로 JIRA 티켓을 여는 방법을 모르겠다. 그러나 주말에 그것을 조사하려고 노력할 것이다. 문제에 대한 나의 접근 방식은 잘못된 것일까 ??? 시나리오 : 데이터베이스에 레코드 일괄 처리를 작성하고 잘못된 항목이 있으면 항목을 건너 뛰고 (잘못된 항목을 기록 할 수 있음) onSkipOnWrite 메소드를 제외하고 잘못된 항목을 기록하는 다른 방법이 있습니까? 위의 문제를 극복 ?? – Nik