You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by to...@apache.org on 2016/08/15 19:32:18 UTC

[3/3] kudu git commit: Support downgrade to version that has LocalConsensus

Support downgrade to version that has LocalConsensus

Continue writing the "local=false" field into RaftConfigPB when we have
more than one member of the config.

This partially reverts a few lines of code from revision
35a92b49913ceea80d9c0c61cb7af2ebcf007751, which removed the
LocalConsensus implementation from Kudu. Because the "local" field will
no longer be used, the code writing it was removed. However, since that
field is used by previous versions, and defaults to true if unset, if we
want to allow users to downgrade Kudu to an older version then we need
to keep writing it for a while.

Change-Id: I6d324b4f3ce5906bfc9a4df49dd60ca0cb919820
Reviewed-on: http://gerrit.cloudera.org:8080/3985
Reviewed-by: Todd Lipcon <to...@apache.org>
Tested-by: Todd Lipcon <to...@apache.org>


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

Branch: refs/heads/master
Commit: 74210b2546df9fd5dec7bb926eeb524362d2da90
Parents: 865d160
Author: Mike Percy <mp...@apache.org>
Authored: Mon Aug 15 09:03:42 2016 -0700
Committer: Todd Lipcon <to...@apache.org>
Committed: Mon Aug 15 19:28:04 2016 +0000

----------------------------------------------------------------------
 src/kudu/master/catalog_manager.cc | 7 +++++++
 src/kudu/master/sys_catalog.cc     | 1 +
 2 files changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/74210b25/src/kudu/master/catalog_manager.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/catalog_manager.cc b/src/kudu/master/catalog_manager.cc
index 85b6bab..6d756fe 100644
--- a/src/kudu/master/catalog_manager.cc
+++ b/src/kudu/master/catalog_manager.cc
@@ -3171,6 +3171,13 @@ Status CatalogManager::SelectReplicasForTablet(const TSDescriptorVector& ts_desc
           ->pb.mutable_committed_consensus_state();
   cstate->set_current_term(kMinimumTerm);
   consensus::RaftConfigPB *config = cstate->mutable_config();
+
+  // Maintain ability to downgrade Kudu to a version with LocalConsensus.
+  if (nreplicas > 1) {
+    // Defaults to true in old versions of Kudu.
+    config->set_obsolete_local(false);
+  }
+
   config->set_opid_index(consensus::kInvalidOpIdIndex);
   SelectReplicas(ts_descs, nreplicas, config);
   return Status::OK();

http://git-wip-us.apache.org/repos/asf/kudu/blob/74210b25/src/kudu/master/sys_catalog.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/sys_catalog.cc b/src/kudu/master/sys_catalog.cc
index fe5d161..35da4b6 100644
--- a/src/kudu/master/sys_catalog.cc
+++ b/src/kudu/master/sys_catalog.cc
@@ -180,6 +180,7 @@ Status SysCatalogTable::SetupDistributedConfig(const MasterOptions& options,
   DCHECK(options.IsDistributed());
 
   RaftConfigPB new_config;
+  new_config.set_obsolete_local(false);
   new_config.set_opid_index(consensus::kInvalidOpIdIndex);
 
   // Build the set of followers from our server options.