{"record":{"id":"1a3bec68a0de7ff5","repo":"microsoft/FASTER","slug":"unexpected-checkpoint-phase-expected-hot-store-checkpoint","errorCode":null,"errorMessage":"Unexpected checkpoint phase [expected: HOT_STORE_CHECKPOINT, actual: %s]","messagePattern":"Unexpected checkpoint phase \\[expected: HOT_STORE_CHECKPOINT, actual: (.+?)\\]","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cc/src/core/f2.h","lineNumber":678,"sourceCode":"    }\n  }\n\n  if (--checkpoint->threads_pending_hot_store_persist == 0) {\n    // All threads finished checkpointing hot store\n    // Last thread responsible for moving to next phase (i.e., cold-store checkpointing)\n    StoreCheckpointStatus status;\n\n    // Mark hot store checkpoint status to finished (or failed)\n    Status global_result = checkpoint->hot_store_checkpoint_result.load();\n    log_debug(\"Hot store checkpoint result: %s\", StatusStr(global_result));\n\n    status = (global_result == Status::Ok) ? StoreCheckpointStatus::FINISHED : StoreCheckpointStatus::FAILED;\n    checkpoint->hot_store_status.store(status);\n\n    // Request cold store checkpointing\n    CheckpointPhase phase;\n    if ((phase = checkpoint->phase.load()) != CheckpointPhase::HOT_STORE_CHECKPOINT) {\n      log_error(\"Unexpected checkpoint phase [expected: HOT_STORE_CHECKPOINT, actual: %s]\",\n                CHECKPOINT_PHASE_STR[static_cast<int>(phase)]);\n    }\n    log_debug(\"Moving to cold-store checkpoint phase\");\n    checkpoint->phase.store(CheckpointPhase::COLD_STORE_CHECKPOINT);\n\n    if ((status = checkpoint->cold_store_status.load()) != StoreCheckpointStatus::IDLE) {\n      log_error(\"Unexpected checkpoint status for COLD store [expected: IDLE, actual: %s]\",\n                STORE_CHECKPOINT_STATUS_STR[static_cast<int>(status)]);\n      assert(false);\n    }\n    log_debug(\"Requesting cold store checkpoint...\");\n    checkpoint->cold_store_status.store(StoreCheckpointStatus::REQUESTED);\n  }\n}\n\ntemplate<class K, class V, class D, class HHI, class CHI>\ninline Status F2Kv<K, V, D, HHI, CHI>::Recover(const Guid& token, uint32_t& version, std::vector<Guid>& session_ids) {\n  CheckpointPhase phase = CheckpointPhase::REST;","sourceCodeStart":660,"sourceCodeEnd":696,"githubUrl":"https://github.com/microsoft/FASTER/blob/321d872eabda6a0345c8bd76419f89723ed864ae/cc/src/core/f2.h#L660-L696","documentation":"When a checkpoint finishes the hot-store portion, the driver transitions phase from HOT_STORE_CHECKPOINT to COLD_STORE_CHECKPOINT. If the phase is not HOT_STORE_CHECKPOINT at that point, the checkpoint state machine was entered from an unexpected phase, indicating concurrent checkpoints or a corrupted transition sequence.","triggerScenarios":"Two threads calling Checkpoint() concurrently so the second overwrites the phase; issuing a checkpoint while the machine is already in COLD_STORE_CHECKPOINT or RECOVER phase.","commonSituations":"Overlapping checkpoint requests from different client threads; a hot-store checkpoint callback arriving after a manual phase reset.","solutions":["Serialize Checkpoint() calls so only one runs at a time","Verify phase == REST before issuing a new checkpoint","Inspect prior logs for earlier 'Unexpected checkpoint phase' errors to locate the first bad transition","Reset the instance (re-open F2) to clear the stuck state"],"exampleFix":"// before\nf2->Checkpoint(); // issued while previous checkpoint still in flight\n// after\nif (prev_checkpoint_done.load()) { f2->Checkpoint(); prev_checkpoint_done.store(false); }","handlingStrategy":"validation","validationCode":"if (checkpoint_in_flight) { throw std::runtime_error(\"checkpoint already in progress\"); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Single-writer checkpoint initiation","Complete each checkpoint round fully before the next","Monitor logs for early phase-mismatch errors"],"tags":["checkpoint","state-machine","concurrency"],"backgroundTag":"invalid-state-transition","analyzedSha":"321d872eabda6a0345c8bd76419f89723ed864ae","analyzedAt":"2026-09-15T22:18:00.693Z","contentChangedAt":"2026-09-15T22:18:00.693Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}