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>
61 lines
3.3 KiB
Markdown
61 lines
3.3 KiB
Markdown
---
|
|
kind: CONCEPT
|
|
slug: messaging-outbox-jdbc-postgresql-c03
|
|
title: 확률을 낮추는 것과 데이터 제약으로 만드는 것은 다르다
|
|
topic: delivery-and-settlement-models
|
|
project: clean-architecture-backend-template
|
|
status: 게시 전
|
|
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
|
|
rootTreeNode: concept:messaging-outbox-jdbc-postgresql-c03
|
|
evidenceCapturedOn: 2026-09-01
|
|
assets:
|
|
- key: messaging-outbox-jdbc-postgresql-c03
|
|
file: ../../../final/evidence/rendered/messaging-outbox-jdbc-postgresql-c03.svg
|
|
evidence:
|
|
- ../../../final/evidence/raw/messaging-outbox-jdbc-postgresql-c03.txt
|
|
source:
|
|
- 원본 분석 절은 analysis/messaging/messaging-outbox-jdbc-postgresql.md#L177 이다.
|
|
module: messaging-outbox-jdbc-postgresql
|
|
---
|
|
|
|
# 확률을 낮추는 것과 데이터 제약으로 만드는 것은 다르다
|
|
|
|
V1 — message_id 를 대리키가 아니라 기본키로 삼는다. 인덱스도 근거가 있다.
|
|
|
|
## 본문
|
|
|
|
<!-- body:start -->
|
|
|
|
마이그레이션 네 개가 이 리프의 이력을 담고 있다.
|
|
|
|
## V1 — message_id 가 기본키인 이유
|
|
|
|
대리키가 아니라 기본키다 — 릴레이가 모든 재시도에서 보존해야 하는 논리적 정체이고, 그것을 키로 만들면 어떤 경로도 같은 행을 새 id로 발행할 수 없다. 인덱스도 근거가 있다 — 부분 인덱스인 이유("PUBLISHED rows accumulate until the retention job removes them"), `IN_FLIGHT` 를 포함하는 이유("A relay that dies mid-publish leaves rows in that state ... omitting them here would strand those messages").
|
|
|
|
## V2 — 펜싱 토큰
|
|
|
|
주석이 시나리오를 그대로 적는다 — relay A 가 청구하고 브로커를 부르는 사이 lease 가 만료되고, relay B 가 재청구해 발행하고 PUBLISHED 를 기록한다. "확률을 낮추는 것과 데이터 제약으로 만드는 것은 다르다" — 이 리프에서 가장 좋은 한 줄이다. `EXHAUSTED` 상태 추가와 `next_attempt_at` 인덱스도 여기서 들어온다.
|
|
|
|
## 이 기록이 다루는 범위
|
|
|
|
:::evidence key="messaging-outbox-jdbc-postgresql-c03" alt="코드베이스에서 파일 목록을 만든 출력 13줄. 이 기록이 다루는 범위가 그 목록이다." caption="코드베이스 파일 목록 — 13줄 · exit 0" zoom="true"
|
|
:::
|
|
|
|
## V3 — admin 저널
|
|
|
|
복합 기본키 `(approval_ticket, plan_digest)` 의 근거가 `messaging-admin-api` 의 것과 동일하게 적혀 있다.
|
|
|
|
## V4 — 정경 메타데이터 12컬럼
|
|
|
|
왜 봉투 blob 이 아니라 컬럼인지가 명확하다. 그리고 밀반입 문제를 명시한다 — "smuggled through the header map under the reserved `msg.*` names ... a row whose header map contains `msg.id` overwrites another message's identity on the wire". DB 레벨 제약을 Java 와 이중으로 거는 이유도 적혀 있다. 마지막으로 **생성 컬럼**이 두 릴레이의 합의를 하나로 만든다.
|
|
|
|
## 이 수정이 properties 파일에는 도달하지 않았다
|
|
|
|
§12.4(a).
|
|
|
|
## append 가 보는 세 가지
|
|
|
|
`:228-245` — 활성 트랜잭션이 있는가 / 읽기 전용이 아닌가 / **이 DataSource 에 바인딩되어 있는가**. 세 번째가 특히 좋다 — 다른 DataSource 의 트랜잭션 안에서 append 하면 둘이 독립적으로 커밋된다. `append(Connection, OutboxRecord)` 가 package-private 으로 내려간 이력도 적혀 있다.
|
|
|
|
<!-- body:end -->
|