Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A5812200D62 for ; Sat, 2 Dec 2017 06:31:58 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id A40F5160C1A; Sat, 2 Dec 2017 05:31:58 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id F2CBE160C06 for ; Sat, 2 Dec 2017 06:31:57 +0100 (CET) Received: (qmail 56736 invoked by uid 500); 2 Dec 2017 05:31:57 -0000 Mailing-List: contact commits-help@kudu.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kudu.apache.org Delivered-To: mailing list commits@kudu.apache.org Received: (qmail 56720 invoked by uid 99); 2 Dec 2017 05:31:57 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Dec 2017 05:31:57 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E8EC0F6024; Sat, 2 Dec 2017 05:31:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mpercy@apache.org To: commits@kudu.apache.org Date: Sat, 02 Dec 2017 05:31:57 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/3] kudu git commit: web_ui: don't report failed tombstones as live archived-at: Sat, 02 Dec 2017 05:31:58 -0000 web_ui: don't report failed tombstones as live Previously, the logic to determine the liveness of a tablet in the web UI was to check that the replica's state message was exactly "TABLET_DATA_TOMBSTONED". For failed, tombstoned replicas, this message is "FAILED(TABLET_DATA_TOMBSTONED)", and as such, these replicas were being reported as live, failed tablets (scary!). This patch adjusts the logic to instead search for "TABLET_DATA_TOMBSTONED" in the message, which should be relatively short anyway. I considered actually using the replicas' internal 'state_' members, but felt that this is more appropriate considering it'd be debatable how to report STOPPING or FAILED tablets. A test is added to tablet_server-test that fails without the fix. Change-Id: I3529c32296b555d59ddde2593360b3b66081ba4b Reviewed-on: http://gerrit.cloudera.org:8080/8718 Reviewed-by: Mike Percy Tested-by: Mike Percy Reviewed-on: http://gerrit.cloudera.org:8080/8739 Reviewed-by: Andrew Wong Tested-by: Kudu Jenkins Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/b2a97b3f Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/b2a97b3f Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/b2a97b3f Branch: refs/heads/branch-1.6.x Commit: b2a97b3f7bf65c2022faa189229ca60a64eceeaf Parents: 10bca9d Author: Andrew Wong Authored: Fri Dec 1 15:14:44 2017 -0800 Committer: Mike Percy Committed: Sat Dec 2 05:31:31 2017 +0000 ---------------------------------------------------------------------- src/kudu/tserver/tablet_server-test.cc | 27 ++++++++++++++++++++++++++ src/kudu/tserver/tserver_path_handlers.cc | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/b2a97b3f/src/kudu/tserver/tablet_server-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/tserver/tablet_server-test.cc b/src/kudu/tserver/tablet_server-test.cc index eb037e0..de498dc 100644 --- a/src/kudu/tserver/tablet_server-test.cc +++ b/src/kudu/tserver/tablet_server-test.cc @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -358,6 +359,32 @@ TEST_F(TabletServerTest, TestWebPages) { #endif } +// Test that tablets that get failed and deleted will eventually show up as +// failed tombstones on the web UI. +TEST_F(TabletServerTest, TestFailedTabletsOnWebUI) { + scoped_refptr replica; + TSTabletManager* tablet_manager = mini_server_->server()->tablet_manager(); + ASSERT_TRUE(tablet_manager->LookupTablet(kTabletId, &replica)); + replica->SetError(Status::IOError("This error will leave the replica FAILED state at shutdown")); + replica->Shutdown(); + ASSERT_EQ(tablet::FAILED, replica->state()); + + // Now delete the tablet and leave it tombstoned, e.g. as if the failed + // replica were deleted. + TabletServerErrorPB::Code error_code; + ASSERT_OK(tablet_manager->DeleteTablet(kTabletId, + tablet::TABLET_DATA_TOMBSTONED, boost::none, &error_code)); + + EasyCurl c; + faststring buf; + const string addr = mini_server_->bound_http_addr().ToString(); + ASSERT_OK(c.FetchURL(Substitute("http://$0/tablets", addr), &buf)); + + // Ensure the html contains the "Tombstoned Tablets" header, indicating the + // failed tombstone is correctly displayed as a tombstone. + ASSERT_STR_CONTAINS(buf.ToString(), "Tombstoned Tablets"); +} + class TabletServerDiskFailureTest : public TabletServerTestBase { public: virtual void SetUp() override { http://git-wip-us.apache.org/repos/asf/kudu/blob/b2a97b3f/src/kudu/tserver/tserver_path_handlers.cc ---------------------------------------------------------------------- diff --git a/src/kudu/tserver/tserver_path_handlers.cc b/src/kudu/tserver/tserver_path_handlers.cc index c982d41..3dd602f 100644 --- a/src/kudu/tserver/tserver_path_handlers.cc +++ b/src/kudu/tserver/tserver_path_handlers.cc @@ -305,7 +305,7 @@ void TabletServerPathHandlers::HandleTabletsPage(const Webserver::WebRequest& /* vector> live_replicas; vector> tombstoned_replicas; for (const scoped_refptr& replica : replicas) { - if (replica->HumanReadableState() != "TABLET_DATA_TOMBSTONED") { + if (replica->HumanReadableState().find("TABLET_DATA_TOMBSTONED") == string::npos) { live_replicas.push_back(replica); } else { tombstoned_replicas.push_back(replica);