Skip to content

Commit

Permalink
move: seqno.next()
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin-j97 committed Dec 13, 2024
1 parent 0a11dd3 commit c186528
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/partition/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -869,10 +869,11 @@ impl PartitionHandle {

let key = key.as_ref();
let value = value.as_ref();
let seqno = self.seqno.next();

let mut journal_writer = self.journal.get_writer();

let seqno = self.seqno.next();

// IMPORTANT: Check the poisoned flag after getting journal mutex, otherwise TOCTOU
if self.is_poisoned.load(Ordering::Relaxed) {
return Err(crate::Error::Poisoned);
Expand Down Expand Up @@ -942,10 +943,11 @@ impl PartitionHandle {
}

let key = key.as_ref();
let seqno = self.seqno.next();

let mut journal_writer = self.journal.get_writer();

let seqno = self.seqno.next();

// IMPORTANT: Check the poisoned flag after getting journal mutex, otherwise TOCTOU
if self.is_poisoned.load(Ordering::Relaxed) {
return Err(crate::Error::Poisoned);
Expand Down

0 comments on commit c186528

Please sign in to comment.