(
data_dir: &Path,
_core_id: usize,
hnsw_indexes: &[crate::data::snapshot::HnswSnapshot],
)
| 199 | } |
| 200 | |
| 201 | fn restore_vector_checkpoints( |
| 202 | data_dir: &Path, |
| 203 | _core_id: usize, |
| 204 | hnsw_indexes: &[crate::data::snapshot::HnswSnapshot], |
| 205 | ) -> crate::Result<u64> { |
| 206 | if hnsw_indexes.is_empty() { |
| 207 | return Ok(0); |
| 208 | } |
| 209 | |
| 210 | let ckpt_dir = data_dir.join("vector-ckpt"); |
| 211 | // no-objectstore: HNSW checkpoints are mmap'd locally for query hot path. |
| 212 | std::fs::create_dir_all(&ckpt_dir).map_err(crate::Error::Io)?; |
| 213 | |
| 214 | let mut total_vectors = 0u64; |
| 215 | for idx in hnsw_indexes { |
| 216 | let key = format!("{}:{}:emb", idx.tenant_id, idx.collection); |
| 217 | let ckpt_path = ckpt_dir.join(format!("{key}.ckpt")); |
| 218 | let tmp_path = ckpt_dir.join(format!("{key}.ckpt.tmp")); |
| 219 | nodedb_wal::segment::atomic_write_fsync(&tmp_path, &ckpt_path, &idx.checkpoint_bytes) |
| 220 | .map_err(crate::Error::Wal)?; |
| 221 | total_vectors += 1; |
| 222 | } |
| 223 | |
| 224 | info!( |
| 225 | collections = hnsw_indexes.len(), |
| 226 | "vector checkpoints restored" |
| 227 | ); |
| 228 | Ok(total_vectors) |
| 229 | } |
| 230 | |
| 231 | fn restore_crdt_checkpoints( |
| 232 | data_dir: &Path, |
no test coverage detected