Refactor: Mongo delete outbox 구조 정리 및 생성 충돌 테스트 보강#188
Merged
Conversation
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.
🛰️ Issue Number
🪐 작업 내용
1. Outbox 패키지/네이밍 정리
global.mongo.deletion패키지를global.mongo.outbox중심으로 재구성했습니다.MongoDeleteOutboxCompleteService를MongoDeleteOutboxLifecycleService로 변경하는 등 역할이 드러나는 이름으로 정리했습니다.JpaConfig의 JPA repository scan 경로도 새 패키지 기준으로 반영했습니다.2. Outbox 생성 충돌 흐름 정리
개요
Mongo 삭제 Outbox 관련 패키지 구조를
outbox중심으로 정리하고, Outbox 생성 충돌 처리 흐름과 테스트를 보강했습니다.기존에는
MongoDeleteOutboxFactory가 같은 트랜잭션 안에서find -> save -> 충돌 후 재조회까지 처리하고 있었고, 이 과정에서 동시성 경쟁 시 Hibernate 세션 오염이나 rollback-only 전파로 한 요청이 후속 예외로 종료될 수 있었습니다. 이번 변경에서는 Factory의 트랜잭션 경계를 제거하고, 충돌 시 기존 Outbox를 재조회하는 단순한 흐름으로 정리했습니다.테스트
bash ./gradlew compileJava compileTestJavabash ./gradlew test --tests '*MongoDeleteOutboxFactoryUnitTest'참고
MongoDeleteOutboxRaceIntegrationTest는 로컬 Mongo test 환경 설정에 영향을 받을 수 있습니다.3. 동시 생성 경쟁 테스트 추가
MongoDeleteOutboxRaceIntegrationTest를 추가했습니다.최종적으로 두 요청이 같은 outbox를 반환하는지 검증하도록 했습니다.
4. 기타
📚 Reference
✅ Check List