Files
document-haness/docs/clean-architecture-backend-template/tech-log-studio/multitenancy-isolation/reference/reference-isolation-settings-must-be-transaction-local.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

2.4 KiB

kind, slug, title, topic, project, status, sourceRevision, rootTreeNode, verifiedOn
kind slug title topic project status sourceRevision rootTreeNode verifiedOn
REFERENCE isolation-settings-must-be-transaction-local 격리 설정은 트랜잭션 로컬이어야 한다 multitenancy-isolation clean-architecture-backend-template 게시 전 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916 reference:isolation-settings-must-be-transaction-local

격리 설정은 트랜잭션 로컬이어야 한다

목적

테넌트 바인딩이나 검색 경로처럼 격리를 결정하는 세션 설정이 풀로 돌아간 커넥션에 남아, 다음 차용자가 그것을 상속하는 것을 막는다.

규칙

  1. 격리를 결정하는 설정은 트랜잭션과 함께 되돌아간다 세션 스코프면 커넥션이 살아 있는 동안 유지된다.

  2. 데이터베이스가 제공하는 트랜잭션 로컬 옵션을 쓴다 PostgreSQL 에서는 설정 함수의 세 번째 인자가 그것을 보장한다.

  3. 대응물이 없으면 반환 시 명시적으로 되돌린다 중립 값으로 재설정하는 것이 대안이다.

  4. 사용 전 덮어쓰기는 값이 항상 설정될 때만 안전하다 한 경로라도 설정 없이 커넥션을 쓰면 앞 사용자의 값이 적용된다.

  5. 커넥션이 테넌트에 고정 할당되면 이 문제가 사라진다 다만 그때는 풀 예산이 새 문제가 된다.

적용 조건

행 수준 보안의 테넌트 바인딩

테넌트별 스키마 라우팅

세션 상태로 표현되는 모든 격리

예외

테넌트별 데이터베이스처럼 커넥션 자체가 격리 경계인 구성. 그 경우 세션 스코프가 문제가 되지 않는다.

예시

검색 경로가 세션 설정이라 풀로 돌아간 커넥션이 마지막 테넌트의 스키마를 들고 있다. 다음 차용자는 어떤 문장도 틀리지 않은 채 거기서 읽고 쓴다.

로컬 타임아웃 설정은 매 트랜잭션 전에 다시 적용하는 방식으로 실무상 가려진다. 그 방식은 값이 항상 설정되는 경우에만 안전하다.

관계

  • search_path가 풀로 돌아간 커넥션에 남아 다음 tenant가 상속한다 이 규칙을 만든 사례다.
  • 세션 스코프 설정은 풀로 돌아간 커넥션에 남는다 같은 성질의 일반형이다.
  • RLS가 성립하기 위한 세 전제 테넌트 바인딩이 이 규칙을 따라야 하는 이유다.