Expand description
Compaction error types and failure state guarantees.
This module implements Step 14b of the unified graph architecture.
§Failure State Table
The compaction process can fail at various phases. Each error variant has documented state guarantees per the 11-column failure state table:
| Error | Phase | Forward CSR | Forward Deltas | Forward Seq | Reverse CSR | Reverse Deltas | Reverse Seq | Committed | Reserved | Counter Reconciled |
|---|---|---|---|---|---|---|---|---|---|---|
ConcurrentModification | Phase 2 start | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | N/A |
ForwardSwapFailed | Phase 2 forward | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | N/A |
ReverseSwapFailed | Phase 2 reverse | ROLLED BACK | ROLLED BACK | ROLLED BACK | UNCHANGED | UNCHANGED | UNCHANGED | RESTORED | RESTORED | YES |
CounterReconcileFailed | Phase 2 post-swap | SUCCESS | CLEARED | RESET | SUCCESS | CLEARED | RESET | STALE | UNCHANGED | NO - LOGGED |
Interrupted | Phase 1 | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | N/A |
BuildFailed | Phase 1 | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | UNCHANGED | N/A |
§Invariants
- Forward/reverse stores are ALWAYS consistent after any outcome
ReverseSwapFailedtriggers complete forward rollback before returningCounterReconcileFailedis logged but CSR changes persist (no rollback possible)
§Two-Phase Commit
Compaction uses a two-phase commit protocol:
- Phase 1 (Prepare): Build new CSRs offline without holding locks
- Phase 2 (Commit): Atomic swap with rollback on failure
Failures in Phase 1 leave the system completely unchanged. Failures in Phase 2 before forward swap leave the system unchanged. Failures in Phase 2 after forward swap but before reverse swap trigger rollback.
Structs§
- Post
Error State - Represents the post-error state for a compaction operation.
- Swap
Preconditions - Pre-conditions for CSR swap operation.
Enums§
- Build
Failure Reason - Reason for CSR build failure.
- Compaction
Error - Error type for compaction operations.
- Compaction
Phase - Phase of the compaction process where an error occurred.
- Component
State - State of a component after an error.
- Counter
Reconcile State - State of counter reconciliation after an error.
- Direction
- Direction indicator for bidirectional operations.
- Interrupt
Reason - Reason for compaction interruption.
- Swap
Failure Reason - Reason for CSR swap failure.
- Swap
Precondition Error - Error from swap pre-condition validation.