Skip to main content

Module checkpoint

Module checkpoint 

Source
Expand description

Checkpoint and recovery for FASTER

This module provides checkpointing and recovery functionality for FasterKV stores.

§Overview

FASTER uses the CPR (Concurrent Prefix Recovery) protocol for checkpointing, which allows checkpoints to be taken without stopping normal operations.

§Checkpoint Types

  • Full Checkpoint: Saves both index and hybrid log state
  • Index-Only Checkpoint: Saves only the hash index
  • HybridLog-Only Checkpoint: Saves only the log state
  • Incremental Checkpoint: Saves only changes since last snapshot

§CPR Protocol Phases

  1. PrepIndexChkpt: Prepare index checkpoint, synchronize threads
  2. IndexChkpt: Write index to disk
  3. Prepare: Prepare HybridLog checkpoint
  4. InProgress: Increment version, mark checkpoint in progress
  5. WaitPending: Wait for pending operations
  6. WaitFlush: Wait for log flush
  7. PersistenceCallback: Invoke persistence callback
  8. Rest: Return to rest state

§File Structure

Each checkpoint creates a directory with the following files:

  • index.meta: Index checkpoint metadata (JSON)
  • index.dat: Hash index data (binary)
  • log.meta: Log checkpoint metadata (JSON)
  • log.snapshot: Log snapshot data (binary)

§Usage

use std::path::Path;

// Create checkpoint
let token = store.checkpoint(Path::new("/checkpoints"))?;

// Recover from checkpoint
let recovered = FasterKv::recover(
    Path::new("/checkpoints"),
    token,
    config,
    device
)?;

Re-exports§

pub use serialization::create_checkpoint_directory;
pub use serialization::delta_log_path;
pub use serialization::delta_metadata_path;
pub use serialization::incremental_info_path;
pub use serialization::index_data_path;
pub use serialization::index_metadata_path;
pub use serialization::log_metadata_path;
pub use serialization::log_snapshot_path;
pub use serialization::DeltaLogMetadata;
pub use serialization::IncrementalCheckpointChain;
pub use serialization::SerializableCheckpointInfo;
pub use serialization::SerializableIndexMetadata;
pub use serialization::SerializableLogMetadata;

Modules§

binary_format
C-style binary format serialization for FASTER C++ compatibility
serialization
Serialization support for checkpoint metadata

Structs§

AtomicCheckpointLock
Atomic checkpoint lock for thread-safe operations.
CheckpointInfo
Information about a checkpoint for recovery
CheckpointLock
A checkpoint lock that tracks old and new version lock counts.
CheckpointLockGuard
RAII guard for checkpoint locks.
CheckpointLocks
A table of checkpoint locks indexed by key hash.
CheckpointState
State of an active checkpoint operation
IndexMetadata
Index metadata for checkpoint
LogMetadata
Log metadata for checkpoint
RecoveryState
Recovery state and operations
SessionState
Session state for checkpoint persistence

Enums§

CheckpointType
Checkpoint type
LockType
Type of lock held by a CheckpointLockGuard
PageRecoveryStatus
Fine-grained recovery status for individual pages. Based on C++ FASTER’s five-phase page recovery tracking.
RecoveryStatus
Status of a recovery operation

Functions§

find_latest_checkpoint
Find the latest checkpoint in a directory
list_checkpoints
List all checkpoints in a directory
validate_checkpoint
Validate that a checkpoint directory contains all required files

Type Aliases§

CheckpointToken
Token identifying a checkpoint
HybridLogPersistenceCallback
Callback for hybrid log persistence completion
IndexPersistenceCallback
Callback for index persistence completion