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>
15 lines
5.8 KiB
JSON
15 lines
5.8 KiB
JSON
{
|
|
"assetKey": "a05-f027-maximum-attempts-reclaim",
|
|
"kind": "terminal",
|
|
"command": "set -e\nmkdir -p /tmp/probe\nCT=cleanup-reclaim-probe\ndocker rm -f \"$CT\" >/dev/null 2>&1 || true\ndocker run -d --name \"$CT\" --network \"container:workmachine\" \\\n -e POSTGRES_PASSWORD=probe -e POSTGRES_USER=probe -e POSTGRES_DB=probe \\\n postgres:16-alpine -p 55432 >/dev/null\nfor i in $(seq 1 40); do\n docker inspect -f '{{.State.Running}}' \"$CT\" | grep -q true || { echo '컨테이너가 뜨지 않았다'; exit 1; }\n docker exec \"$CT\" pg_isready -U probe -p 55432 >/dev/null 2>&1 && break\n sleep 1\ndone\ndocker exec \"$CT\" psql -U probe -p 55432 -d probe -tAc 'select version()' | cut -c1-24\nM=adapter/outbound/persistence-jpa/src/main/resources/db/migration\nfor d in postgresql jpa/core jpa/fileserver; do\n for f in $(ls \"$M/$d\"/V*.sql | sort -V); do\n docker exec -i \"$CT\" psql -U probe -p 55432 -d probe -q -v ON_ERROR_STOP=1 < \"$f\" >/dev/null 2>&1 || true\n done\ndone\n\necho\necho '# 저장소의 청구 문장과 회수 문장을 아홉 번 반복한다.'\necho '# 시계 출처만 DB 로 바꿨다. 조건과 열은 저장소 질의 그대로다.'\necho '# 회수 대상을 고르는 조회는 태우지 않는다 — 그 조회에도 시도 한계가 없음은 따로 확인했다.'\ncat > /tmp/probe/cp.sh <<'CPSH'\n# 락파일의 한 구성에 실린 좌표 전부를 캐시 경로로 바꾼다. Gradle 실행 없이 재현된다.\nLOCK=${1:-adapter/outbound/persistence-jpa/gradle.lockfile}\nCONF=${2:-postgresqlIntegrationTestRuntimeClasspath}\nCACHE=/root/.gradle/caches/modules-2/files-2.1\ncp=\"\"\nwhile IFS= read -r line; do\n coord=${line%%=*}; confs=${line#*=}\n case \",$confs,\" in *\",$CONF,\"*) ;; *) continue ;; esac\n group=${coord%%:*}; rest=${coord#*:}; name=${rest%%:*}; ver=${rest##*:}\n jar=$(find \"$CACHE/$group/$name/$ver\" -name '*.jar' ! -name '*sources*' ! -name '*javadoc*' 2>/dev/null | head -1)\n [ -n \"$jar\" ] && cp=\"$cp:$jar\"\ndone < <(grep -E '^[a-zA-Z0-9._-]+:[^=]+=' \"$LOCK\")\necho \"${cp#:}\"\nCPSH\ncat > /tmp/probe/CleanupReclaimProbe.java <<'JAVA'\nimport java.sql.Connection;\nimport java.sql.DriverManager;\nimport java.sql.ResultSet;\nimport java.sql.Statement;\nimport java.util.UUID;\n\n/** 청구와 리스 만료 회수를 아홉 번 반복한다. 저장소의 두 질의를 그대로 쓴다. */\npublic class CleanupReclaimProbe {\n\n private static final int MAXIMUM_ATTEMPTS = 8;\n\n private static final String CLAIM =\n \"update fs_cleanup_item set status = 'IN_PROGRESS', claim_owner = ?, claim_token = ?,\"\n + \" lease_until = now() + interval '1 second', claim_fence = claim_fence + 1,\"\n + \" updated_at = now() where cleanup_id = ? and status in ('PENDING', 'FAILED')\";\n\n private static final String RECLAIM =\n \"update fs_cleanup_item set status = 'FAILED', attempt = attempt + 1,\"\n + \" next_attempt_at = now(), last_error_code = 'CLAIM_LEASE_EXPIRED',\"\n + \" claim_owner = null, claim_token = null, lease_until = null, updated_at = now()\"\n + \" where cleanup_id = ? and claim_token = ? and status = 'IN_PROGRESS'\";\n\n public static void main(String[] args) throws Exception {\n try (Connection db = DriverManager.getConnection(\n \"jdbc:postgresql://127.0.0.1:55432/probe\", \"probe\", \"probe\")) {\n UUID id = UUID.randomUUID();\n try (Statement s = db.createStatement()) {\n s.execute(\"delete from fs_cleanup_item\");\n }\n try (var insert = db.prepareStatement(\n \"insert into fs_cleanup_item (cleanup_id, content_key, type, attempt, next_attempt_at,\"\n + \" status, claim_fence, created_at, updated_at)\"\n + \" values (?, 'k', 'ORPHAN_PHYSICAL_OBJECT', 0, now(), 'PENDING', 0, now(), now())\")) {\n insert.setObject(1, id);\n insert.executeUpdate();\n }\n System.out.println(\"최대 시도 횟수 상수 : \" + MAXIMUM_ATTEMPTS);\n\n for (int round = 1; round <= 9; round++) {\n UUID token = UUID.randomUUID();\n try (var claim = db.prepareStatement(CLAIM)) {\n claim.setString(1, \"worker\");\n claim.setObject(2, token);\n claim.setObject(3, id);\n if (claim.executeUpdate() == 0) {\n System.out.println(round + \" 회차: 청구 실패 — 더 이상 청구 가능한 상태가 아니다\");\n break;\n }\n }\n try (var reclaim = db.prepareStatement(RECLAIM)) {\n reclaim.setObject(1, id);\n reclaim.setObject(2, token);\n reclaim.executeUpdate();\n }\n try (Statement s = db.createStatement();\n ResultSet r = s.executeQuery(\n \"select attempt, status, last_error_code from fs_cleanup_item\")) {\n r.next();\n System.out.printf(\"%d 회차 후: 시도 %d 상태 %s 마지막 오류 %s%n\",\n round, r.getInt(1), r.getString(2), r.getString(3));\n }\n }\n }\n }\n}\nJAVA\nCP=\"$(bash /tmp/probe/cp.sh adapter/outbound/persistence-jpa/gradle.lockfile postgresqlIntegrationTestRuntimeClasspath)\"\njavac -encoding UTF-8 -nowarn -cp \"$CP\" -d /tmp/probe /tmp/probe/CleanupReclaimProbe.java\njava -Dstdout.encoding=UTF-8 -cp \"$CP:/tmp/probe\" CleanupReclaimProbe\n\ndocker rm -f \"$CT\" >/dev/null 2>&1 || true",
|
|
"cwd": "/shared/codebase/clean-architecture-backend-template/src",
|
|
"exitCode": 0,
|
|
"executedAt": "2026-09-02T05:43:41+00:00",
|
|
"sourceRevision": "21234e38cdb9a926cbc92bb97a2aee2e4a7d2916",
|
|
"raw": "evidence/raw/a05-f027-maximum-attempts-reclaim.txt",
|
|
"svg": "evidence/rendered/a05-f027-maximum-attempts-reclaim.svg",
|
|
"rawSha256": "2a68f72e73dab9a04fd392e305ac011b6841fb2c2aba13861c41de2f02a3e534",
|
|
"lines": 15,
|
|
"redaction": "none — 탐침 데이터만, 자격증명 없음"
|
|
}
|