Skip to content

Commit

Permalink
Reduce lock contention in non_durable_commit()
Browse files Browse the repository at this point in the history
  • Loading branch information
cberner committed Oct 11, 2023
1 parent a70cfb6 commit fa4b6d9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tree_store/page_store/page_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,15 +582,16 @@ impl TransactionalMemory {
debug_assert!(self.open_dirty_pages.lock().unwrap().is_empty());
assert!(!self.needs_recovery.load(Ordering::Acquire));

self.allocated_since_commit.lock().unwrap().clear();
self.storage.write_barrier()?;

let mut state = self.state.lock().unwrap();
let secondary = state.header.secondary_slot_mut();
secondary.transaction_id = transaction_id;
secondary.user_root = data_root;
secondary.system_root = system_root;
secondary.freed_root = freed_root;

self.allocated_since_commit.lock().unwrap().clear();
self.storage.write_barrier()?;
// TODO: maybe we can remove this flag and just update the in-memory DatabaseHeader state?
self.read_from_secondary.store(true, Ordering::Release);

Expand Down

0 comments on commit fa4b6d9

Please sign in to comment.