pub fn checkpoint_once(
pool: &ConnectionPool,
conn: &Connection,
config: &CheckpointConfig,
truncate_state: &mut TruncateState,
) -> Result<u64, Error>Expand description
Issue one checkpoint cycle against the task’s dedicated checkpoint
connection (conn — see CheckpointConnection; NEVER the pool’s writer
mutex).
Returns the observed WAL page count on success. A busy PASSIVE row has no
usable observation and the compatibility wrapper returns SQLITE_BUSY;
an inconsistent nonbusy frame pair instead returns SQLITE_ERROR.
A connection-level pragma error is also returned; the task caller drops
that connection and reopens next tick. TRUNCATE errors remain non-fatal.
The caller owns all threshold-crossing WARN logging so that warnings fire at most once per crossing, not every tick.
ADR-091 Plank 2: after the PASSIVE pass, this is also the single point
that may escalate to TRUNCATE (maybe_truncate) — on the SAME dedicated
connection, never a second connection or a pool checkout. A no-progress
result produces a separate cross-process attribution request; the
synchronous core never walks the sidecar directory. Production’s
run_checkpoint_task consumes that request through an awaited
spawn_blocking before continuing the tick. This compatibility wrapper
intentionally returns only the historical page-count surface; the daemon
calls checkpoint_once_core so it cannot discard the request.