You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by gr...@apache.org on 2019/02/04 22:29:14 UTC

[kudu] 01/02: Fix wrong substitute argument in ksck

This is an automated email from the ASF dual-hosted git repository.

granthenke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 37cf6dd2a8cceee5e3b28bc0276580446f6b4ddd
Author: Will Berkeley <wd...@gmail.org>
AuthorDate: Mon Feb 4 09:44:43 2019 -0800

    Fix wrong substitute argument in ksck
    
    0355d373a7 used the wrong substitute argument, producing messages like
    
    Tablet 7502f27f91d04070854a86dd62a204f9 of table 'foo' is conflicted: Tablet 7502f27f91d04070854a86dd62a204f9 of table 'foo' replicas' active configs disagree with the master's
    
    instead of
    
    Tablet 7502f27f91d04070854a86dd62a204f9 of table 'foo' is conflicted: 2 replicas' active configs disagree with the master's
    
    This fixes the error and adds a bit of test code to keep it from
    happening again.
    
    Change-Id: I90692a50e1abac8f7ddb5cac11a6bf6914457fe2
    Reviewed-on: http://gerrit.cloudera.org:8080/12352
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
    Reviewed-by: Grant Henke <gr...@apache.org>
    Tested-by: Kudu Jenkins
---
 src/kudu/tools/ksck-test.cc | 7 +++++--
 src/kudu/tools/ksck.cc      | 3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/kudu/tools/ksck-test.cc b/src/kudu/tools/ksck-test.cc
index b0c1792..34d7296 100644
--- a/src/kudu/tools/ksck-test.cc
+++ b/src/kudu/tools/ksck-test.cc
@@ -1285,7 +1285,10 @@ TEST_F(KsckTest, TestConsensusConflictExtraPeer) {
   ASSERT_EQ(1, error_messages.size());
   ASSERT_EQ("Corruption: table consistency check error: 1 out of 1 table(s) are not healthy",
             error_messages[0].ToString());
-  ASSERT_STR_CONTAINS(err_stream_.str(),
+  const string err_str = err_stream_.str();
+  ASSERT_STR_CONTAINS(err_str, "Tablet tablet-id-0 of table 'test' is conflicted: "
+                               "3 replicas' active configs disagree with the leader master's");
+  ASSERT_STR_CONTAINS(err_str,
       "The consensus matrix is:\n"
       " Config source |     Replicas     | Current term | Config index | Committed?\n"
       "---------------+------------------+--------------+--------------+------------\n"
@@ -1293,7 +1296,7 @@ TEST_F(KsckTest, TestConsensusConflictExtraPeer) {
       " A             | A*  B   C   D    | 0            |              | Yes\n"
       " B             | A*  B   C        | 0            |              | Yes\n"
       " C             | A*  B   C        | 0            |              | Yes");
-  ASSERT_STR_CONTAINS(err_stream_.str(),
+  ASSERT_STR_CONTAINS(err_str,
                       ExpectedKsckTableSummary("test",
                                                /*replication_factor=*/ 3,
                                                /*healthy_tablets=*/ 2,
diff --git a/src/kudu/tools/ksck.cc b/src/kudu/tools/ksck.cc
index e645987..a49d53f 100644
--- a/src/kudu/tools/ksck.cc
+++ b/src/kudu/tools/ksck.cc
@@ -742,7 +742,8 @@ KsckCheckResult Ksck::VerifyTablet(const shared_ptr<KsckTablet>& tablet,
                         tablet_str, Color(AnsiCode::RED, "unavailable"));
   } else if (conflicting_states > 0) {
     result = KsckCheckResult::CONSENSUS_MISMATCH;
-    status = Substitute("$0 is $1: $0 replicas' active configs disagree with the master's",
+    status = Substitute("$0 is $1: $2 replicas' active configs disagree with the "
+                        "leader master's",
                         tablet_str,
                         Color(AnsiCode::YELLOW, "conflicted"),
                         conflicting_states);