This is an automated email from the ASF dual-hosted git repository.
alexey pushed a commit to branch branch-1.18.x
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/branch-1.18.x by this push:
new d96d03015 KUDU-3596 fix one of the brittle assertions
d96d03015 is described below
commit d96d030151a286d9cc37f65f7d15aca88f2f078c
Author: Alexey Serbin <[email protected]>
AuthorDate: Mon Feb 3 13:14:24 2025 -0800
KUDU-3596 fix one of the brittle assertions
The TsTabletManagerITest.TestTableStats scenario is very brittle due the
assumptions on various operations' timings. This patch addresses one
of them, replacing SleepFor(...) with more robust
InternalMiniCluster::WaitForTabletServerCount() condition.
The motivation for this changelist was following assertion in dist-test
failure [1] from a built-and-test pre-commit build for unrelated patch:
src/kudu/integration-tests/ts_tablet_manager-itest.cc:785: Failure
Expected equality of these values:
live_row_count
Which is: 434
table_info->GetMetrics()->live_row_count->value()
Which is: 0
...
src/kudu/integration-tests/ts_tablet_manager-itest.cc:895: Failure
Expected: CheckStats(kRowsCount) doesn't generate new fatal failures in
the current thread.
Actual: it does.
[1]
http://dist-test.cloudera.org/job?job_id=jenkins-slave.1738567082.3715745
Change-Id: Id8581ecc0368ca17c14bcfc578f3896c9515b819
Reviewed-on: http://gerrit.cloudera.org:8080/22444
Tested-by: Kudu Jenkins
Reviewed-by: Yifan Zhang <[email protected]>
(cherry picked from commit c9ab243d7df46361eea548b39f1e52ff591c0c92)
Reviewed-on: http://gerrit.cloudera.org:8080/22445
Tested-by: Alexey Serbin <[email protected]>
---
src/kudu/integration-tests/ts_tablet_manager-itest.cc | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/kudu/integration-tests/ts_tablet_manager-itest.cc
b/src/kudu/integration-tests/ts_tablet_manager-itest.cc
index 1b898d0e6..fd5ac4f42 100644
--- a/src/kudu/integration-tests/ts_tablet_manager-itest.cc
+++ b/src/kudu/integration-tests/ts_tablet_manager-itest.cc
@@ -24,6 +24,7 @@
#include <ostream>
#include <string>
#include <thread>
+#include <type_traits>
#include <unordered_map>
#include <utility>
#include <vector>
@@ -888,10 +889,10 @@ TEST_F(TsTabletManagerITest, TestTableStats) {
mini_master->Shutdown();
SleepFor(MonoDelta::FromMilliseconds(kMaxElectionTime));
ASSERT_OK(mini_master->Restart());
- // Sometimes the election fails until the node restarts.
- // And the restarted node is elected leader again.
- // So, it is necessary to wait for all tservers to report.
- SleepFor(MonoDelta::FromMilliseconds(FLAGS_heartbeat_interval_ms));
+ // Sometimes the restarted master is elected leader again just after
+ // starting up. It is necessary to wait for all tservers to report before
+ // sampling the table's stats.
+ ASSERT_OK(cluster_->WaitForTabletServerCount(kNumTservers));
NO_FATALS(CheckStats(kRowsCount));
}
}