store: index ops take WriteTransaction, mutations batch properly
Index functions now take &WriteTransaction instead of &Database, allowing callers to batch multiple index operations in a single transaction. Store mutations (upsert, delete, rename, etc.) now begin_write/commit their own transactions, ensuring atomicity. - replay_relations uses single txn for all relation indexing - Store::db() exposes Database for callers needing txn control - Convenience wrappers open their own txn for simple cases Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
2548ca059d
commit
4696bb8b7d
5 changed files with 151 additions and 144 deletions
|
|
@ -323,7 +323,7 @@ pub async fn cmd_dedup(apply: bool) -> Result<()> {
|
|||
|
||||
// Remove doomed nodes from index
|
||||
for (doomed_node, _) in &copies[1..] {
|
||||
store.remove_from_index(&doomed_node.key, &doomed_node.uuid)?;
|
||||
store.remove_from_index(&doomed_node.key)?;
|
||||
}
|
||||
|
||||
merged += doomed_uuids.len();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue