Skip to content

Commit 76f9c99

Browse files
committed
[yugabyte#20514] docdb: Fix flaky test RaftConsensusITest.TestExpiredOperationWithSchemaChange and enable this test on fastdebug
Summary: After we move from centos-gcc11-debug to alma8-gcc11-debug, RaftConsensusITest.TestExpiredOperationWithSchemaChange was constantly broken on alma8-gcc11-debug due to test bug. In the test, the intention was to stuck the old leader ts, so that schema change operation can be successfully done on the new leader. However, cluster_->tablet_server(0) doesn't always give us the leader ts. After fixing this line of code, the test passed on all builds. This bug also led us to disable the test on fastdebug in the past. After the fix, we can re-enble this test on fastdebug. Test Plan: ./yb_build.sh --cxx-test integration-tests_raft_consensus-itest --gtest_filter RaftConsensusITest.TestExpiredOperationWithSchemaChange --gcc11 -n 100 ./yb_build.sh fastdebug --cxx-test integration-tests_raft_consensus-itest --gtest_filter RaftConsensusITest.TestExpiredOperationWithSchemaChange --gcc11 -n 100 Reviewers: rthallam, qhu Reviewed By: qhu Subscribers: ybase, bogdan Differential Revision: https://phorge.dev.yugabyte.com/D31647
1 parent c480249 commit 76f9c99

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/yb/integration-tests/raft_consensus-itest.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,7 +2010,7 @@ TEST_F(RaftConsensusITest, TestReplicaBehaviorViaRPC) {
20102010
}
20112011
}
20122012

2013-
TEST_F(RaftConsensusITest, YB_DISABLE_TEST_IN_FASTDEBUG(TestExpiredOperationWithSchemaChange)) {
2013+
TEST_F(RaftConsensusITest, TestExpiredOperationWithSchemaChange) {
20142014
ANNOTATE_UNPROTECTED_WRITE(FLAGS_num_tablet_servers) = 3;
20152015

20162016
vector<string> ts_flags = {
@@ -2030,8 +2030,8 @@ TEST_F(RaftConsensusITest, YB_DISABLE_TEST_IN_FASTDEBUG(TestExpiredOperationWith
20302030
ASSERT_OK(WaitForServersToAgree(MonoDelta::FromSeconds(10), tablet_servers_, tablet_id_, 1));
20312031

20322032
// Make the the prepare thread to delay.
2033-
auto* const ts = cluster_->tablet_server(0);
2034-
ASSERT_OK(cluster_->SetFlag(ts, "TEST_block_prepare_batch", "true"));
2033+
auto* const stuck_ts = cluster_->tablet_server_by_uuid(tservers[0]->uuid());
2034+
ASSERT_OK(cluster_->SetFlag(stuck_ts, "TEST_block_prepare_batch", "true"));
20352035
// And the following write will also get delayed in prepare phase.
20362036
ASSERT_NOK(WriteSimpleTestRow(
20372037
tservers[0], tablet_id_, kTestRowKey, kTestRowIntVal, "foo", MonoDelta::FromSeconds(2)));
@@ -2068,7 +2068,7 @@ TEST_F(RaftConsensusITest, YB_DISABLE_TEST_IN_FASTDEBUG(TestExpiredOperationWith
20682068

20692069
// The previous delayed write operation's term and schema version is less than the current.
20702070
// Because of smaller term, we expect WriteQuery::Finish() will skip CHECK on schema version.
2071-
ASSERT_OK(cluster_->SetFlag(ts, "TEST_block_prepare_batch", "false"));
2071+
ASSERT_OK(cluster_->SetFlag(stuck_ts, "TEST_block_prepare_batch", "false"));
20722072
SleepFor(MonoDelta::FromMilliseconds(1000));
20732073
}
20742074

0 commit comments

Comments
 (0)