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.6 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 | adapter-outbound-persistence-mongo-c03 | 아직 쓰이지 않은 연산에도 같은 불변식이 성립하게 만든 순서 | transaction-and-consistency-models | clean-architecture-backend-template | 게시 전 | 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916 | concept:adapter-outbound-persistence-mongo-c03 | 2026-09-01 |
|
|
|
adapter-outbound-persistence-mongo |
아직 쓰이지 않은 연산에도 같은 불변식이 성립하게 만든 순서
DefaultMongoImperativeExecutor.executeInternal(...)이 collection profile 해석 → observation 개시 → consistency 바인딩 → callback 실행 → 실패 번역(최대 한 번) → observation 종료 순서를 고정한다.
본문
DefaultMongoImperativeExecutor.executeInternal(...)은 순서를 고정한다 — collection profile 해석 → observation 개시 → consistency 바인딩 → callback 실행 → 실패 번역(최대 한 번) → observation 종료. javadoc이 이유를 적는다: "Fixing it here is what makes the invariants hold for operations nobody has written yet."
실행 scope의 고정된 순서
:::evidence key="adapter-outbound-persistence-mongo-c03-diagram" alt="profile 해석과 observation 개시와 consistency 바인딩과 callback 실행이 왼쪽에서 오른쪽으로 이어지는 구조" caption="실행 scope 의 고정된 순서" zoom="false" :::
세 가지 방어
- 이미 번역된
MongoPersistenceException은 그대로 통과시킨다. 재번역하면 bulk partial failure나 guardrail 거절처럼 그것을 던진 계층이 더 잘 아는 category를, driver 코드에서 유도한 일반 category로 덮어쓰게 된다. - Spring이 감싼 driver 예외를
unwrap(...)으로 되꺼낸다. Spring의 번역은 error label을 잃는데, label이야말로 replayable transaction과 unknown commit을 가르는 값이다. MongoCompletion.successOutcomeFor(operationType)가 read와 write의 성공 outcome을 나눈다.
MongoPersistenceException 참조 위치
:::evidence key="adapter-outbound-persistence-mongo-c03" alt="코드베이스에서 MongoPersistenceException 를 검색한 출력 28줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="MongoPersistenceException 코드베이스 검색 — 28줄 · exit 0" zoom="true" :::
성공 outcome을 read와 write로 나눈 이유
과거에는 두 executor 모두 성공을 WRITE_CONFIRMED로 기록해, "write가 acknowledge되고 있는가"를 답하는 지표가 read 트래픽의 함수가 됐다. default 분기가 READ_CONFIRMED로 떨어지는 것도 의도적이다 — "the honest answer is the one that claims least".
동적 collection 이름을 우회할 방법이 없는 이유
MongoCollectionProfileRegistry가 "동적 collection 이름 금지"를 강제 가능하게 만드는 지점이다. 애플리케이션은 profile을 부르고 물리 이름은 이 registry만 안다. ScopedAccess.collection(String)은 요청된 collection이 scope의 것과 다르면 거부하고, ScopedMongoOperations의 어떤 메서드도 collection 인자를 받지 않는다.