카프카 트랜잭션
-
카프카 핵심 가이드 5 : 멱등성책책책 책을 읽읍시다/프로그래밍 2023. 6. 12. 23:07
8. '정확히 한 번' 의미 구조 멱등적 프로듀서 멱등성 의미 구조가 아닌 '최소 한 번' 의미 구조를 가지도록 프로듀서를 설정한다면, 프로듀서가 메세지 전송을 재시도함으로써 메세지가 최소 한 번 이상 도착할 수 있는 불확실성이 존재하게 된다. 이렇게 재시도는 메세지 중복으 발생시킬 수 있다. 가장 고전적인 경우리면, 이런 경우가 있겠다. 파티션 리더가 프로듀서로부터 레코드를 받아서 팔로워들에게 성공적으로 복제한다. 프로듀서에게 응답을 보내기 전, 파티션 리더가 있는 브로커에 크래시가 발생한다. 프로듀서 입장에서는 응답을 받지 못한 채 타임아웃이 발생하고, 메세지를 재전송한다. 재전송된 메세지가 새 리더에 도착한다. 하지만 이 메세지는 이미 저장되어 있다(결과적으로, 중복이 발생한다). 어떤 애플리케..