Skip to main content

Module errors

Module errors 

Source
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:

ErrorPhaseForward CSRForward DeltasForward SeqReverse CSRReverse DeltasReverse SeqCommittedReservedCounter Reconciled
ConcurrentModificationPhase 2 startUNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDN/A
ForwardSwapFailedPhase 2 forwardUNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDN/A
ReverseSwapFailedPhase 2 reverseROLLED BACKROLLED BACKROLLED BACKUNCHANGEDUNCHANGEDUNCHANGEDRESTOREDRESTOREDYES
CounterReconcileFailedPhase 2 post-swapSUCCESSCLEAREDRESETSUCCESSCLEAREDRESETSTALEUNCHANGEDNO - LOGGED
InterruptedPhase 1UNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDN/A
BuildFailedPhase 1UNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDUNCHANGEDN/A

§Invariants

  • Forward/reverse stores are ALWAYS consistent after any outcome
  • ReverseSwapFailed triggers complete forward rollback before returning
  • CounterReconcileFailed is logged but CSR changes persist (no rollback possible)

§Two-Phase Commit

Compaction uses a two-phase commit protocol:

  1. Phase 1 (Prepare): Build new CSRs offline without holding locks
  2. 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§

PostErrorState
Represents the post-error state for a compaction operation.
SwapPreconditions
Pre-conditions for CSR swap operation.

Enums§

BuildFailureReason
Reason for CSR build failure.
CompactionError
Error type for compaction operations.
CompactionPhase
Phase of the compaction process where an error occurred.
ComponentState
State of a component after an error.
CounterReconcileState
State of counter reconciliation after an error.
Direction
Direction indicator for bidirectional operations.
InterruptReason
Reason for compaction interruption.
SwapFailureReason
Reason for CSR swap failure.
SwapPreconditionError
Error from swap pre-condition validation.