Skip to content

Commit

Permalink
transaction_test: fix UnlockWALStallCleared
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuval-Ariel committed May 17, 2023
1 parent 76c3030 commit 486a5d4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions utilities/transactions/transaction_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6641,7 +6641,7 @@ TEST_P(TransactionTest, StallTwoWriteQueues) {
}

// Make sure UnlockWAL does not return until the stall it controls is cleared.
TEST_P(TransactionTest, DISABLED_UnlockWALStallCleared) {
TEST_P(TransactionTest, UnlockWALStallCleared) {
auto dbimpl = static_cast_with_check<DBImpl>(db->GetRootDB());
for (bool external_stall : {false, true}) {
WriteOptions wopts;
Expand Down Expand Up @@ -6703,6 +6703,7 @@ TEST_P(TransactionTest, DISABLED_UnlockWALStallCleared) {
ASSERT_OK(txn0->Put("k3", "val3"));
ASSERT_OK(txn0->Prepare()); // nonmem
ASSERT_OK(txn0->Commit());
t2_completed = true;
}};

// Be sure the test is set up appropriately
Expand All @@ -6711,9 +6712,6 @@ TEST_P(TransactionTest, DISABLED_UnlockWALStallCleared) {
ASSERT_FALSE(t1_completed.load());
ASSERT_FALSE(t2_completed.load());

// Clear the stall
ASSERT_OK(db->UnlockWAL());

WriteOptions wopts2 = wopts;
if (external_stall) {
// We did not deadlock in UnlockWAL, so now async clear the external
Expand All @@ -6731,6 +6729,10 @@ TEST_P(TransactionTest, DISABLED_UnlockWALStallCleared) {
// the thread that did BeginWriteStall() can do EndWriteStall()
wopts2.no_slowdown = true;
}

// Clear the stall
ASSERT_OK(db->UnlockWAL());

std::unique_ptr<Transaction> txn0{db->BeginTransaction(wopts2, {})};
ASSERT_OK(txn0->SetName("x2"));
ASSERT_OK(txn0->Put("k1", "val4"));
Expand Down

0 comments on commit 486a5d4

Please sign in to comment.