Repository navigation
fix: 정책 수집 배치 — 지역 행 전량 재작성 제거, 실행 거부 시 락 누수, 실패 지점 로깅 (#229) - #231
Merged
Merged
Conversation
- PolicyUpsertWriter: 기존 지역 코드 집합을 청크당 1쿼리로 떠서 새 집합과 비교하고, 같으면 policy_regions 삭제·삽입을 건너뛴다. 정책 본문만 바뀐 회차에서 전국 정책 1건당 DELETE 284 + INSERT 284가 그대로 나가던 것을 없앤다. 스냅샷 델타 쓰기(#73)의 의도를 지역 행까지 확장한 것. - PolicySyncService: batchTaskExecutor.execute()가 RejectedExecutionException으로 거부되면 실행 본체가 시작되지 않아 finally의 락 해제가 돌지 않았다. 거부 시 즉시 락을 풀고 예외를 다시 던진다. 그대로 두면 아무도 안 도는 채로 TTL 10분간 409만 나간다. - PolicyUpsertWriter: 건별 재시도까지 뚫린 예외는 앞선 청크가 이미 커밋된 상태인데 이력에는 카운트 0으로만 남아 진단이 불가능했다. 중단 시 처리/전체 건수와 신규·변경· 건별실패 카운트를 error 로그로 남긴다. 테스트 263건 통과 (sync / policy / admin.sync). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ESRTprV1GLdFjGrymsQMY4
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Reviewed by free · Input: 64.4K · Output: 7.2K · Cached: 150.9K |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
변경 내용
PolicyUpsertWriter— 지역 행 전량 재작성 제거기존 정책 갱신 시 지역이 바뀌었는지 보지 않고
policy_regions를 무조건 삭제 후 재삽입하고 있었다.청크당 1쿼리로 기존 지역 코드 집합을 떠서(
regionCodesByPolicyId) 새 집합과 비교하고, 같으면 건너뛴다.현재
regions284건 ·policy_regions123,651행 기준, 정책 본문만 바뀐 회차에서 전국 정책 1건당DELETE 284 + INSERT 284가 그대로 나가던 것을 없앤다. 스냅샷 델타 쓰기(feat: 온통청년 정책 데이터 수집 배치(스케줄러) 구현 #73)의 의도를 지역 행까지 확장한 것.
PolicySyncService— 실행 거부 시 락 누수 수정락을 잡은 뒤
batchTaskExecutor.execute()로 본체를 넘기는데, 락 해제가 본체의finally에 있었다.큐가 꽉 차
RejectedExecutionException이 나면 본체가 시작되지 않아finally도 돌지 않고,아무도 배치를 못 도는 채로 TTL 10분간 409만 나갔다. 거부 시 즉시 락을 풀고 예외를 다시 던진다.
PolicyUpsertWriter— 실패 지점 로깅건별 재시도까지 뚫린 예외는 앞선 청크가 이미 커밋된 상태인데 이력에는 카운트 0으로만 남아
어디까지 처리됐는지 알 수 없었다. 중단 시 처리/전체 건수와 신규·변경·건별실패 카운트를 error 로그로 남긴다.
검증
./gradlew test --tests "com.bop.youthpick.sync.*" --tests "com.bop.youthpick.policy.*" --tests "com.bop.youthpick.admin.sync.*"→ 263건 통과 / 실패 0 / 스킵 0
연결 이슈
Closes #229