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>
145 lines
12 KiB
XML
145 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=quota-expiry-probe
|
|
docker rm -f "$CT" >/dev/null 2>&1 || true
|
|
docker run -d --name "$CT"</tspan><tspan x="24" dy="22"> --network "container:workmachine" \
|
|
-e POSTGRES_PASSWORD=probe -e POSTGRES_USER=probe -e POSTGRES_DB=probe \
|
|
postgr</tspan><tspan x="24" dy="22">es:16-alpine -p 55432 >/dev/null
|
|
for i in $(seq 1 40); do
|
|
docker inspect -f '{{.State.Running}}' "$CT" | grep -q true </tspan><tspan x="24" dy="22">|| { echo '컨테이너가 뜨지 않았다'; exit 1; }
|
|
docker exec "$CT" pg_isready -U probe -p 55432 >/dev/null 2>&1 && break
|
|
</tspan><tspan x="24" dy="22"> sleep 1
|
|
done
|
|
docker exec "$CT" psql -U probe -p 55432 -d probe -tAc 'select version()' | cut -c1-24
|
|
M=adapter/outbound</tspan><tspan x="24" dy="22">/persistence-jpa/src/main/resources/db/migration
|
|
for d in postgresql jpa/core jpa/fileserver; do
|
|
for f in $(ls "$M/$d"</tspan><tspan x="24" dy="22">/V*.sql | sort -V); do
|
|
docker exec -i "$CT" psql -U probe -p 55432 -d probe -q -v ON_ERROR_STOP=1 < "$f" >/dev/null </tspan><tspan x="24" dy="22">2>&1 || true
|
|
done
|
|
done
|
|
echo -n '# 쿼터 예약 테이블과 그 만료 열: '
|
|
docker exec "$CT" psql -U probe -p 55432 -d probe</tspan><tspan x="24" dy="22"> -tAc \
|
|
"select string_agg(column_name, ' ' order by ordinal_position) from information_schema.columns
|
|
where tabl</tspan><tspan x="24" dy="22">e_schema='public' and table_name='fs_quota_reservation' and column_name in ('status','expires_at','committed_bytes')"
|
|
|
|
e</tspan><tspan x="24" dy="22">cho
|
|
echo '# 저장소의 두 질의를 만료된 예약에 그대로 돌린다'
|
|
cat > /tmp/probe/cp.sh <<'CPSH'
|
|
# 락파일의 한 구성에 실린 좌</tspan><tspan x="24" dy="22">표 전부를 캐시 경로로 바꾼다. Gradle 실행 없이 재현된다.
|
|
LOCK=${1:-adapter/outbound/persistence-jpa/gradle.lockfile}
|
|
CON</tspan><tspan x="24" dy="22">F=${2:-postgresqlIntegrationTestRuntimeClasspath}
|
|
CACHE=/root/.gradle/caches/modules-2/files-2.1
|
|
cp=""
|
|
while IFS= read -</tspan><tspan x="24" dy="22">r line; do
|
|
coord=${line%%=*}; confs=${line#*=}
|
|
case ",$confs," in *",$CONF,"*) ;; *) continue ;; esac
|
|
group=${coor</tspan><tspan x="24" dy="22">d%%:*}; rest=${coord#*:}; name=${rest%%:*}; ver=${rest##*:}
|
|
jar=$(find "$CACHE/$group/$name/$ver" -name '*.jar' ! -nam</tspan><tspan x="24" dy="22">e '*sources*' ! -name '*javadoc*' 2>/dev/null | head -1)
|
|
[ -n "$jar" ] && cp="$cp:$jar"
|
|
done < <(grep -E '^[a-zA-Z0-9.</tspan><tspan x="24" dy="22">_-]+:[^=]+=' "$LOCK")
|
|
echo "${cp#:}"
|
|
CPSH
|
|
cat > /tmp/probe/QuotaExpiryProbe.java <<'JAVA'
|
|
import java.sql.Connection;
|
|
im</tspan><tspan x="24" dy="22">port java.sql.DriverManager;
|
|
import java.sql.ResultSet;
|
|
import java.sql.Statement;
|
|
import java.util.UUID;
|
|
|
|
/** 만료된 예</tspan><tspan x="24" dy="22">약에 확정 문장을 그대로 돌려 본다. 저장소의 두 질의를 그대로 쓴다. */
|
|
public class QuotaExpiryProbe {
|
|
|
|
private static </tspan><tspan x="24" dy="22">final String EXTEND =
|
|
"update fs_quota_reservation set reserved_bytes = reserved_bytes + 100,"
|
|
+ " versi</tspan><tspan x="24" dy="22">on = version + 1, updated_at = now()"
|
|
+ " where reservation_id = ? and status = 'RESERVED' and expires_at > no</tspan><tspan x="24" dy="22">w()";
|
|
|
|
private static final String COMMIT =
|
|
"update fs_quota_reservation set status = 'COMMITTED', committed_byt</tspan><tspan x="24" dy="22">es = ?,"
|
|
+ " reserved_bytes = 0, version = version + 1, updated_at = now()"
|
|
+ " where reservation_id</tspan><tspan x="24" dy="22"> = ? and status = 'RESERVED'";
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
try (Connection db = Dri</tspan><tspan x="24" dy="22">verManager.getConnection(
|
|
"jdbc:postgresql://127.0.0.1:55432/probe", "probe", "probe")) {
|
|
UUID id = UUID.r</tspan><tspan x="24" dy="22">andomUUID();
|
|
try (Statement s = db.createStatement()) {
|
|
s.execute("delete from fs_quota_reservation");
|
|
</tspan><tspan x="24" dy="22"> }
|
|
try (var insert = db.prepareStatement(
|
|
"insert into fs_quota_reservation (reservation_id, scope_typ</tspan><tspan x="24" dy="22">e, scope_value,"
|
|
+ " reserved_bytes, committed_bytes, expires_at, status, version, created_at, updated_at)</tspan><tspan x="24" dy="22">"
|
|
+ " values (?, 'NAMESPACE', 'probe', 500, 0, now() - interval '1 hour', 'RESERVED', 0, now(), now())")) </tspan><tspan x="24" dy="22">{
|
|
insert.setObject(1, id);
|
|
insert.executeUpdate();
|
|
}
|
|
System.out.println("만료된 예약을 하나 </tspan><tspan x="24" dy="22">만든다 (expires_at = 한 시간 전)");
|
|
|
|
try (var extend = db.prepareStatement(EXTEND)) {
|
|
extend.setObject(1, </tspan><tspan x="24" dy="22">id);
|
|
System.out.println("연장 질의가 바꾼 행 : " + extend.executeUpdate());
|
|
}
|
|
try (var commit = db.p</tspan><tspan x="24" dy="22">repareStatement(COMMIT)) {
|
|
commit.setLong(1, 600);
|
|
commit.setObject(2, id);
|
|
System.out.println("</tspan><tspan x="24" dy="22">확정 질의가 바꾼 행 : " + commit.executeUpdate());
|
|
}
|
|
try (Statement s = db.createStatement();
|
|
Resu</tspan><tspan x="24" dy="22">ltSet r = s.executeQuery(
|
|
"select status, committed_bytes from fs_quota_reservation")) {
|
|
while (r.</tspan><tspan x="24" dy="22">next()) {
|
|
System.out.println("결과 행 : status=" + r.getString(1)
|
|
+ " committed_bytes=</tspan><tspan x="24" dy="22">" + r.getLong(2));
|
|
}
|
|
}
|
|
|
|
System.out.println();
|
|
System.out.println("게이트웨이의 정산 행은 expir</tspan><tspan x="24" dy="22">es_at = now 로 만들어진다");
|
|
UUID settled = UUID.randomUUID();
|
|
try (var insert = db.prepareStatement(
|
|
</tspan><tspan x="24" dy="22"> "insert into fs_quota_reservation (reservation_id, scope_type, scope_value,"
|
|
+ " reserved_bytes, commi</tspan><tspan x="24" dy="22">tted_bytes, expires_at, status, version, created_at, updated_at)"
|
|
+ " values (?, 'NAMESPACE', 'settle', 70</tspan><tspan x="24" dy="22">0, 0, now(), 'RESERVED', 0, now(), now())")) {
|
|
insert.setObject(1, settled);
|
|
insert.executeUpdate();
|
|
</tspan><tspan x="24" dy="22"> }
|
|
try (var strict = db.prepareStatement(COMMIT + " and expires_at > now()")) {
|
|
strict.setLong(1, 700);
|
|
</tspan><tspan x="24" dy="22"> strict.setObject(2, settled);
|
|
System.out.println("만료 조건을 붙인 확정이 그 행을 바꾼 수 : " + strict.e</tspan><tspan x="24" dy="22">xecuteUpdate());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
JAVA
|
|
CP="$(bash /tmp/probe/cp.sh adapter/outbound/persistence-jpa/gradle.lockfile p</tspan><tspan x="24" dy="22">ostgresqlIntegrationTestRuntimeClasspath)"
|
|
javac -encoding UTF-8 -nowarn -cp "$CP" -d /tmp/probe /tmp/probe/QuotaExpiryP</tspan><tspan x="24" dy="22">robe.java
|
|
java -Dstdout.encoding=UTF-8 -cp "$CP:/tmp/probe" QuotaExpiryProbe
|
|
|
|
docker rm -f "$CT" >/dev/null 2>&1 || true</tspan></text>
|
|
<text x="24" y="1080" 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="1102" 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-02T04:56:13+00:00 · exit 0</tspan></text>
|
|
<line x1="24" y1="1116" x2="1176" y2="1116" stroke="#30363d"/>
|
|
<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">PostgreSQL 16.15 on x86_</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"># 쿼터 예약 테이블과 그 만료 열: committed_bytes expires_at status</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"></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"># 저장소의 두 질의를 만료된 예약에 그대로 돌린다</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">만료된 예약을 하나 만든다 (expires_at = 한 시간 전)</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">연장 질의가 바꾼 행 : 0</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">확정 질의가 바꾼 행 : 1</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">결과 행 : status=COMMITTED committed_bytes=600</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"></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">게이트웨이의 정산 행은 expires_at = now 로 만들어진다</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">만료 조건을 붙인 확정이 그 행을 바꾼 수 : 0</tspan></text>
|
|
</svg>
|