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>
92 lines
4.7 KiB
Plaintext
92 lines
4.7 KiB
Plaintext
# 검증기의 인접한 두 분기
|
|
if (transactionsEnabled && !capabilities.isStable(MongoCapability.TRANSACTION)) {
|
|
throw MongoOperationRejectedException.of(
|
|
"startup.capability",
|
|
"transactions are enabled but unavailable here: "
|
|
+ capabilities.require(MongoCapability.TRANSACTION).constraints()
|
|
+ "; a REPLICA_SET, SHARDED or ATLAS topology is required");
|
|
}
|
|
if (changeStreamsEnabled && !capabilities.isStable(MongoCapability.CHANGE_STREAM)) {
|
|
throw MongoOperationRejectedException.of(
|
|
"startup.capability",
|
|
"change streams are enabled but unavailable here: "
|
|
+ capabilities.require(MongoCapability.CHANGE_STREAM).constraints()
|
|
+ "; a REPLICA_SET, SHARDED or ATLAS topology is required");
|
|
}
|
|
}
|
|
|
|
# 두 분기의 좌항이 오는 곳
|
|
// configured — and then validated the topology against that invented answer.
|
|
properties.transactions(),
|
|
properties.changeStreams(),
|
|
versions)
|
|
|
|
# 그 검사가 열리는 조건
|
|
* <p>Conditional on a {@link MongoTopologyProbe} bean, because the check is about the server this
|
|
* deployment actually talks to, and only a composition root knows how to reach it.
|
|
*/
|
|
@Bean
|
|
@ConditionalOnBean(MongoTopologyProbe.class)
|
|
public InitializingBean mongoPlatformStartupCheck(
|
|
...
|
|
if (security == null || admin == null || versions == null) {
|
|
// Fail closed rather than validate a subset. A partial startup check reports success for
|
|
// the parts nobody supplied, which is the shape the missing wiring already had.
|
|
throw new IllegalStateException(
|
|
"the Mongo platform is enabled and a topology probe is present, but the security"
|
|
+ " profile, admin credential reference or schema version range is not configured;"
|
|
+ " the startup validator cannot answer with only part of its inputs");
|
|
|
|
# changeStreams 는 컴팩트 생성자에서 고정된다
|
|
// Experimental, and therefore not a switch (MNG-INT-003). The driver-side source — watch,
|
|
// resumeAfter/startAfter, cursor lifetime, reconnection — is not shipped; what exists is policy
|
|
// and value objects that do not add up to a running consumer. Accepting the flag and ignoring
|
|
// it
|
|
// would leave an operator believing it took effect, so the value is refused rather than stored:
|
|
// zero beans, zero threads, and a `true` that cannot be honoured never becomes one that looks
|
|
// honoured.
|
|
changeStreams = false;
|
|
# 자동 구성 파일에서 changeStreams 가 나오는 줄 : 1
|
|
|
|
# 소비자 빈에 붙은 조건
|
|
@Bean
|
|
@ConditionalOnMissingBean
|
|
@org.springframework.boot.autoconfigure.condition.ConditionalOnBean({
|
|
dev.caskeleton.adapter.outbound.mongo.changestream.MongoChangeStreamSubscription.class,
|
|
dev.caskeleton.adapter.outbound.mongo.changestream.MongoResumeCheckpointStore.class,
|
|
dev.caskeleton.adapter.outbound.mongo.changestream.MongoResumeTokenCodec.class,
|
|
dev.caskeleton.adapter.outbound.mongo.changestream.projector.MongoChangeProjector.class,
|
|
dev.caskeleton.adapter.outbound.mongo.changestream.projector.MongoChangeDeduplicationStore
|
|
.class
|
|
})
|
|
|
|
# 스트림을 여는 시점의 실패를 복구 정책이 분류하는 방식
|
|
/** Runbook for a subscription that failed for a non-resumable reason. */
|
|
public static final String FAILURE_RUNBOOK = "docs/mongodb/runbooks/failover.md";
|
|
if (failure.hasServerCode() && isHistoryLost(failure.serverCode())) {
|
|
return MongoChangeStreamRecoveryDecision.halt(
|
|
MongoChangeStreamState.HISTORY_LOST, HISTORY_LOST_RUNBOOK);
|
|
}
|
|
if (failure.hasLabel("ResumableChangeStreamError")) {
|
|
return MongoChangeStreamRecoveryDecision.resume();
|
|
}
|
|
return MongoChangeStreamRecoveryDecision.halt(MongoChangeStreamState.FAILED, FAILURE_RUNBOOK);
|
|
}
|
|
private static boolean isHistoryLost(int serverCode) {
|
|
return serverCode == 286 || serverCode == 280;
|
|
|
|
# 그 런북의 증상 절 전체
|
|
## Symptoms
|
|
|
|
- `MongoServerSelectionException` / `MongoConnectionException` spike, then recovery within seconds.
|
|
- `MongoSdamObservationListener` reports a topology change (primary removed, new primary elected).
|
|
- `MongoPoolObservationListener` shows checkout wait times rising while server-side command duration
|
|
stays flat — the wait is topology, not query cost.
|
|
- Latency spike on writes with no corresponding rise in read latency.
|
|
|
|
A failover that resolves in under ~15 s and produces no `WRITE_RESULT_UNKNOWN` is normal replica-set
|
|
behaviour and needs no action beyond confirming it self-healed.
|
|
|
|
## Diagnosis
|
|
# 그 런북 전체에서 standalone·oplog·40573 이 나오는 줄 : 0
|