Andrew Wong has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/16034 )

Change subject: [consensus] KUDU-2727 lock-free CheckLeadershipAndBindTerm()
......................................................................


Patch Set 5:

(3 comments)

Have you run any tests or benchmarks that illustrate the improvement this patch 
makes on the contention?

http://gerrit.cloudera.org:8080/#/c/16034/5/src/kudu/consensus/consensus_meta.h
File src/kudu/consensus/consensus_meta.h:

http://gerrit.cloudera.org:8080/#/c/16034/5/src/kudu/consensus/consensus_meta.h@249
PS5, Line 249:
             :   // Cached term and role of the peer_uuid_ within the active 
configuration,
             :   // packed into 64-bit integer.
nit: could you add some color to this comment as to why we are using this 
cached value vs active_role_, and when to use which?


http://gerrit.cloudera.org:8080/#/c/16034/5/src/kudu/consensus/raft_consensus.cc
File src/kudu/consensus/raft_consensus.cc:

http://gerrit.cloudera.org:8080/#/c/16034/5/src/kudu/consensus/raft_consensus.cc@717
PS5, Line 717:   const auto s = AppendNewRoundToQueueUnlocked(round);
             :   if (s.ok()) {
             :     leader_is_ready_ = true;
             :   }
             :   return s;
micro-nit: perhaps simpler as

 RETURN_NOT_OK(AppendNewRoundToQueueUnlocked(round));
 leader_is_ready_ = true;
 return Status::OK();


http://gerrit.cloudera.org:8080/#/c/16034/5/src/kudu/consensus/raft_consensus.cc@779
PS5, Line 779: // The order of reading role_and_term and leader_is_ready is 
essential to
             :   // deal with situations when leader_is_ready and role_and_term 
are read
             :   // in different Raft terms.
Just checking my understanding of the ordering nuances here:
- it's safe to bind to a stale term even if we've asserted leadership in a 
newer term -- the stale op will be rejected on followers anyway because Raft 
guarantees that a majority of replicas have accepted the new term
- it's safe for the term to be stale if we haven't asserted leadership for a 
newer term because we'll exit out below
- it's _unsafe_ to bind to a newer term if we've asserted leadership for a 
stale term, hence this ordering



--
To view, visit http://gerrit.cloudera.org:8080/16034
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I934ae3035d893fd850afe27d96f8dd6612c9ffbd
Gerrit-Change-Number: 16034
Gerrit-PatchSet: 5
Gerrit-Owner: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Andrew Wong <[email protected]>
Gerrit-Reviewer: Bankim Bhavsar <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Comment-Date: Sat, 20 Jun 2020 02:15:55 +0000
Gerrit-HasComments: Yes

Reply via email to