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
- PrepIndexChkpt: Prepare index checkpoint, synchronize threads
- IndexChkpt: Write index to disk
- Prepare: Prepare HybridLog checkpoint
- InProgress: Increment version, mark checkpoint in progress
- WaitPending: Wait for pending operations
- WaitFlush: Wait for log flush
- PersistenceCallback: Invoke persistence callback
- 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§
- Atomic
Checkpoint Lock - Atomic checkpoint lock for thread-safe operations.
- Checkpoint
Info - Information about a checkpoint for recovery
- Checkpoint
Lock - A checkpoint lock that tracks old and new version lock counts.
- Checkpoint
Lock Guard - RAII guard for checkpoint locks.
- Checkpoint
Locks - A table of checkpoint locks indexed by key hash.
- Checkpoint
State - State of an active checkpoint operation
- Index
Metadata - Index metadata for checkpoint
- LogMetadata
- Log metadata for checkpoint
- Recovery
State - Recovery state and operations
- Session
State - Session state for checkpoint persistence
Enums§
- Checkpoint
Type - Checkpoint type
- Lock
Type - Type of lock held by a CheckpointLockGuard
- Page
Recovery Status - Fine-grained recovery status for individual pages. Based on C++ FASTER’s five-phase page recovery tracking.
- Recovery
Status - 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§
- Checkpoint
Token - Token identifying a checkpoint
- Hybrid
LogPersistence Callback - Callback for hybrid log persistence completion
- Index
Persistence Callback - Callback for index persistence completion