|
|
@ -1015,6 +1015,7 @@ TEST_P(WritePreparedTransactionTest, AdvanceMaxEvictedSeqWithDuplicatesTest) { |
|
|
|
wp_db->db_impl_->FlushWAL(true); |
|
|
|
wp_db->db_impl_->FlushWAL(true); |
|
|
|
wp_db->TEST_Crash(); |
|
|
|
wp_db->TEST_Crash(); |
|
|
|
ReOpenNoDelete(); |
|
|
|
ReOpenNoDelete(); |
|
|
|
|
|
|
|
assert(db != nullptr); |
|
|
|
wp_db = dynamic_cast<WritePreparedTxnDB*>(db); |
|
|
|
wp_db = dynamic_cast<WritePreparedTxnDB*>(db); |
|
|
|
wp_db->AdvanceMaxEvictedSeq(0, new_max); |
|
|
|
wp_db->AdvanceMaxEvictedSeq(0, new_max); |
|
|
|
s = db->Get(ropt, db->DefaultColumnFamily(), "key", &pinnable_val); |
|
|
|
s = db->Get(ropt, db->DefaultColumnFamily(), "key", &pinnable_val); |
|
|
@ -1146,6 +1147,7 @@ TEST_P(SeqAdvanceConcurrentTest, SeqAdvanceConcurrentTest) { |
|
|
|
// Check if recovery preserves the last sequence number
|
|
|
|
// Check if recovery preserves the last sequence number
|
|
|
|
db_impl->FlushWAL(true); |
|
|
|
db_impl->FlushWAL(true); |
|
|
|
ReOpenNoDelete(); |
|
|
|
ReOpenNoDelete(); |
|
|
|
|
|
|
|
assert(db != nullptr); |
|
|
|
db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
seq = db_impl->TEST_GetLastVisibleSequence(); |
|
|
|
seq = db_impl->TEST_GetLastVisibleSequence(); |
|
|
|
ASSERT_EQ(exp_seq, seq); |
|
|
|
ASSERT_EQ(exp_seq, seq); |
|
|
@ -1158,6 +1160,7 @@ TEST_P(SeqAdvanceConcurrentTest, SeqAdvanceConcurrentTest) { |
|
|
|
// Check if recovery after flush preserves the last sequence number
|
|
|
|
// Check if recovery after flush preserves the last sequence number
|
|
|
|
db_impl->FlushWAL(true); |
|
|
|
db_impl->FlushWAL(true); |
|
|
|
ReOpenNoDelete(); |
|
|
|
ReOpenNoDelete(); |
|
|
|
|
|
|
|
assert(db != nullptr); |
|
|
|
db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
db_impl = reinterpret_cast<DBImpl*>(db->GetRootDB()); |
|
|
|
seq = db_impl->GetLatestSequenceNumber(); |
|
|
|
seq = db_impl->GetLatestSequenceNumber(); |
|
|
|
ASSERT_EQ(exp_seq, seq); |
|
|
|
ASSERT_EQ(exp_seq, seq); |
|
|
@ -1212,6 +1215,7 @@ TEST_P(WritePreparedTransactionTest, BasicRecoveryTest) { |
|
|
|
wp_db->db_impl_->FlushWAL(true); |
|
|
|
wp_db->db_impl_->FlushWAL(true); |
|
|
|
wp_db->TEST_Crash(); |
|
|
|
wp_db->TEST_Crash(); |
|
|
|
ReOpenNoDelete(); |
|
|
|
ReOpenNoDelete(); |
|
|
|
|
|
|
|
assert(db != nullptr); |
|
|
|
wp_db = dynamic_cast<WritePreparedTxnDB*>(db); |
|
|
|
wp_db = dynamic_cast<WritePreparedTxnDB*>(db); |
|
|
|
// After recovery, all the uncommitted txns (0 and 1) should be inserted into
|
|
|
|
// After recovery, all the uncommitted txns (0 and 1) should be inserted into
|
|
|
|
// delayed_prepared_
|
|
|
|
// delayed_prepared_
|
|
|
@ -1256,6 +1260,7 @@ TEST_P(WritePreparedTransactionTest, BasicRecoveryTest) { |
|
|
|
wp_db->db_impl_->FlushWAL(true); |
|
|
|
wp_db->db_impl_->FlushWAL(true); |
|
|
|
wp_db->TEST_Crash(); |
|
|
|
wp_db->TEST_Crash(); |
|
|
|
ReOpenNoDelete(); |
|
|
|
ReOpenNoDelete(); |
|
|
|
|
|
|
|
assert(db != nullptr); |
|
|
|
wp_db = dynamic_cast<WritePreparedTxnDB*>(db); |
|
|
|
wp_db = dynamic_cast<WritePreparedTxnDB*>(db); |
|
|
|
ASSERT_TRUE(wp_db->prepared_txns_.empty()); |
|
|
|
ASSERT_TRUE(wp_db->prepared_txns_.empty()); |
|
|
|
ASSERT_FALSE(wp_db->delayed_prepared_empty_); |
|
|
|
ASSERT_FALSE(wp_db->delayed_prepared_empty_); |
|
|
@ -1290,6 +1295,7 @@ TEST_P(WritePreparedTransactionTest, BasicRecoveryTest) { |
|
|
|
delete txn2; |
|
|
|
delete txn2; |
|
|
|
wp_db->db_impl_->FlushWAL(true); |
|
|
|
wp_db->db_impl_->FlushWAL(true); |
|
|
|
ReOpenNoDelete(); |
|
|
|
ReOpenNoDelete(); |
|
|
|
|
|
|
|
assert(db != nullptr); |
|
|
|
wp_db = dynamic_cast<WritePreparedTxnDB*>(db); |
|
|
|
wp_db = dynamic_cast<WritePreparedTxnDB*>(db); |
|
|
|
ASSERT_TRUE(wp_db->prepared_txns_.empty()); |
|
|
|
ASSERT_TRUE(wp_db->prepared_txns_.empty()); |
|
|
|
ASSERT_TRUE(wp_db->delayed_prepared_empty_); |
|
|
|
ASSERT_TRUE(wp_db->delayed_prepared_empty_); |
|
|
@ -1590,6 +1596,7 @@ TEST_P(WritePreparedTransactionTest, RollbackTest) { |
|
|
|
db_impl->FlushWAL(true); |
|
|
|
db_impl->FlushWAL(true); |
|
|
|
dynamic_cast<WritePreparedTxnDB*>(db)->TEST_Crash(); |
|
|
|
dynamic_cast<WritePreparedTxnDB*>(db)->TEST_Crash(); |
|
|
|
ReOpenNoDelete(); |
|
|
|
ReOpenNoDelete(); |
|
|
|
|
|
|
|
assert(db != nullptr); |
|
|
|
wp_db = dynamic_cast<WritePreparedTxnDB*>(db); |
|
|
|
wp_db = dynamic_cast<WritePreparedTxnDB*>(db); |
|
|
|
txn = db->GetTransactionByName("xid0"); |
|
|
|
txn = db->GetTransactionByName("xid0"); |
|
|
|
ASSERT_FALSE(wp_db->delayed_prepared_empty_); |
|
|
|
ASSERT_FALSE(wp_db->delayed_prepared_empty_); |
|
|
|