Repository: kudu Updated Branches: refs/heads/master 5fe0787f6 -> 3ae7fe1c9
[delete_table-test] Don't fail on multiple attempts to delete an orphaned tablet TestUnknownTabletsAreNotDeleted is flaky with the following assertion: /data/jenkins-workspace/kudu-workspace/src/kudu/integration-tests/delete_table-test.cc:1099: Failure Value of: num_delete_attempts Actual: 3 Expected: 1 This is due to the master receiving more than 1 tablet report before the tablet server has the time to delete the tablet. Security-related changes likely shifted the timings and the heartbeat period is set very low in this test, so this is more likely to happen. Nonetheless the opportunity for flakyness was there even before these changes. In addition to fixing the assertion on the metric, this patch also adds an assertion that the tablet was actually deleted. Change-Id: I2b5f21c718bad8c0b7112395082371f19a61507f Reviewed-on: http://gerrit.cloudera.org:8080/6191 Reviewed-by: Adar Dembo <[email protected]> Tested-by: David Ribeiro Alves <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/75279b54 Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/75279b54 Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/75279b54 Branch: refs/heads/master Commit: 75279b54682d71e37f9a2cc720180e8c690520a0 Parents: 5fe0787 Author: David Alves <[email protected]> Authored: Tue Feb 28 15:30:06 2017 -0800 Committer: David Ribeiro Alves <[email protected]> Committed: Wed Mar 1 01:59:56 2017 +0000 ---------------------------------------------------------------------- src/kudu/integration-tests/delete_table-test.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/75279b54/src/kudu/integration-tests/delete_table-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/integration-tests/delete_table-test.cc b/src/kudu/integration-tests/delete_table-test.cc index 08a4554..b4c27fc 100644 --- a/src/kudu/integration-tests/delete_table-test.cc +++ b/src/kudu/integration-tests/delete_table-test.cc @@ -1053,6 +1053,12 @@ TEST_F(DeleteTableTest, TestUnknownTabletsAreNotDeleted) { .num_replicas(1) .Create()); + // Figure out the tablet id of the created tablet. + const MonoDelta timeout = MonoDelta::FromSeconds(30); + vector<ListTabletsResponsePB::StatusAndSchemaPB> tablets; + ASSERT_OK(WaitForNumTabletsOnTS(ts_map_.begin()->second, 1, timeout, &tablets)); + const string& tablet_id = tablets[0].tablet_status().tablet_id(); + // Delete the master's metadata and start it back up. The tablet created // above is now unknown, but should not be deleted! cluster_->master()->Shutdown(); @@ -1096,7 +1102,10 @@ TEST_F(DeleteTableTest, TestUnknownTabletsAreNotDeleted) { &METRIC_ENTITY_server, "kudu.tabletserver", &METRIC_handler_latency_kudu_tserver_TabletServerAdminService_DeleteTablet, "total_count", &num_delete_attempts)); - ASSERT_EQ(1, num_delete_attempts); + // Sometimes the tablet server has time to report the orphaned tablet multiple times + // before the delete succeeds. This is ok because tablet deletion is idempotent. + ASSERT_GE(num_delete_attempts, 1); + ASSERT_OK(CheckTabletDeletedOnTS(0, tablet_id, SUPERBLOCK_NOT_EXPECTED)); }); }
