Repository navigation
아웃박스 공통 구조 분리 (1단계) - #1262
Merged
Merged
아웃박스 공통 구조 분리 (1단계)#1262
Conversation
- common/outbox 패키지 추가
- Outbox: 상태 전이·회수 상한·펜싱을 맡는 @MappedSuperclass
- OutboxJpaRepository: SKIP LOCKED 집기·회수 쿼리를 #{#entityName} 으로 한 번만 선언
- OutboxQueue: 집기·되돌리기·회수를 RC 트랜잭션으로 엶. 회수 상한 동작은 하위 클래스가 onExhausted 로 구현
- OutboxPolicy: 회수 기준·회수 상한·처리 상한 묶음
- OutboxRepositoryAdapter: 도메인 저장소가 save·findHeldForUpdate 를 상속
- 파싱 아웃박스를 공통 구조 위로 이전
- 마이그레이션 0·의도한 동작 변화 0
- RC 를 @transactional 대신 TransactionTemplate 으로 엶
- 원인: 프록시를 거치지 않는 방식 필요
- Kotlin 추상 클래스 메서드는 final 이라 프록시가 못 가로채면 isolation 이 조용히 빠짐
- 테스트가 저장소를 감싼 큐를 직접 만들어도 RC 가 그대로 걸림
- 바깥 트랜잭션 안에서의 집기·되돌리기·회수 호출 거부
- 원인: Spring 이 기존 트랜잭션에 합류하면 isolation 설정을 무시함
- 집기·회수 잠금 조회를 도메인 저장소에서 제거
- 원인: 서비스 트랜잭션 안에서 직접 부르면 RR gap 잠금이 돌아옴
- 성공·실패·되돌리기 전이가 시도를 받아 행을 쥔 시도만 반영
- 이전: 호출하는 쪽이 findHeldForUpdate 를 골라 써야 펜싱이 걸림
- 처리 상한 검사를 스케줄러 init 에서 OutboxPolicy 생성자로 이관
- 계약 테스트 OutboxQueueContract 추가
- JUnit 인터페이스 default @test 5건: RC·SKIP LOCKED·펜싱·바깥 트랜잭션 거부·(status, created_at) 인덱스
- 대안: 추상 테스트 클래스 상속
- 기각: 메타 테스트가 IntegrationTest 파일에 IntegrationTestSupport 직접 상속을 요구함
- 결과: 보장을 하나씩 뺀 음성 대조에서 그 보장의 테스트만 실패
- ItemParsingClaimConcurrencyIntegrationTest 는 계약으로 흡수
- dispatch·recover @scheduled 루프는 파싱 도메인에 남김
- 원인: 주기·풀 크기·처리 상한이 도메인 값
- 원인: Spring 7 의 TransactionTemplate.execute 가 콜백의 non-null 타입을 그대로 돌려줌 - 결과: Elvis 가 항상 왼쪽을 돌려준다는 컴파일 경고 2건
Closed
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
Discord 스레드 연동용 메타데이터입니다. discord-pr-bot 워크플로가 자동 생성하며, 수정·삭제하면 PR 과 Discord 알림 연동이 끊깁니다. |
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.
한눈에
아웃박스 공통 뼈대 분리
Situation
다음 아웃박스에서 흩어지는 RC
Task
공통 구조 분리
Action
공통 뼈대 추가
OutboxOutboxJpaRepositoryOutboxQueueOutboxPolicyOutboxRepositoryAdapterRC 를 트랜잭션 템플릿으로 엶
@Transactional(isolation = READ_COMMITTED)바깥 트랜잭션 안의 호출 거부
REQUIRES_NEW)NEVER)validateExistingTransaction)잠금 조회를 도메인 저장소에서 제거
펜싱을 상태 전이에 넣음
처리 상한 검사를 정책 생성자로 이관
루프는 파싱 도메인에 남김
@Scheduled루프계약 테스트 추가
OutboxQueueContract의 default 테스트 5건: IntegrationTestSupport(), OutboxQueueContract<T>한 줄로 검증받음(status, created_at)으로 시작하는 인덱스기타
Result
음성 대조
위험
후속
연관 이슈