Files
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

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