Fix clang analyze

Summary:
This fixes the errors as reported here:
https://github.com/facebook/rocksdb/pull/3941#issuecomment-394424043
Closes https://github.com/facebook/rocksdb/pull/3950

Differential Revision: D8263086

Pulled By: lth

fbshipit-source-id: 5e148d489cab2153e5846d16979a0a1f2d677d57
main
Manuel Ung 7 years ago committed by Facebook Github Bot
parent f4b72d7056
commit ab2254bedf
  1. 9
      utilities/transactions/transaction_test.cc

@ -98,6 +98,7 @@ TEST_P(TransactionTest, DoubleEmptyWrite) {
delete txn0;
reinterpret_cast<PessimisticTransactionDB*>(db)->TEST_Crash();
ASSERT_OK(ReOpenNoDelete());
assert(db != nullptr);
txn0 = db->GetTransactionByName("xid2");
ASSERT_OK(txn0->Commit());
delete txn0;
@ -145,6 +146,7 @@ TEST_P(TransactionTest, ValidateSnapshotTest) {
ReadOptions read_options;
std::string value;
assert(db != nullptr);
Transaction* txn1 =
db->BeginTransaction(write_options, TransactionOptions());
ASSERT_TRUE(txn1);
@ -935,6 +937,7 @@ TEST_P(TransactionTest, SimpleTwoPhaseTransactionTest) {
// kill and reopen to trigger recovery
s = ReOpenNoDelete();
ASSERT_OK(s);
assert(db != nullptr);
s = db->Get(read_options, "gtid", &value);
ASSERT_OK(s);
ASSERT_EQ(value, "dogs");
@ -1065,6 +1068,7 @@ TEST_P(TransactionTest, TwoPhaseEmptyWriteTest) {
// kill and reopen to trigger recovery
s = ReOpenNoDelete();
ASSERT_OK(s);
assert(db != nullptr);
s = db->Get(read_options, "foo", &value);
ASSERT_OK(s);
ASSERT_EQ(value, "bar");
@ -1419,6 +1423,7 @@ TEST_P(TransactionTest, TwoPhaseLongPrepareTest) {
for (int i = 0; i < 1000; i++) {
std::string key(i, 'k');
std::string val(1000, 'v');
assert(db != nullptr);
s = db->Put(write_options, key, val);
ASSERT_OK(s);
@ -1494,6 +1499,7 @@ TEST_P(TransactionTest, TwoPhaseSequenceTest) {
// kill and reopen
env->SetFilesystemActive(false);
ReOpenNoDelete();
assert(db != nullptr);
// value is now available
s = db->Get(read_options, "foo4", &value);
@ -1560,6 +1566,7 @@ TEST_P(TransactionTest, TwoPhaseDoubleRecoveryTest) {
// kill and reopen
env->SetFilesystemActive(false);
ReOpenNoDelete();
assert(db != nullptr);
// value is now available
s = db->Get(read_options, "foo", &value);
@ -1912,6 +1919,7 @@ TEST_P(TransactionTest, TwoPhaseOutOfOrderDelete) {
env->SetFilesystemActive(false);
reinterpret_cast<PessimisticTransactionDB*>(db)->TEST_Crash();
ReOpenNoDelete();
assert(db != nullptr);
s = db->Get(read_options, "first", &value);
ASSERT_OK(s);
@ -2180,6 +2188,7 @@ TEST_P(TransactionTest, FlushTest2) {
Status s = ReOpen();
ASSERT_OK(s);
assert(db != nullptr);
WriteOptions write_options;
ReadOptions read_options, snapshot_read_options;

Loading…
Cancel
Save