store: add reindex_relations for after Vec mutations
- Add index::clear_relations() to drop and recreate RELS table - Add Store::reindex_relations() to rebuild index from Vec - Call reindex_relations() at end of dedup command This ensures index stays in sync with Vec after complex mutations like UUID redirection in dedup. Vec mutations remain for now but index is correctly updated afterward. Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
58b0947625
commit
c2de14dcab
3 changed files with 27 additions and 2 deletions
|
|
@ -61,7 +61,7 @@ pub async fn cmd_fsck() -> Result<()> {
|
|||
store::fsck()?;
|
||||
|
||||
let arc = memory::access_local()?;
|
||||
let mut store = arc.lock().await;
|
||||
let store = arc.lock().await;
|
||||
|
||||
// Check node-key consistency
|
||||
let mut issues = 0;
|
||||
|
|
@ -287,8 +287,9 @@ pub async fn cmd_dedup(apply: bool) -> Result<()> {
|
|||
merged += doomed_uuids.len();
|
||||
}
|
||||
|
||||
// Remove tombstoned relations from cache
|
||||
// Remove tombstoned relations from cache and rebuild index
|
||||
store.relations.retain(|r| !r.deleted);
|
||||
store.reindex_relations()?;
|
||||
store.save()?;
|
||||
|
||||
println!("Merged {} duplicates, redirected {} edges, deduped {} duplicate edges",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue