You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by mp...@apache.org on 2016/06/16 22:39:55 UTC

[1/3] incubator-kudu git commit: ITBLL: Specify all possible columns to partition on

Repository: incubator-kudu
Updated Branches:
  refs/heads/master 1ead68156 -> 99f4be13d


ITBLL: Specify all possible columns to partition on

key2 may be used as a partitioning column as well, if more than one
tablet is specified.

Change-Id: Ibf18771f7d2dc6e070a792ccfdd1f4069a3b0d91
Reviewed-on: http://gerrit.cloudera.org:8080/3380
Tested-by: Kudu Jenkins
Reviewed-by: Jean-Daniel Cryans


Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/00562f6b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/00562f6b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/00562f6b

Branch: refs/heads/master
Commit: 00562f6bd8eab2fb2f8ad23863e628e743d9da2d
Parents: 1ead681
Author: Mike Percy <mp...@apache.org>
Authored: Mon Jun 13 19:41:22 2016 -0700
Committer: Jean-Daniel Cryans <jd...@gerrit.cloudera.org>
Committed: Tue Jun 14 15:23:42 2016 +0000

----------------------------------------------------------------------
 .../org/kududb/mapreduce/tools/IntegrationTestBigLinkedList.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/00562f6b/java/kudu-client-tools/src/main/java/org/kududb/mapreduce/tools/IntegrationTestBigLinkedList.java
