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>
3.9 KiB
kind, slug, title, topic, project, status, sourceRevision, rootTreeNode, evidenceCapturedOn, assets, evidence, source, module
| kind | slug | title | topic | project | status | sourceRevision | rootTreeNode | evidenceCapturedOn | assets | evidence | source | module | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| CONCEPT | messaging-transport-spi-c03 | 회전은 변경이 아니라 교체다 | state-machines-and-ownership | clean-architecture-backend-template | 게시 전 | 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916 | concept:messaging-transport-spi-c03 | 2026-09-01 |
|
|
|
messaging-transport-spi |
회전은 변경이 아니라 교체다
자격증명 회전과 토폴로지 재적재는 살아 있는 세대를 바꾸지 않고 통째로 교체한다. 진행 중인 발행은 시작한 세대를 유지한다.
관계
- 멱등 종료를 보장하는 컴포넌트는 종료 이후의 등록도 정의한다 같은 분석 리프에서 끌어낸 규칙이다.
- 같은 개념의 sentinel은 계층을 넘어 하나로 정한다 같은 분석 리프에서 끌어낸 규칙이다.
본문
세대 모델의 근거가 javadoc에 있다.
"Credential rotation and topology reload replace a whole generation rather than mutating a live one. In-flight publishes keep the generation they started on, which is what makes a rotation invisible to callers instead of a burst of authentication failures."
회전이 교체인 순서
:::evidence key="messaging-transport-spi-c03-diagram" alt="새 세대 설치와 옛 세대 은퇴와 lease 반환 대기와 정확히 한 번 close 가 왼쪽에서 오른쪽으로 이어지는 구조" caption="회전이 교체인 순서" zoom="false" :::
ConcurrentHashMap.put이 원자적이므로 호출자는 옛 세대 또는 새 세대만 본다 — javadoc: "never a half-rebuilt connection pool". computeIfPresent의 리맵 함수가 버킷 잠금 안에서 실행되므로, 조회와 증가가 원자적이다. get 후 증가였다면 그 사이에 install이 세대를 교체해 이미 은퇴한 세대의 계수를 올릴 수 있다.
ConcurrentHashMap 참조 위치
:::evidence key="messaging-transport-spi-c03" alt="코드베이스에서 ConcurrentHashMap 를 검색한 출력 2줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="ConcurrentHashMap 코드베이스 검색 — 2줄 · exit 0" zoom="true" :::
두 층의 멱등성
closed가 CAS로 보호되므로 정확히 한 번만 runtime.close()가 불린다. 테스트가 그것을 직접 단언한다(aRetiredGenerationIsClosedExactlyOnce, as("a second close on a real connection pool throws from a shutdown hook")). Lease.close()도 자체 AtomicBoolean released로 멱등이다.
고쳐진 세 결함
세대별 은퇴 시각 — 하나의 타임스탬프를 전체 목록에 적용하면 회전이 겹칠 때 판정이 호출자가 우연히 넘긴 값에 좌우된다. 닫힌 세대의 목록 제거 — drainingCount()가 관측 지표이므로, 이미 닫힌 세대가 목록에 남으면 지표가 영원히 0으로 안 떨어진다. close()가 현재 세대까지 닫는다 — 회전 없이 종료하는 프로세스(=대부분의 프로세스)가 연결을 정리하지 않았다.
남은 미세 결함과 이중 검사
close()가 draining은 synchronized로 비우지만 current는 List.copyOf(current.keySet()) 후 하나씩 remove한다. 그 사이에 install이 새 세대를 넣으면 그 세대는 닫히지 않는다. 종료 중 설치는 정상 시나리오가 아니므로 실질 위험은 낮다 — §17의 P3. tryBeginWork는 이중 검사다 — 증가 후 다시 확인해서 증가와 beginDrain 사이의 경합에서 계수를 되돌린다.