WriteUnPrepared: fix ubsan complaint (#5148)

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: https://github.com/facebook/rocksdb/pull/5148

Differential Revision: D14760098

Pulled By: maysamyabandeh

fbshipit-source-id: cf19b7c1fdb5de0a54e62c1deebe09a0fa048ded
This commit is contained in:
Maysam Yabandeh 2019-04-03 15:43:34 -07:00 committed by Facebook Github Bot
parent ebb9b2ed16
commit 7441a0ecba

View File

@ -42,14 +42,15 @@ class WriteUnpreparedTxnReadCallback : public ReadCallback {
// TODO(myabandeh): override Refresh when Iterator::Refresh is supported
private:
SequenceNumber CalcMaxVisibleSeq(WriteUnpreparedTxn* txn,
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_;