--- kind: CONCEPT slug: adapter-outbound-cache-redis-c13 title: 등록되지 않은 스크립트는 서버에 닿을 방법이 없다 topic: transaction-and-consistency-models project: clean-architecture-backend-template status: 게시 전 sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916 rootTreeNode: concept:adapter-outbound-cache-redis-c13 evidenceCapturedOn: 2026-09-01 assets: - key: adapter-outbound-cache-redis-c13 file: ../../../final/evidence/rendered/adapter-outbound-cache-redis-c13.svg - key: adapter-outbound-cache-redis-c13-diagram file: ../../../final/assets/diagrams/adapter-outbound-cache-redis-c13.svg evidence: - ../../../final/evidence/raw/adapter-outbound-cache-redis-c13.txt source: - 원본 분석 절은 final/document.md#a10#L701 이다. module: adapter-outbound-cache-redis --- # 등록되지 않은 스크립트는 서버에 닿을 방법이 없다 `RedisScriptRegistry`가 등록을 배포 단계로 두고, 트랜잭션 창은 감시 키에서 정한 노드에 고정된다. ## 본문 `RedisScriptRegistry`의 규칙 — "Registration is a deployment step, not a request-time one. A script that was never registered has no digest and therefore **no way to reach the server**, which is what makes 'only reviewed scripts run' a structural property rather than a convention." 같은 identity에 다른 body를 등록하면 거부하고, 실행 시점에도 body가 등록본과 같은지 다시 본다. ## 등록과 실행의 분리 :::evidence key="adapter-outbound-cache-redis-c13-diagram" alt="배포 시 스크립트 등록과 digest 대조와 EVALSHA 실행이 왼쪽에서 오른쪽으로 이어지는 구조" caption="등록과 실행의 분리" zoom="false" ::: README가 주장하는 복구 사슬 `EVALSHA → NOSCRIPT → SCRIPT LOAD → digest verify → EVALSHA`는 **실재한다** — `LettuceRedisScriptOperations:26` javadoc이 "NOSCRIPT is the one failure retried automatically"라고 적고, `:129-133`이 `RedisNoScriptException` 또는 메시지 접두 `NOSCRIPT`를 잡아 `:100`에서 `registry.forget(script.id())`를 호출한다. 다음 호출이 `digest(...)`에서 다시 `SCRIPT LOAD`한다. ## RedisScriptRegistry 참조 위치 :::evidence key="adapter-outbound-cache-redis-c13" alt="코드베이스에서 RedisScriptRegistry 를 검색한 출력 7줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="RedisScriptRegistry 코드베이스 검색 — 7줄 · exit 0" zoom="true" ::: ## Cluster에서 MULTI 창을 노드에 고정하는 방법 `RedisTransactionRunner`는 Cluster에서의 `MULTI` 문제를 정면으로 다룬다. javadoc이 문제와 해법을 적는다 — 다른 레인은 명령마다 슬롯 소유 노드로 라우팅하는데 "that is exactly what a `MULTI` window must not do: the queued commands would be spread across nodes and none of them would be part of the same window." 해법은 연결이 아니라 **라우팅 결정**이었다 — 감시 키(또는 명시적 슬롯 태그)에서 노드를 정해 레인을 고정한다. ## 감시 키가 없는 Cluster 트랜잭션을 거부하는 이유 "the keys the callback will queue are not known until the callback runs, which is after the window is open."