Mike Percy has submitted this change and it was merged. Change subject: Make ConsensusMetadata thread-safe ......................................................................
Make ConsensusMetadata thread-safe This patch simply adds locks around all accessors and makes ConsensusMetadata refcounted. This enables ConsensusMetadata to be safely used outside of the RaftConsensus class (with certain caveats). This is needed to implement tombstoned voting in a follow-up patch. Also, add some helper methods to ConsensusMetadata to avoid making excessive copies of the RaftConfigPB in various cases: bool IsVoterInConfig(const std::string& uuid, RaftConfigState type); bool IsMemberInConfig(const std::string& uuid, RaftConfigState type); int CountVotersInConfig(RaftConfigState type); int64_t GetConfigOpIdIndex(RaftConfigState type); Change-Id: Id2c70605c0593e55486184705ea448dcb4bef2d7 Reviewed-on: http://gerrit.cloudera.org:8080/6958 Reviewed-by: Todd Lipcon <[email protected]> Tested-by: Mike Percy <[email protected]> --- M src/kudu/consensus/consensus_meta-test.cc M src/kudu/consensus/consensus_meta.cc M src/kudu/consensus/consensus_meta.h M src/kudu/consensus/quorum_util.h M src/kudu/consensus/raft_consensus.cc M src/kudu/consensus/raft_consensus.h M src/kudu/consensus/raft_consensus_quorum-test.cc M src/kudu/integration-tests/ts_recovery-itest.cc M src/kudu/master/sys_catalog.cc M src/kudu/tablet/tablet_bootstrap-test.cc M src/kudu/tablet/tablet_bootstrap.cc M src/kudu/tablet/tablet_replica-test.cc M src/kudu/tablet/tablet_replica.cc M src/kudu/tools/tool_action_local_replica.cc M src/kudu/tserver/tablet_copy_client.cc M src/kudu/tserver/tablet_copy_client.h M src/kudu/tserver/tablet_copy_source_session-test.cc M src/kudu/tserver/ts_tablet_manager.cc 18 files changed, 315 insertions(+), 157 deletions(-) Approvals: Mike Percy: Verified Todd Lipcon: Looks good to me, approved -- To view, visit http://gerrit.cloudera.org:8080/6958 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id2c70605c0593e55486184705ea448dcb4bef2d7 Gerrit-PatchSet: 11 Gerrit-Project: kudu Gerrit-Branch: master Gerrit-Owner: Mike Percy <[email protected]> Gerrit-Reviewer: Alexey Serbin <[email protected]> Gerrit-Reviewer: David Ribeiro Alves <[email protected]> Gerrit-Reviewer: Mike Percy <[email protected]> Gerrit-Reviewer: Tidy Bot Gerrit-Reviewer: Todd Lipcon <[email protected]>
