The keycloak project ended with four open questions that design could not
settle. A two-VM lab was built to answer them by measurement, and this is
that material: 26 experiments, 125 raw command outputs, 22 browser captures.
Follows the import procedure in README.md.
source/ the originating repository verbatim — 78 documents, 28 SVGs,
8 manifests, plus .source-revision recording the commit
final/ the SSOT
document.md 729 lines written from the 29 experiment documents, not
concatenated: what was predicted, what was measured, and
where the measurement itself was wrong
evidence/raw 125 outputs, flattened to <experiment>__<file> because
the originals collided (01-baseline.txt appeared three
times) and the audit only globs the top level
evidence/meta one per raw file; command and exitCode are null and the
README says why rather than inventing them
evidence/browser 22 captures
assets/ three diagrams through techviz
.techviz/ their VizSpecs
A separate project rather than an addition to keycloak: the B-layer answers
that project's four questions, but the A, C and D layers are about cluster
failure, SSO and operations, and one document.md should hold one subject.
The four question records there can point here through 관계.
Recorded rather than papered over: only three of the 28 diagrams were
remade. The repository forbids hand-drawn SVG and forbids titles inside the
canvas; all 28 originals carry both, so converting them is redrawing, not
reformatting. They stay in source/ and the gap is written into the document.
verify-pipeline.py passes. audit-records.py reports no issues.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
98 lines
4.8 KiB
Markdown
98 lines
4.8 KiB
Markdown
---
|
|
kind: CASE
|
|
slug: messaging-kafka-f02
|
|
title: 천장에 닿아 일시정지된 파티션을 재개하는 경로가 없다
|
|
topic: transport-and-provider-semantics
|
|
project: clean-architecture-backend-template
|
|
status: 게시 전
|
|
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
|
|
rootTreeNode: case:messaging-kafka-f02
|
|
evidenceCapturedOn: 2026-09-01
|
|
assets:
|
|
- key: messaging-kafka-f02
|
|
file: ../../../final/evidence/rendered/messaging-kafka-f02.svg
|
|
- key: messaging-kafka-f02-diagram
|
|
file: ../../../final/assets/diagrams/messaging-kafka-f02.svg
|
|
evidence:
|
|
- ../../../final/evidence/raw/messaging-kafka-f02.txt
|
|
source:
|
|
- 원본 분석 절은 analysis/messaging/messaging-kafka.md#L265 이다.
|
|
module: messaging-kafka
|
|
priority: P2
|
|
---
|
|
|
|
# 천장에 닿아 일시정지된 파티션을 재개하는 경로가 없다
|
|
|
|
pollOnce 의 파티션 루프는 세 경우에 그 파티션을 멈춘다. 이 세 경로 중 어느 것도 retries.pauseUntil(...) 을 부르지 않는다.
|
|
|
|
## 문제
|
|
|
|
pollOnce 의 파티션 루프는 세 경우에 그 파티션을 멈춘다.
|
|
|
|
이 세 경로 중 어느 것도 retries.pauseUntil(...) 을 부르지 않는다.
|
|
|
|
## 결론
|
|
|
|
그런데 폴 루프가 파티션을 재개하는 곳은 하나뿐이다.
|
|
|
|
retries 에 항목을 넣는 곳은 QueuedSettlement.enqueueRequeue 하나이고, 그것은 핸들러 실패·타임아웃·명시적 requeue 경로다.
|
|
|
|
천장·배수·풀 거부 경로는 등록하지 않는다.
|
|
|
|
따라서 천장 때문에 멈춘 파티션은 폴 루프가 스스로 재개하지 않는다.
|
|
|
|
재개할 수 있는 것은 외부에서 부른 resume(scope) 이나 재조정뿐이다.
|
|
|
|
maxInFlightPerOrderingUnit 의 기본값은 1 이다(DestinationSettings.Consumer).
|
|
|
|
한 폴이 같은 파티션의 레코드를 둘 이상 돌려주는 순간 두 번째에서 tryAcquire 가 거짓이 되고, 그 파티션이 멈춘다.
|
|
|
|
그 뒤 작업자가 끝나 coordinator.release 로 슬롯이 비어도 consumer 는 여전히 일시정지 상태다.
|
|
|
|
## 검증 환경
|
|
|
|
OpenJDK : 21.0.12 java -version 으로 확인
|
|
Gradle : 9.0.0 src/gradle/wrapper/gradle-wrapper.properties 의 distributionUrl 로 확인
|
|
확인 방식 : QueuedSettlement 참조 3건 검색과 파티션을 멈추는 세 경로의 재개 등록 여부 확인
|
|
소스 수정 : x
|
|
|
|
## 재현 조건
|
|
|
|
원문은 analysis/messaging/messaging-kafka.md#L265 에 있다.
|
|
|
|
## 본문
|
|
|
|
<!-- body:start -->
|
|
|
|
`pollOnce` 의 파티션 루프는 세 경우에 그 파티션을 멈춘다 — 천장(`tryAcquire` 실패), 배수 시작(`tryBeginWork` 실패), 풀 거부(`dispatch` 실패). 이 세 경로 중 어느 것도 `retries.pauseUntil(...)` 을 부르지 않는다.
|
|
|
|
## 재개가 끊긴 자리
|
|
|
|
:::evidence key="messaging-kafka-f02-diagram" alt="핸들러 실패와 타임아웃과 requeue 만 재개 목록에 등록되는 경로 안에 놓이고 천장 도달과 배수 및 풀 거부가 바깥에 빗금으로 놓인다" caption="재개가 끊긴 자리" zoom="false"
|
|
:::
|
|
|
|
폴 루프가 파티션을 재개하는 곳은 `applyDueResumes` 하나이고 그것은 `retries.dueForResume(now)` 만 본다. `retries` 에 항목을 넣는 곳은 `QueuedSettlement.enqueueRequeue` 하나이고, 그것은 핸들러 실패·타임아웃·명시적 requeue 경로다.
|
|
|
|
## QueuedSettlement 참조 위치
|
|
|
|
:::evidence key="messaging-kafka-f02" alt="코드베이스에서 QueuedSettlement 를 검색한 출력 3줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="QueuedSettlement 코드베이스 검색 — 3줄 · exit 0" zoom="true"
|
|
:::
|
|
|
|
## 기본값이 이 경로를 흔하게 만든다
|
|
|
|
`maxInFlightPerOrderingUnit` 의 기본값은 1 이다(`DestinationSettings.Consumer`). 한 폴이 같은 파티션의 레코드를 둘 이상 돌려주는 순간 두 번째에서 `tryAcquire` 가 거짓이 되고 그 파티션이 멈춘다. 그 뒤 작업자가 끝나 `coordinator.release` 로 슬롯이 비어도 `consumer` 는 여전히 일시정지 상태다.
|
|
|
|
## 두 pause 가 구분되어 쓰인다
|
|
|
|
`applySettlements` 의 `PAUSE_AND_SEEK` 는 `coordinator.pause(...)` 와 `consumer.pause(...)` 를 둘 다 부르고, 천장 경로는 `consumer` 쪽만 부른다. 그래서 조정자는 그 파티션을 멈춘 것으로 알지 못하고, `tryAcquire` 는 계속 참을 답하는데 브로커에서 레코드가 오지 않는다.
|
|
|
|
## 수정
|
|
|
|
천장 경로가 `retries.pauseUntil(partition, seekBackTo, Duration.ZERO, now)` 를 등록하면 다음 주기의 `applyDueResumes` 가 즉시 재개한다 — 지연이 0 이므로 `dueForResume` 이 곧바로 돌려준다. 배수 경로는 재개하지 않는 것이 맞고, 풀 거부 경로는 천장과 같다. 소비 경로가 조립되지 않으므로(§12.1) P2.
|
|
|
|
## 확인하지 못한 것
|
|
|
|
실행으로 재현하지 않았다. resume 호출처가 둘뿐이고 천장 경로가 재개 목록에 아무것도 등록하지 않는다는 것으로 판정했다.
|
|
|
|
<!-- body:end -->
|