|
|
|
@ -223,7 +223,7 @@ TEST_P(TransactionTest, ValidateSnapshotTest) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (with_flush) { |
|
|
|
|
auto db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
|
auto db_impl = static_cast_with_check<DBImpl>(db->GetRootDB()); |
|
|
|
|
db_impl->TEST_FlushMemTable(true); |
|
|
|
|
// Make sure the flushed memtable is not kept in memory
|
|
|
|
|
int max_memtable_in_history = |
|
|
|
@ -882,7 +882,7 @@ TEST_P(TransactionTest, LogMarkLeakTest) { |
|
|
|
|
assert(db != nullptr); |
|
|
|
|
Random rnd(47); |
|
|
|
|
std::vector<Transaction*> txns; |
|
|
|
|
DBImpl* db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
|
DBImpl* db_impl = static_cast_with_check<DBImpl>(db->GetRootDB()); |
|
|
|
|
// At the beginning there should be no log containing prepare data
|
|
|
|
|
ASSERT_EQ(db_impl->TEST_FindMinLogContainingOutstandingPrep(), 0); |
|
|
|
|
for (size_t i = 0; i < 100; i++) { |
|
|
|
@ -923,7 +923,7 @@ TEST_P(TransactionTest, SimpleTwoPhaseTransactionTest) { |
|
|
|
|
string value; |
|
|
|
|
Status s; |
|
|
|
|
|
|
|
|
|
DBImpl* db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
|
DBImpl* db_impl = static_cast_with_check<DBImpl>(db->GetRootDB()); |
|
|
|
|
|
|
|
|
|
Transaction* txn = db->BeginTransaction(write_options, txn_options); |
|
|
|
|
s = txn->SetName("xid"); |
|
|
|
@ -1160,7 +1160,7 @@ TEST_P(TransactionTest, TwoPhaseEmptyWriteTest) { |
|
|
|
|
ASSERT_EQ(value, "bar"); |
|
|
|
|
} else { |
|
|
|
|
if (test_with_empty_wal) { |
|
|
|
|
DBImpl* db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
|
DBImpl* db_impl = static_cast_with_check<DBImpl>(db->GetRootDB()); |
|
|
|
|
db_impl->TEST_FlushMemTable(true); |
|
|
|
|
// After flush the state must be visible
|
|
|
|
|
s = db->Get(read_options, "foo", &value); |
|
|
|
@ -1222,7 +1222,7 @@ TEST_P(TransactionTest, TwoPhaseRollbackTest) { |
|
|
|
|
std::string value; |
|
|
|
|
Status s; |
|
|
|
|
|
|
|
|
|
DBImpl* db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
|
DBImpl* db_impl = static_cast_with_check<DBImpl>(db->GetRootDB()); |
|
|
|
|
Transaction* txn = db->BeginTransaction(write_options, txn_options); |
|
|
|
|
s = txn->SetName("xid"); |
|
|
|
|
ASSERT_OK(s); |
|
|
|
@ -1293,7 +1293,7 @@ TEST_P(TransactionTest, PersistentTwoPhaseTransactionTest) { |
|
|
|
|
std::string value; |
|
|
|
|
Status s; |
|
|
|
|
|
|
|
|
|
DBImpl* db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
|
DBImpl* db_impl = static_cast_with_check<DBImpl>(db->GetRootDB()); |
|
|
|
|
|
|
|
|
|
Transaction* txn = db->BeginTransaction(write_options, txn_options); |
|
|
|
|
s = txn->SetName("xid"); |
|
|
|
@ -1340,7 +1340,7 @@ TEST_P(TransactionTest, PersistentTwoPhaseTransactionTest) { |
|
|
|
|
s = ReOpenNoDelete(); |
|
|
|
|
ASSERT_OK(s); |
|
|
|
|
assert(db != nullptr); |
|
|
|
|
db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
|
db_impl = static_cast_with_check<DBImpl>(db->GetRootDB()); |
|
|
|
|
|
|
|
|
|
// find trans in list of prepared transactions
|
|
|
|
|
std::vector<Transaction*> prepared_trans; |
|
|
|
@ -1685,7 +1685,7 @@ TEST_P(TransactionTest, TwoPhaseDoubleRecoveryTest) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(TransactionTest, TwoPhaseLogRollingTest) { |
|
|
|
|
DBImpl* db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
|
DBImpl* db_impl = static_cast_with_check<DBImpl>(db->GetRootDB()); |
|
|
|
|
|
|
|
|
|
Status s; |
|
|
|
|
std::string v; |
|
|
|
@ -1837,7 +1837,7 @@ TEST_P(TransactionTest, TwoPhaseLogRollingTest) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(TransactionTest, TwoPhaseLogRollingTest2) { |
|
|
|
|
DBImpl* db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
|
DBImpl* db_impl = static_cast_with_check<DBImpl>(db->GetRootDB()); |
|
|
|
|
|
|
|
|
|
Status s; |
|
|
|
|
ColumnFamilyHandle *cfa, *cfb; |
|
|
|
@ -1852,8 +1852,8 @@ TEST_P(TransactionTest, TwoPhaseLogRollingTest2) { |
|
|
|
|
wopts.disableWAL = false; |
|
|
|
|
wopts.sync = true; |
|
|
|
|
|
|
|
|
|
auto cfh_a = reinterpret_cast<ColumnFamilyHandleImpl*>(cfa); |
|
|
|
|
auto cfh_b = reinterpret_cast<ColumnFamilyHandleImpl*>(cfb); |
|
|
|
|
auto cfh_a = static_cast_with_check<ColumnFamilyHandleImpl>(cfa); |
|
|
|
|
auto cfh_b = static_cast_with_check<ColumnFamilyHandleImpl>(cfb); |
|
|
|
|
|
|
|
|
|
TransactionOptions topts1; |
|
|
|
|
Transaction* txn1 = db->BeginTransaction(wopts, topts1); |
|
|
|
@ -1982,7 +1982,7 @@ TEST_P(TransactionTest, TwoPhaseLogRollingTest2) { |
|
|
|
|
* hidden behind improperly summed sequence ids |
|
|
|
|
*/ |
|
|
|
|
TEST_P(TransactionTest, TwoPhaseOutOfOrderDelete) { |
|
|
|
|
DBImpl* db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
|
DBImpl* db_impl = static_cast_with_check<DBImpl>(db->GetRootDB()); |
|
|
|
|
WriteOptions wal_on, wal_off; |
|
|
|
|
wal_on.sync = true; |
|
|
|
|
wal_on.disableWAL = false; |
|
|
|
@ -2301,7 +2301,7 @@ TEST_P(TransactionTest, FlushTest2) { |
|
|
|
|
TransactionOptions txn_options; |
|
|
|
|
string value; |
|
|
|
|
|
|
|
|
|
DBImpl* db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
|
DBImpl* db_impl = static_cast_with_check<DBImpl>(db->GetRootDB()); |
|
|
|
|
|
|
|
|
|
db->Put(write_options, Slice("foo"), Slice("bar")); |
|
|
|
|
db->Put(write_options, Slice("foo2"), Slice("bar2")); |
|
|
|
@ -5187,13 +5187,13 @@ TEST_P(TransactionTest, ToggleAutoCompactionTest) { |
|
|
|
|
&handles, &db); |
|
|
|
|
ASSERT_OK(s); |
|
|
|
|
|
|
|
|
|
auto cfh_default = reinterpret_cast<ColumnFamilyHandleImpl*>(handles[0]); |
|
|
|
|
auto cfh_default = static_cast_with_check<ColumnFamilyHandleImpl>(handles[0]); |
|
|
|
|
auto opt_default = *cfh_default->cfd()->GetLatestMutableCFOptions(); |
|
|
|
|
|
|
|
|
|
auto cfh_a = reinterpret_cast<ColumnFamilyHandleImpl*>(handles[1]); |
|
|
|
|
auto cfh_a = static_cast_with_check<ColumnFamilyHandleImpl>(handles[1]); |
|
|
|
|
auto opt_a = *cfh_a->cfd()->GetLatestMutableCFOptions(); |
|
|
|
|
|
|
|
|
|
auto cfh_b = reinterpret_cast<ColumnFamilyHandleImpl*>(handles[2]); |
|
|
|
|
auto cfh_b = static_cast_with_check<ColumnFamilyHandleImpl>(handles[2]); |
|
|
|
|
auto opt_b = *cfh_b->cfd()->GetLatestMutableCFOptions(); |
|
|
|
|
|
|
|
|
|
ASSERT_EQ(opt_default.disable_auto_compactions, false); |
|
|
|
@ -5441,7 +5441,7 @@ TEST_P(TransactionStressTest, SeqAdvanceTest) { |
|
|
|
|
}; |
|
|
|
|
const size_t max_n = static_cast<size_t>(1) << NUM_BRANCHES; |
|
|
|
|
for (size_t n = 0; n < max_n; n++) { |
|
|
|
|
DBImpl* db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
|
DBImpl* db_impl = static_cast_with_check<DBImpl>(db->GetRootDB()); |
|
|
|
|
size_t branch = 0; |
|
|
|
|
auto seq = db_impl->GetLatestSequenceNumber(); |
|
|
|
|
exp_seq = seq; |
|
|
|
@ -5457,7 +5457,7 @@ TEST_P(TransactionStressTest, SeqAdvanceTest) { |
|
|
|
|
if (!short_test && branch_do(n, &branch)) { |
|
|
|
|
ASSERT_OK(db_impl->FlushWAL(true)); |
|
|
|
|
ASSERT_OK(ReOpenNoDelete()); |
|
|
|
|
db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
|
db_impl = static_cast_with_check<DBImpl>(db->GetRootDB()); |
|
|
|
|
seq = db_impl->GetLatestSequenceNumber(); |
|
|
|
|
ASSERT_EQ(exp_seq, seq); |
|
|
|
|
} |
|
|
|
@ -5479,7 +5479,7 @@ TEST_P(TransactionStressTest, SeqAdvanceTest) { |
|
|
|
|
if (!short_test && branch_do(n, &branch)) { |
|
|
|
|
ASSERT_OK(db_impl->FlushWAL(true)); |
|
|
|
|
ASSERT_OK(ReOpenNoDelete()); |
|
|
|
|
db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
|
db_impl = static_cast_with_check<DBImpl>(db->GetRootDB()); |
|
|
|
|
seq = db_impl->GetLatestSequenceNumber(); |
|
|
|
|
ASSERT_EQ(exp_seq, seq); |
|
|
|
|
} |
|
|
|
@ -5496,7 +5496,7 @@ TEST_P(TransactionStressTest, SeqAdvanceTest) { |
|
|
|
|
if (!short_test && branch_do(n, &branch)) { |
|
|
|
|
ASSERT_OK(db_impl->FlushWAL(true)); |
|
|
|
|
ASSERT_OK(ReOpenNoDelete()); |
|
|
|
|
db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
|
db_impl = static_cast_with_check<DBImpl>(db->GetRootDB()); |
|
|
|
|
seq = db_impl->GetLatestSequenceNumber(); |
|
|
|
|
ASSERT_EQ(exp_seq, seq); |
|
|
|
|
} |
|
|
|
@ -5514,7 +5514,7 @@ TEST_P(TransactionStressTest, SeqAdvanceTest) { |
|
|
|
|
if (!short_test && branch_do(n, &branch)) { |
|
|
|
|
ASSERT_OK(db_impl->FlushWAL(true)); |
|
|
|
|
ASSERT_OK(ReOpenNoDelete()); |
|
|
|
|
db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
|
db_impl = static_cast_with_check<DBImpl>(db->GetRootDB()); |
|
|
|
|
seq = db_impl->GetLatestSequenceNumber(); |
|
|
|
|
ASSERT_EQ(exp_seq, seq); |
|
|
|
|
} |
|
|
|
@ -5531,7 +5531,7 @@ TEST_P(TransactionStressTest, SeqAdvanceTest) { |
|
|
|
|
if (!short_test && branch_do(n, &branch)) { |
|
|
|
|
ASSERT_OK(db_impl->FlushWAL(true)); |
|
|
|
|
ASSERT_OK(ReOpenNoDelete()); |
|
|
|
|
db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
|
db_impl = static_cast_with_check<DBImpl>(db->GetRootDB()); |
|
|
|
|
seq = db_impl->GetLatestSequenceNumber(); |
|
|
|
|
ASSERT_EQ(exp_seq, seq); |
|
|
|
|
} |
|
|
|
@ -5917,7 +5917,7 @@ TEST_P(TransactionTest, DuplicateKeys) { |
|
|
|
|
// This will check the asserts inside recovery code
|
|
|
|
|
db->FlushWAL(true); |
|
|
|
|
// Flush only cf 1
|
|
|
|
|
reinterpret_cast<DBImpl*>(db->GetRootDB()) |
|
|
|
|
static_cast_with_check<DBImpl>(db->GetRootDB()) |
|
|
|
|
->TEST_FlushMemTable(true, false, handles[1]); |
|
|
|
|
reinterpret_cast<PessimisticTransactionDB*>(db)->TEST_Crash(); |
|
|
|
|
ASSERT_OK(ReOpenNoDelete(cfds, &handles)); |
|
|
|
@ -5955,7 +5955,7 @@ TEST_P(TransactionTest, DuplicateKeys) { |
|
|
|
|
// This will check the asserts inside recovery code
|
|
|
|
|
ASSERT_OK(db->FlushWAL(true)); |
|
|
|
|
// Flush only cf 1
|
|
|
|
|
reinterpret_cast<DBImpl*>(db->GetRootDB()) |
|
|
|
|
static_cast_with_check<DBImpl>(db->GetRootDB()) |
|
|
|
|
->TEST_FlushMemTable(true, false, handles[1]); |
|
|
|
|
reinterpret_cast<PessimisticTransactionDB*>(db)->TEST_Crash(); |
|
|
|
|
ASSERT_OK(ReOpenNoDelete(cfds, &handles)); |
|
|
|
@ -5988,7 +5988,7 @@ TEST_P(TransactionTest, DuplicateKeys) { |
|
|
|
|
// This will check the asserts inside recovery code
|
|
|
|
|
ASSERT_OK(db->FlushWAL(true)); |
|
|
|
|
// Flush only cf 1
|
|
|
|
|
reinterpret_cast<DBImpl*>(db->GetRootDB()) |
|
|
|
|
static_cast_with_check<DBImpl>(db->GetRootDB()) |
|
|
|
|
->TEST_FlushMemTable(true, false, handles[1]); |
|
|
|
|
reinterpret_cast<PessimisticTransactionDB*>(db)->TEST_Crash(); |
|
|
|
|
ASSERT_OK(ReOpenNoDelete(cfds, &handles)); |
|
|
|
@ -6015,7 +6015,7 @@ TEST_P(TransactionTest, DuplicateKeys) { |
|
|
|
|
// This will check the asserts inside recovery code
|
|
|
|
|
ASSERT_OK(db->FlushWAL(true)); |
|
|
|
|
// Flush only cf 1
|
|
|
|
|
reinterpret_cast<DBImpl*>(db->GetRootDB()) |
|
|
|
|
static_cast_with_check<DBImpl>(db->GetRootDB()) |
|
|
|
|
->TEST_FlushMemTable(true, false, handles[1]); |
|
|
|
|
reinterpret_cast<PessimisticTransactionDB*>(db)->TEST_Crash(); |
|
|
|
|
ASSERT_OK(ReOpenNoDelete(cfds, &handles)); |
|
|
|
@ -6042,7 +6042,7 @@ TEST_P(TransactionTest, DuplicateKeys) { |
|
|
|
|
// This will check the asserts inside recovery code
|
|
|
|
|
ASSERT_OK(db->FlushWAL(true)); |
|
|
|
|
// Flush only cf 1
|
|
|
|
|
reinterpret_cast<DBImpl*>(db->GetRootDB()) |
|
|
|
|
static_cast_with_check<DBImpl>(db->GetRootDB()) |
|
|
|
|
->TEST_FlushMemTable(true, false, handles[1]); |
|
|
|
|
reinterpret_cast<PessimisticTransactionDB*>(db)->TEST_Crash(); |
|
|
|
|
ASSERT_OK(ReOpenNoDelete(cfds, &handles)); |
|
|
|
@ -6157,7 +6157,7 @@ TEST_P(TransactionTest, DoubleCrashInRecovery) { |
|
|
|
|
ASSERT_OK(db->Put(write_options, "foo4", "bar4")); |
|
|
|
|
|
|
|
|
|
db->FlushWAL(true); |
|
|
|
|
DBImpl* db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
|
DBImpl* db_impl = static_cast_with_check<DBImpl>(db->GetRootDB()); |
|
|
|
|
uint64_t wal_file_id = db_impl->TEST_LogfileNumber(); |
|
|
|
|
std::string fname = LogFileName(dbname, wal_file_id); |
|
|
|
|
reinterpret_cast<PessimisticTransactionDB*>(db)->TEST_Crash(); |
|
|
|
|