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>
141 lines
12 KiB
XML
141 lines
12 KiB
XML
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="1426" viewBox="0 0 1200 1426" role="img">
|
|
<title>terminal evidence</title>
|
|
<desc>Terminal-style rendering generated from retained command output. Sensitive-looking values are redacted in the visual asset.</desc>
|
|
<rect x="1" y="1" width="1198" height="1424" rx="14" fill="#0d1117" stroke="#30363d"/>
|
|
<rect x="1" y="1" width="1198" height="44" rx="14" fill="#161b22"/>
|
|
<rect x="1" y="30" width="1198" height="14" fill="#161b22"/>
|
|
<circle cx="24" cy="22" r="6" fill="#ff5f57"/>
|
|
<circle cx="44" cy="22" r="6" fill="#febc2e"/>
|
|
<circle cx="64" cy="22" r="6" fill="#28c840"/>
|
|
<text x="92" y="27" fill="#8b949e" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace">terminal evidence</text>
|
|
<text x="24" y="68" fill="#c9d1d9" font-size="15" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">$ set -e
|
|
mkdir -p /tmp/probe
|
|
CT=cleanup-reclaim-probe
|
|
docker rm -f "$CT" >/dev/null 2>&1 || true
|
|
docker run -d --name "$</tspan><tspan x="24" dy="22">CT" --network "container:workmachine" \
|
|
-e POSTGRES_PASSWORD=probe -e POSTGRES_USER=probe -e POSTGRES_DB=probe \
|
|
pos</tspan><tspan x="24" dy="22">tgres:16-alpine -p 55432 >/dev/null
|
|
for i in $(seq 1 40); do
|
|
docker inspect -f '{{.State.Running}}' "$CT" | grep -q tr</tspan><tspan x="24" dy="22">ue || { echo '컨테이너가 뜨지 않았다'; exit 1; }
|
|
docker exec "$CT" pg_isready -U probe -p 55432 >/dev/null 2>&1 && bre</tspan><tspan x="24" dy="22">ak
|
|
sleep 1
|
|
done
|
|
docker exec "$CT" psql -U probe -p 55432 -d probe -tAc 'select version()' | cut -c1-24
|
|
M=adapter/outbo</tspan><tspan x="24" dy="22">und/persistence-jpa/src/main/resources/db/migration
|
|
for d in postgresql jpa/core jpa/fileserver; do
|
|
for f in $(ls "$M/</tspan><tspan x="24" dy="22">$d"/V*.sql | sort -V); do
|
|
docker exec -i "$CT" psql -U probe -p 55432 -d probe -q -v ON_ERROR_STOP=1 < "$f" >/dev/nu</tspan><tspan x="24" dy="22">ll 2>&1 || true
|
|
done
|
|
done
|
|
|
|
echo
|
|
echo '# 저장소의 청구 문장과 회수 문장을 아홉 번 반복한다.'
|
|
echo '# 시계 출처만 DB </tspan><tspan x="24" dy="22">로 바꿨다. 조건과 열은 저장소 질의 그대로다.'
|
|
echo '# 회수 대상을 고르는 조회는 태우지 않는다 — 그 조회에도 시도 한계</tspan><tspan x="24" dy="22">가 없음은 따로 확인했다.'
|
|
cat > /tmp/probe/cp.sh <<'CPSH'
|
|
# 락파일의 한 구성에 실린 좌표 전부를 캐시 경로로 바꾼다. Grad</tspan><tspan x="24" dy="22">le 실행 없이 재현된다.
|
|
LOCK=${1:-adapter/outbound/persistence-jpa/gradle.lockfile}
|
|
CONF=${2:-postgresqlIntegrationTestRu</tspan><tspan x="24" dy="22">ntimeClasspath}
|
|
CACHE=/root/.gradle/caches/modules-2/files-2.1
|
|
cp=""
|
|
while IFS= read -r line; do
|
|
coord=${line%%=*}; co</tspan><tspan x="24" dy="22">nfs=${line#*=}
|
|
case ",$confs," in *",$CONF,"*) ;; *) continue ;; esac
|
|
group=${coord%%:*}; rest=${coord#*:}; name=${r</tspan><tspan x="24" dy="22">est%%:*}; ver=${rest##*:}
|
|
jar=$(find "$CACHE/$group/$name/$ver" -name '*.jar' ! -name '*sources*' ! -name '*javadoc*' </tspan><tspan x="24" dy="22">2>/dev/null | head -1)
|
|
[ -n "$jar" ] && cp="$cp:$jar"
|
|
done < <(grep -E '^[a-zA-Z0-9._-]+:[^=]+=' "$LOCK")
|
|
echo "${cp#:</tspan><tspan x="24" dy="22">}"
|
|
CPSH
|
|
cat > /tmp/probe/CleanupReclaimProbe.java <<'JAVA'
|
|
import java.sql.Connection;
|
|
import java.sql.DriverManager;
|
|
im</tspan><tspan x="24" dy="22">port java.sql.ResultSet;
|
|
import java.sql.Statement;
|
|
import java.util.UUID;
|
|
|
|
/** 청구와 리스 만료 회수를 아홉 번 반복한다</tspan><tspan x="24" dy="22">. 저장소의 두 질의를 그대로 쓴다. */
|
|
public class CleanupReclaimProbe {
|
|
|
|
private static final int MAXIMUM_ATTEMPTS = 8</tspan><tspan x="24" dy="22">;
|
|
|
|
private static final String CLAIM =
|
|
"update fs_cleanup_item set status = 'IN_PROGRESS', claim_owner = ?, clai</tspan><tspan x="24" dy="22">m_token = ?,"
|
|
+ " lease_until = now() + interval '1 second', claim_fence = claim_fence + 1,"
|
|
+ " upd</tspan><tspan x="24" dy="22">ated_at = now() where cleanup_id = ? and status in ('PENDING', 'FAILED')";
|
|
|
|
private static final String RECLAIM =
|
|
</tspan><tspan x="24" dy="22"> "update fs_cleanup_item set status = 'FAILED', attempt = attempt + 1,"
|
|
+ " next_attempt_at = now(), last_err</tspan><tspan x="24" dy="22">or_code = 'CLAIM_LEASE_EXPIRED',"
|
|
+ " claim_owner = null, claim_token = null, lease_until = null, updated_at =</tspan><tspan x="24" dy="22"> now()"
|
|
+ " where cleanup_id = ? and claim_token = ? and status = 'IN_PROGRESS'";
|
|
|
|
public static void main(S</tspan><tspan x="24" dy="22">tring[] args) throws Exception {
|
|
try (Connection db = DriverManager.getConnection(
|
|
"jdbc:postgresql://127.0.</tspan><tspan x="24" dy="22">0.1:55432/probe", "probe", "probe")) {
|
|
UUID id = UUID.randomUUID();
|
|
try (Statement s = db.createStatement())</tspan><tspan x="24" dy="22"> {
|
|
s.execute("delete from fs_cleanup_item");
|
|
}
|
|
try (var insert = db.prepareStatement(
|
|
"ins</tspan><tspan x="24" dy="22">ert into fs_cleanup_item (cleanup_id, content_key, type, attempt, next_attempt_at,"
|
|
+ " status, claim_fenc</tspan><tspan x="24" dy="22">e, created_at, updated_at)"
|
|
+ " values (?, 'k', 'ORPHAN_PHYSICAL_OBJECT', 0, now(), 'PENDING', 0, now(), n</tspan><tspan x="24" dy="22">ow())")) {
|
|
insert.setObject(1, id);
|
|
insert.executeUpdate();
|
|
}
|
|
System.out.println("최대 시도 </tspan><tspan x="24" dy="22">횟수 상수 : " + MAXIMUM_ATTEMPTS);
|
|
|
|
for (int round = 1; round <= 9; round++) {
|
|
UUID token = UUID.randomUUI</tspan><tspan x="24" dy="22">D();
|
|
try (var claim = db.prepareStatement(CLAIM)) {
|
|
claim.setString(1, "worker");
|
|
claim.setO</tspan><tspan x="24" dy="22">bject(2, token);
|
|
claim.setObject(3, id);
|
|
if (claim.executeUpdate() == 0) {
|
|
System.out.pr</tspan><tspan x="24" dy="22">intln(round + " 회차: 청구 실패 — 더 이상 청구 가능한 상태가 아니다");
|
|
break;
|
|
}
|
|
}
|
|
</tspan><tspan x="24" dy="22"> try (var reclaim = db.prepareStatement(RECLAIM)) {
|
|
reclaim.setObject(1, id);
|
|
reclaim.setObject(2, t</tspan><tspan x="24" dy="22">oken);
|
|
reclaim.executeUpdate();
|
|
}
|
|
try (Statement s = db.createStatement();
|
|
ResultS</tspan><tspan x="24" dy="22">et r = s.executeQuery(
|
|
"select attempt, status, last_error_code from fs_cleanup_item")) {
|
|
r.ne</tspan><tspan x="24" dy="22">xt();
|
|
System.out.printf("%d 회차 후: 시도 %d 상태 %s 마지막 오류 %s%n",
|
|
round, r.getInt(1), r.</tspan><tspan x="24" dy="22">getString(2), r.getString(3));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
JAVA
|
|
CP="$(bash /tmp/probe/cp.sh adapter/outbound/persisten</tspan><tspan x="24" dy="22">ce-jpa/gradle.lockfile postgresqlIntegrationTestRuntimeClasspath)"
|
|
javac -encoding UTF-8 -nowarn -cp "$CP" -d /tmp/probe</tspan><tspan x="24" dy="22"> /tmp/probe/CleanupReclaimProbe.java
|
|
java -Dstdout.encoding=UTF-8 -cp "$CP:/tmp/probe" CleanupReclaimProbe
|
|
|
|
docker rm -f</tspan><tspan x="24" dy="22"> "$CT" >/dev/null 2>&1 || true</tspan></text>
|
|
<text x="24" y="992" fill="#8b949e" font-size="13" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">cwd: /shared/codebase/clean-architecture-backend-template/src</tspan></text>
|
|
<text x="24" y="1014" fill="#8b949e" font-size="13" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">time: 2026-09-02T05:43:41+00:00 · exit 0</tspan></text>
|
|
<line x1="24" y1="1028" x2="1176" y2="1028" stroke="#30363d"/>
|
|
<text x="24" y="1068" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">PostgreSQL 16.15 on x86_</tspan></text>
|
|
<text x="24" y="1090" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"></tspan></text>
|
|
<text x="24" y="1112" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"># 저장소의 청구 문장과 회수 문장을 아홉 번 반복한다.</tspan></text>
|
|
<text x="24" y="1134" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"># 시계 출처만 DB 로 바꿨다. 조건과 열은 저장소 질의 그대로다.</tspan></text>
|
|
<text x="24" y="1156" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0"># 회수 대상을 고르는 조회는 태우지 않는다 — 그 조회에도 시도 한계가 없음은 따로 확인했다.</tspan></text>
|
|
<text x="24" y="1178" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">최대 시도 횟수 상수 : 8</tspan></text>
|
|
<text x="24" y="1200" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">1 회차 후: 시도 1 상태 FAILED 마지막 오류 CLAIM_LEASE_EXPIRED</tspan></text>
|
|
<text x="24" y="1222" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">2 회차 후: 시도 2 상태 FAILED 마지막 오류 CLAIM_LEASE_EXPIRED</tspan></text>
|
|
<text x="24" y="1244" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">3 회차 후: 시도 3 상태 FAILED 마지막 오류 CLAIM_LEASE_EXPIRED</tspan></text>
|
|
<text x="24" y="1266" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">4 회차 후: 시도 4 상태 FAILED 마지막 오류 CLAIM_LEASE_EXPIRED</tspan></text>
|
|
<text x="24" y="1288" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">5 회차 후: 시도 5 상태 FAILED 마지막 오류 CLAIM_LEASE_EXPIRED</tspan></text>
|
|
<text x="24" y="1310" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">6 회차 후: 시도 6 상태 FAILED 마지막 오류 CLAIM_LEASE_EXPIRED</tspan></text>
|
|
<text x="24" y="1332" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">7 회차 후: 시도 7 상태 FAILED 마지막 오류 CLAIM_LEASE_EXPIRED</tspan></text>
|
|
<text x="24" y="1354" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">8 회차 후: 시도 8 상태 FAILED 마지막 오류 CLAIM_LEASE_EXPIRED</tspan></text>
|
|
<text x="24" y="1376" fill="#e6edf3" font-size="14" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" xml:space="preserve"><tspan x="24" dy="0">9 회차 후: 시도 9 상태 FAILED 마지막 오류 CLAIM_LEASE_EXPIRED</tspan></text>
|
|
</svg>
|