Skip to content

Commit

Permalink
WriteUnPrepared: fix ubsan complaint (#5148)
Browse files Browse the repository at this point in the history
Summary:
Ubsna complains that in initialization of WriteUnpreparedTxnReadCallback the method of the child class is used before the parent class is constructed. The patch fixes that by making the aforementioned method static.
Pull Request resolved: #5148

Differential Revision: D14760098

Pulled By: maysamyabandeh

fbshipit-source-id: cf19b7c1fdb5de0a54e62c1deebe09a0fa048ded
  • Loading branch information
Maysam Yabandeh authored and facebook-github-bot committed Apr 3, 2019
1 parent ebb9b2e commit 7441a0e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions utilities/transactions/write_unprepared_txn.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ class WriteUnpreparedTxnReadCallback : public ReadCallback {

// TODO(myabandeh): override Refresh when Iterator::Refresh is supported
private:
SequenceNumber CalcMaxVisibleSeq(WriteUnpreparedTxn* txn,
SequenceNumber snapshot_seq) {
static SequenceNumber CalcMaxVisibleSeq(WriteUnpreparedTxn* txn,
SequenceNumber snapshot_seq) {
SequenceNumber max_unprepared = CalcMaxUnpreparedSequenceNumber(txn);
assert(snapshot_seq < max_unprepared || max_unprepared == 0 ||
snapshot_seq == kMaxSequenceNumber);
return std::max(max_unprepared, snapshot_seq);
}
SequenceNumber CalcMaxUnpreparedSequenceNumber(WriteUnpreparedTxn* txn);
static SequenceNumber CalcMaxUnpreparedSequenceNumber(
WriteUnpreparedTxn* txn);
WritePreparedTxnDB* db_;
WriteUnpreparedTxn* txn_;
SequenceNumber wup_snapshot_;
Expand Down

0 comments on commit 7441a0e

Please sign in to comment.