Checkpoint

A recorded snapshot of verified progress within long-running or continuous systems. When disruptions occur, workloads resume from the latest verified checkpoint instead of restarting from scratch.

General Meaning

In long-running data pipelines, stream processors, and distributed control loops, a checkpoint represents a durably persisted savepoint reflecting all progress completed up to a specific instant. By periodically freezing clean state transitions and serializing them to persistent storage, systems establish known recovery baselines.

When a failure, network partition, or machine reboot occurs, the operational runtime does not need to re-execute operations from the very beginning of the system's history. Instead, it recovers state from the latest checkpoint and replays only the recent log delta, drastically reducing MTTR (Mean Time to Recovery) and preventing wasted computation.

Why It Matters

  • Eliminates catastrophic restart overhead: Long workflows halting near completion can resume from the recent checkpoint rather than recalculating from zero.
  • Enables seamless active-standby failover: When an active coordinator drops offline, standby nodes read the latest checkpoint to take over uninterrupted.
  • Facilitates safe log compaction and cleanup: Historical WAL entries and intermediate states prior to the verified checkpoint can be safely pruned to reclaim disk.

How the Site Factory Uses It

In the Site Factory, three Mac hosts (Mac mini, Studio 1, and Studio 2) operate under an Active-Standby topology. To ensure standby machines take over seamlessly upon primary node failures, shared service checkpoints are persisted in Cloudflare D1. Checkpoint commits leverage optimistic concurrency control (CAS), verifying expected_revision against current lease generation numbers to prevent stale split-brain coordinators from overwriting or rewinding state.

Distinct checkpoints manage core operational loops. In dispatch/src/service-checkpoint.js and honbu/service_checkpoint.py, the coordinator service (dev.memocho.honbu-service-macgakari) stores inspection progress under D1 /v2/services/macgakari/checkpoint (macgakari-checkpoint/1), preventing duplicate job queues across failovers. The patrol service (dev.memocho.honbu-service-patrol) manages external AI reservations at D1 /v2/services/patrol/checkpoint (cloud-hand-checkpoint/1). Furthermore, site patrols generate site-patrol-checkpoint/1 across all 14 managed web properties, enabling resumes from the first uninspected domain after interruptions.

Caveats & Operational Rules

  • Never overwrite unconfirmed reservations: Standby nodes taking over checkpoints must never clobber active, unverified reservations issued by a previous coordinator; D1 rejects this with 409 (unconfirmed reservation cannot be replaced).
  • Do not store secrets in checkpoints: Because checkpoints are shared across nodes and databases, sensitive credentials, tokens, or raw command lines must be excluded, retaining only revisions and IDs.
  • Guard checkpoint writes against concurrent races: Two standby hosts attempting concurrent checkpoint updates risk state corruption; the Site Factory enforces exclusivity via CAS on D1 and lease fencing generations.

Related Terms

References

  • Book: Martin Kleppmann, *Designing Data-Intensive Applications*, Chapter 11 (Stream Processing: Checkpoints and State Management)

Verified: 2026-11-08