(
data_dir: &Path,
_core_id: usize,
crdt_snapshots: &[crate::data::snapshot::CrdtSnapshot],
)
| 229 | } |
| 230 | |
| 231 | fn restore_crdt_checkpoints( |
| 232 | data_dir: &Path, |
| 233 | _core_id: usize, |
| 234 | crdt_snapshots: &[crate::data::snapshot::CrdtSnapshot], |
| 235 | ) -> crate::Result<()> { |
| 236 | if crdt_snapshots.is_empty() { |
| 237 | return Ok(()); |
| 238 | } |
| 239 | |
| 240 | let ckpt_dir = data_dir.join("crdt-ckpt"); |
| 241 | // no-objectstore: CRDT state lands in a local engine-owned directory. |
| 242 | std::fs::create_dir_all(&ckpt_dir).map_err(crate::Error::Io)?; |
| 243 | |
| 244 | for snap in crdt_snapshots { |
| 245 | let ckpt_path = ckpt_dir.join(format!("tenant-{}.ckpt", snap.tenant_id)); |
| 246 | let tmp_path = ckpt_dir.join(format!("tenant-{}.ckpt.tmp", snap.tenant_id)); |
| 247 | nodedb_wal::segment::atomic_write_fsync(&tmp_path, &ckpt_path, &snap.snapshot_bytes) |
| 248 | .map_err(crate::Error::Wal)?; |
| 249 | } |
| 250 | |
| 251 | info!(tenants = crdt_snapshots.len(), "CRDT checkpoints restored"); |
| 252 | Ok(()) |
| 253 | } |
| 254 | |
| 255 | /// Write a restore marker to the object store that tells the startup code to |
| 256 | /// replay WAL records only from the given LSN forward. |
no test coverage detected