----------------------------------------------------------------------
diff --git a/java/kudu-client-tools/src/main/java/org/kududb/mapreduce/tools/IntegrationTestBigLinkedList.java b/java/kudu-client-tools/src/main/java/org/kududb/mapreduce/tools/IntegrationTestBigLinkedList.java
index be601e7..549e117 100644
--- a/java/kudu-client-tools/src/main/java/org/kududb/mapreduce/tools/IntegrationTestBigLinkedList.java
+++ b/java/kudu-client-tools/src/main/java/org/kududb/mapreduce/tools/IntegrationTestBigLinkedList.java
@@ -612,7 +612,7 @@ public class IntegrationTestBigLinkedList extends Configured implements Tool {
 
         CreateTableOptions builder =
             new CreateTableOptions().setNumReplicas(parser.getNumReplicas())
-                                    .setRangePartitionColumns(ImmutableList.of("key1"));
+                                    .setRangePartitionColumns(ImmutableList.of("key1", "key2"));
         if (numTablets > 1) {
           BigInteger min = BigInteger.valueOf(Long.MIN_VALUE);
           BigInteger max = BigInteger.valueOf(Long.MAX_VALUE);


[2/3] incubator-kudu git commit: RaftConsensus: Trigger election at startup if single node

Posted by mp...@apache.org.
RaftConsensus: Trigger election at startup if single node

If a tablet's replication factor is 1 then don't wait for the failure
detector to kick in. Simply kick off an election immediately.

Change-Id: Ief51ab20c051db83bea51c146b24a11036d9f953
Reviewed-on: http://gerrit.cloudera.org:8080/3344
Reviewed-by: David Ribeiro Alves <dr...@apache.org>
Tested-by: Mike Percy <mp...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/ee4fc9f6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/ee4fc9f6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/ee4fc9f6

Branch: refs/heads/master
Commit: ee4fc9f6b7b7d81127ec623a630c9221511444f8
Parents: 00562f6
Author: Mike Percy <mp...@apache.org>
Authored: Wed Jun 8 21:15:39 2016 -0700
Committer: Mike Percy <mp...@apache.org>
Committed: Thu Jun 16 22:34:27 2016 +0000

----------------------------------------------------------------------
 src/kudu/consensus/raft_consensus.cc            | 20 ++++++++++++++++++++
 src/kudu/consensus/raft_consensus.h             |  4 ++++
 .../integration-tests/raft_consensus-itest.cc   |  7 ++++---
 3 files changed, 28 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/ee4fc9f6/src/kudu/consensus/raft_consensus.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/raft_consensus.cc b/src/kudu/consensus/raft_consensus.cc
index 710075a..aeaa79a 100644
--- a/src/kudu/consensus/raft_consensus.cc
+++ b/src/kudu/consensus/raft_consensus.cc
@@ -309,6 +309,13 @@ Status RaftConsensus::Start(const ConsensusBootstrapInfo& info) {
     RETURN_NOT_OK(BecomeReplicaUnlocked());
   }
 
+  bool single_voter = false;
+  RETURN_NOT_OK(IsSingleVoterConfig(&single_voter));
+  if (single_voter && FLAGS_enable_leader_failure_detection) {
+    LOG_WITH_PREFIX(INFO) << "Only one voter in the Raft config. Triggering election immediately";
+    RETURN_NOT_OK(StartElection(NORMAL_ELECTION));
+  }
+
   RETURN_NOT_OK(ExecuteHook(POST_START));
 
   // Report become visible to the Master.
@@ -710,6 +717,19 @@ Status RaftConsensus::StartReplicaTransactionUnlocked(const ReplicateRefPtr& msg
   return state_->AddPendingOperation(round_ptr);
 }
 
+Status RaftConsensus::IsSingleVoterConfig(bool* single_voter) const {
+  ReplicaState::UniqueLock lock;
+  RETURN_NOT_OK(state_->LockForRead(&lock));
+  const RaftConfigPB& config = state_->GetCommittedConfigUnlocked();
+  const string& uuid = state_->GetPeerUuid();
+  if (CountVoters(config) == 1 && IsRaftConfigVoter(uuid, config)) {
+    *single_voter = true;
+  } else {
+    *single_voter = false;
+  }
+  return Status::OK();
+}
+
 std::string RaftConsensus::LeaderRequest::OpsRangeString() const {
   std::string ret;
   ret.reserve(100);

http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/ee4fc9f6/src/kudu/consensus/raft_consensus.h
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/raft_consensus.h b/src/kudu/consensus/raft_consensus.h
index 2864ff3..4bf0fe8 100644
--- a/src/kudu/consensus/raft_consensus.h
+++ b/src/kudu/consensus/raft_consensus.h
@@ -289,6 +289,10 @@ class RaftConsensus : public Consensus,
   // that uses transactions, delegates to StartConsensusOnlyRoundUnlocked().
   Status StartReplicaTransactionUnlocked(const ReplicateRefPtr& msg);
 
+  // Returns OK and sets 'single_voter' if this node is the only voter in the
+  // Raft configuration.
+  Status IsSingleVoterConfig(bool* single_voter) const;
+
   // Return header string for RequestVote log messages. The ReplicaState lock must be held.
   std::string GetRequestVoteLogPrefixUnlocked() const;
 

http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/ee4fc9f6/src/kudu/integration-tests/raft_consensus-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/raft_consensus-itest.cc b/src/kudu/integration-tests/raft_consensus-itest.cc
index 62f8f82..2f21dd1 100644
--- a/src/kudu/integration-tests/raft_consensus-itest.cc
+++ b/src/kudu/integration-tests/raft_consensus-itest.cc
@@ -1075,9 +1075,10 @@ TEST_F(RaftConsensusITest, TestAutomaticLeaderElectionOneReplica) {
   vector<string> ts_flags;
   vector<string> master_flags = { "--catalog_manager_allow_local_consensus=false" };
   BuildAndStart(ts_flags, master_flags);
-
-  TServerDetails* leader;
-  ASSERT_OK(GetLeaderReplicaWithRetries(tablet_id_, &leader));
+  // Ensure that single-node Raft configs elect themselves as leader
+  // immediately upon Consensus startup.
+  ASSERT_OK(GetReplicaStatusAndCheckIfLeader(tablet_servers_[cluster_->tablet_server(0)->uuid()],
+                                             tablet_id_, MonoDelta::FromMilliseconds(500)));
 }
 
 void RaftConsensusITest::StubbornlyWriteSameRowThread(int replica_idx, const AtomicBool* finish) {


[3/3] incubator-kudu git commit: Add more helpful CHECK message at master startup

Posted by mp...@apache.org.
Add more helpful CHECK message at master startup

Maybe this could help debug KUDU-1488 a little bit

Change-Id: I86b5c9d9553b251c289b51bddfe3f84beaa489e9
Reviewed-on: http://gerrit.cloudera.org:8080/3396
Reviewed-by: Jean-Daniel Cryans
Tested-by: Mike Percy <mp...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/99f4be13
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/99f4be13
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/99f4be13

Branch: refs/heads/master
Commit: 99f4be13d81b4bb7d5db2f78f465ff61a390a3db
Parents: ee4fc9f
Author: Mike Percy <mp...@apache.org>
Authored: Tue Jun 14 14:47:01 2016 -0700
Committer: Mike Percy <mp...@apache.org>
Committed: Thu Jun 16 22:39:32 2016 +0000

----------------------------------------------------------------------
 src/kudu/master/sys_catalog.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/99f4be13/src/kudu/master/sys_catalog.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/sys_catalog.cc b/src/kudu/master/sys_catalog.cc
index 0a968e5..dbcc4c6 100644
--- a/src/kudu/master/sys_catalog.cc
+++ b/src/kudu/master/sys_catalog.cc
@@ -456,7 +456,9 @@ Status SysCatalogTable::VisitTables(TableVisitor* visitor) {
 
   const int8_t tables_entry = TABLES_ENTRY;
   const int type_col_idx = schema_.find_column(kSysCatalogTableColType);
-  CHECK(type_col_idx != Schema::kColumnNotFound);
+  CHECK(type_col_idx != Schema::kColumnNotFound)
+      << "Cannot find sys catalog table column " << kSysCatalogTableColType << " in schema: "
+      << schema_.ToString();
 
   auto pred_tables = ColumnPredicate::Equality(schema_.column(type_col_idx), &tables_entry);
   ScanSpec spec;