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>
73 lines
4.3 KiB
Markdown
73 lines
4.3 KiB
Markdown
---
|
|
kind: CONCEPT
|
|
slug: messaging-inbox-jdbc-postgresql-c03
|
|
title: 두 오버로드가 있었고 호출되는 쪽이 틀린 쪽이었다
|
|
topic: transaction-and-consistency-models
|
|
project: clean-architecture-backend-template
|
|
status: 게시 전
|
|
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
|
|
rootTreeNode: concept:messaging-inbox-jdbc-postgresql-c03
|
|
evidenceCapturedOn: 2026-09-01
|
|
assets:
|
|
- key: messaging-inbox-jdbc-postgresql-c03
|
|
file: ../../../final/evidence/rendered/messaging-inbox-jdbc-postgresql-c03.svg
|
|
- key: messaging-inbox-jdbc-postgresql-c03-diagram
|
|
file: ../../../final/assets/diagrams/messaging-inbox-jdbc-postgresql-c03.svg
|
|
evidence:
|
|
- ../../../final/evidence/raw/messaging-inbox-jdbc-postgresql-c03.txt
|
|
source:
|
|
- 원본 분석 절은 analysis/messaging/messaging-inbox-jdbc-postgresql.md#L146 이다.
|
|
module: messaging-inbox-jdbc-postgresql
|
|
---
|
|
|
|
# 두 오버로드가 있었고 호출되는 쪽이 틀린 쪽이었다
|
|
|
|
`requireActiveTransaction`이 이 leaf에서 가장 중요한 안전 장치이고, 이전 결함이 javadoc에 있다. 현재는 interface 메서드가 세 가지를 확인한다.
|
|
|
|
## 관계
|
|
|
|
- **컬럼 폭은 애플리케이션 검증과 짝을 이룬다**
|
|
같은 분석 리프에서 끌어낸 규칙이다.
|
|
- **같은 안전 규칙은 한 공식과 한 강제 시점을 갖는다**
|
|
같은 분석 리프에서 끌어낸 규칙이다.
|
|
|
|
## 본문
|
|
|
|
<!-- body:start -->
|
|
|
|
이 leaf에서 가장 중요한 안전 장치이고 이전 결함이 javadoc에 있다.
|
|
|
|
> "Package-private. It used to be public and was the only path that actually joined the caller's transaction, while the interface method — the one `IdempotentConsumer` calls — opened a raw connection that auto-commits. A reservation that commits on its own while the business side effect rolls back is a message that will never be redelivered and whose work never happened."
|
|
|
|
**두 개의 오버로드가 있었고 호출되는 쪽이 틀린 쪽이었다.**
|
|
|
|
## 예약 전에 확인하는 세 가지
|
|
|
|
:::evidence key="messaging-inbox-jdbc-postgresql-c03-diagram" alt="requireActiveTransaction 경계 안에 활성 트랜잭션과 읽기 전용 아님과 같은 DataSource 세 상자가 나란히 들어 있는 구조" caption="예약 전에 확인하는 세 가지" zoom="false"
|
|
:::
|
|
|
|
| 검사 | 실패 시 메시지의 핵심 |
|
|
|---|---|
|
|
| `isActualTransactionActive()` | "a reservation that commits alone marks a message processed whose work may still roll back" |
|
|
| `!isCurrentTransactionReadOnly()` | "the current one is read-only" |
|
|
| `hasResource(dataSource)` | "it is bound to another, so the reservation and the side effect would commit independently" |
|
|
|
|
세 번째가 특히 정교하다 — **트랜잭션이 활성이어도 다른 DataSource에 묶여 있으면 거절한다.** 멀티 데이터소스 배포에서 실제로 발생하는 형태이고, 그 경우 예약과 부작용이 서로 다른 트랜잭션에 들어간다. 세 검사 전부 같은 코드 `INBOX_TRANSACTION_REQUIRED`를 쓴다 — 메시지만 다르다.
|
|
|
|
## InboxPostgresIT 참조 위치
|
|
|
|
:::evidence key="messaging-inbox-jdbc-postgresql-c03" alt="코드베이스에서 InboxPostgresIT 를 검색한 출력 2줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="InboxPostgresIT 코드베이스 검색 — 2줄 · exit 0" zoom="true"
|
|
:::
|
|
|
|
**"the path nobody exercises before production"**가 이 leaf의 테스트 전략을 설명한다 — `InboxPostgresIT.aRolledBackTransactionLeavesNoReservationAndNoSideEffect`가 정확히 그 경로를 실 DB에서 돈다.
|
|
|
|
## 위임과 검증이 짝을 이룬다
|
|
|
|
`TransactionRunner`가 함수형 인터페이스이고 `<T> T inTransaction(Supplier<T> work)` 하나다. 즉 이 leaf는 Spring `@Transactional`에 의존하지 않고 **경계 제공을 호출자에게 위임**한다. `JdbcInboxRepository.requireActiveTransaction`이 그 위임이 지켜졌는지를 런타임에 확인한다.
|
|
|
|
## 중복이 정상 결과라는 명시
|
|
|
|
"A duplicate is not an error. It is the expected consequence of at-least-once delivery, so the skip path is a normal outcome rather than an exception." 세 금지가 `messaging-reliability-api`의 `TransactionalMessageAction` javadoc이 구현자에게 요구한 것과 대칭이다 — 그쪽은 action에게, 이쪽은 handler에게.
|
|
|
|
<!-- body:end -->
|