Freeze the journal frontier and persist one recoverable checkpoint attempt, with the legacy `reuse_frozen_changes` recovery: a previous Stop may have recorded the change before its journal read failed. The retry sees a clean working copy; recover only those frozen hashes, then retain the store's source validation — a new nonempty change set must still conflict.
(
store: &RedbChangeStore,
id: ProvenanceId,
expected_generation: u64,
mut source: ProvenanceCheckpointSource,
reuse_frozen_changes: bool,
now: i64,
)
| 142 | /// retain the store's source validation — a new nonempty change set must |
| 143 | /// still conflict. |
| 144 | pub fn prepare_checkpoint( |
| 145 | store: &RedbChangeStore, |
| 146 | id: ProvenanceId, |
| 147 | expected_generation: u64, |
| 148 | mut source: ProvenanceCheckpointSource, |
| 149 | reuse_frozen_changes: bool, |
| 150 | now: i64, |
| 151 | ) -> Result<ProvenanceCheckpointAttempt, JournalError> { |
| 152 | let attempt = (|| { |
| 153 | if reuse_frozen_changes && source.change_hashes.is_empty() { |
| 154 | if let Some(turn) = store.get_provenance_turn(id)? { |
| 155 | if turn.generation == expected_generation |
| 156 | && matches!(turn.state, ProvenanceTurnState::Checkpointing) |
| 157 | { |
| 158 | if let Some(attempt) = turn.checkpoint_attempt { |
| 159 | source.change_hashes = attempt.source.change_hashes; |
| 160 | } |
| 161 | } |
| 162 | } |
| 163 | } |
| 164 | store.prepare_provenance_checkpoint(id, expected_generation, source, now) |
| 165 | })() |
| 166 | .map_err(|error| JournalError::store(ErrorCode::ProvenanceCheckpoint, error))?; |
| 167 | owner_failpoint("after-checkpoint-prepare"); |
| 168 | Ok(attempt) |
| 169 | } |
| 170 | |
| 171 | /// The encoded size of one empty frozen-page response frame: the protobuf |
| 172 | /// message plus the 5-byte gRPC length-prefix. The budget reserves this |
no test coverage detected