Files
document-haness/docs/clean-architecture-backend-template/tech-log-studio/state-machines-and-ownership/concept/concept-adapter-outbound-persistence-mongo-c04.md
T
DongHyeonkaandClaude Opus 5 b2963105a8 docs(keycloak-session-store): import the session-storage lab as a new project
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>
2026-09-04 22:51:59 +09:00

50 lines
3.1 KiB
Markdown

---
kind: CONCEPT
slug: adapter-outbound-persistence-mongo-c04
title: 취소된 stream은 성공도 실패도 기록하지 않는다
topic: state-machines-and-ownership
project: clean-architecture-backend-template
status: 게시 전
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
rootTreeNode: concept:adapter-outbound-persistence-mongo-c04
evidenceCapturedOn: 2026-09-01
assets:
- key: adapter-outbound-persistence-mongo-c04
file: ../../../final/evidence/rendered/adapter-outbound-persistence-mongo-c04.svg
- key: adapter-outbound-persistence-mongo-c04-diagram
file: ../../../final/assets/diagrams/adapter-outbound-persistence-mongo-c04.svg
evidence:
- ../../../final/evidence/raw/adapter-outbound-persistence-mongo-c04.txt
source:
- 원본 분석 절은 analysis/06-adapter-outbound-persistence-mongo.md#L648 이다.
module: adapter-outbound-persistence-mongo
---
# 취소된 stream은 성공도 실패도 기록하지 않는다
`DefaultReactiveMongoExecutor`의 javadoc이 blocking 경로가 공짜로 얻는 것과 여기서 직접 배치해야 하는 것을 대비한다. 그 배치의 결과로 취소된 stream이 `result=unknown` 버킷에 남는다.
## 본문
<!-- body:start -->
`DefaultReactiveMongoExecutor`의 javadoc이 blocking 경로가 공짜로 얻는 것과 여기서 직접 배치해야 하는 것을 대비한다.
## 반응형 경로가 직접 배치한 것
:::evidence key="adapter-outbound-persistence-mongo-c04-diagram" alt="실행기 경계 안에 관측 범위와 조립 후 timeout 과 Reactor Context 이동 세 상자가 나란히 들어 있는 구조" caption="반응형 경로가 직접 배치한 것" zoom="false"
:::
observation scope를 Reactor 자원(`Mono.using`/`Flux.using`)으로 두어 완료·오류·**취소** 모두에서 닫는다. HTTP 클라이언트 연결 해제가 취소를 일으키므로 취소가 흔한 경우다. timeout은 조립된 publisher에 적용한다 — 구독 전에 적용하면 "람다를 만드는 데 걸린 시간"을 재게 된다. context는 Reactor Context로 옮긴다(`ReactiveMongoContextKeys`) — 체인은 operator 경계마다 스레드를 바꾸므로 구독 시점의 `ThreadLocal`은 driver 응답 시점에 이미 없다.
## DefaultReactiveMongoExecutor 참조 위치
:::evidence key="adapter-outbound-persistence-mongo-c04" alt="코드베이스에서 DefaultReactiveMongoExecutor 를 검색한 출력 8줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="DefaultReactiveMongoExecutor 코드베이스 검색 — 8줄 · exit 0" zoom="true"
:::
## result=unknown 버킷이 두 가지를 함께 담는다
`executeMany(...)`는 성공을 `doOnComplete`로 기록하므로 **취소된 stream은 success도 failure도 기록하지 않는다.** observation은 `close()`되고 초기 tag(`result=unknown`, `failureCategory=none`)로 한 번 계수된다. 취소가 흔한 경로라는 점을 감안하면 이는 의도된 분류로 보이지만, `result=unknown` bucket이 "취소"와 "관측 시작 직후 예외"를 함께 담는다는 사실은 계약에 없다. P3/기록.
<!-- body:end -->