2.4 KiB
2.4 KiB
Projection Checkpoint Schema
Status: Draft Scope: Schema for projection checkpoint artifacts used by derived indexers (e.g., Elasticsearch) to bind schema versions, replay state, and lag metrics to authoritative ASL state.
1. Purpose
Projection checkpoints make derived indexes replayable, auditable, and bounded. They tie a projection schema version to a specific ASL log position and snapshot identity so that rebuilds are deterministic and lag can be measured.
2. Canonical Checkpoint Artifact
Checkpoint artifacts are ASL artifacts whose bytes encode the following fields. The encoding is deterministic and versioned.
2.1 Minimal Fields
checkpoint_version(u32)projection_name(string)projection_schema_version(u32)asl_snapshot_id(u64, optional if not available)asl_log_position(u64, required)created_at(u64, epoch milliseconds)builder_id(string, identifying the indexer instance)
2.2 Optional Fields
artifact_count(u64)edge_count(u64)error_count(u64)lag_millis(u64, derived)note(string)
3. Identity and Storage
- Checkpoints are stored as ASL artifacts using ASL/1-STORE semantics.
projection_nameplusprojection_schema_versionmust uniquely identify a projection format.- The checkpoint artifact reference is the authoritative identifier for the projection state.
4. Lag Metric Binding
Lag is defined as:
Lag = ASL_head_log_position - checkpoint.asl_log_position
The ASL head position is authoritative. The checkpoint log position is the last fully processed position.
5. Replay Rules
- Rebuild begins at
checkpoint.asl_log_position + 1. - Any schema change requires full replay from the earliest available log position.
- Checkpoints must be monotonic in
asl_log_positionfor a given projection.
6. Validation Requirements
When loading a checkpoint, the indexer MUST verify:
projection_schema_versionmatches the current build.asl_log_positionis not ahead of the authoritative ASL head.checkpoint_versionis supported.- If present,
asl_snapshot_idmatches the expected snapshot boundary.
7. Operational Guidance
- Checkpoints should be written after a successful batch commit.
- Checkpoints should be immutable; new checkpoints are separate artifacts.
- Retain checkpoints for audit and rollback.