You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Todd Lipcon (Code Review)" <ge...@cloudera.org> on 2016/10/13 04:25:34 UTC

[kudu-CR] consensus: split ReplicaState in twain[1]

Hello David Ribeiro Alves, Mike Percy,

I'd like you to do a code review.  Please visit

    http://gerrit.cloudera.org:8080/4713

to review the following change.

Change subject: consensus: split ReplicaState in twain[1]
......................................................................

consensus: split ReplicaState in twain[1]

Following on the previous refactor, this splits out the parts of the
ReplicaState class that deal with pending consensus rounds into a new
PendingRounds class.

The change is mostly mechanical. The new class is made non-thread-safe
and we still use the synchronization of the ReplicaState class to
protect it. Since all of the methods dealing with pending rounds were
already 'Unlocked', this should be safe. The goal is to later make the
synchronization more fine-grained.

To that end, all of the methods were renamed to remove the 'Unlocked'
suffix.

There were several places in RaftConsensus which were using the
committed index/term tracked by PendingRounds, but it seems plausible
that these would be better tracked elsewhere. I left TODOs to deal with
this rather than making non-mechanical changes in this patch.

[1] https://www.youtube.com/watch?v=ZXRb6nPcx10

Change-Id: I95308ae8a5d65ada016ae08e0e8cf06c54b35909
---
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/consensus/raft_consensus_state.cc
M src/kudu/consensus/raft_consensus_state.h
5 files changed, 282 insertions(+), 281 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/13/4713/1
-- 
To view, visit http://gerrit.cloudera.org:8080/4713
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I95308ae8a5d65ada016ae08e0e8cf06c54b35909
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <dr...@apache.org>
Gerrit-Reviewer: Mike Percy <mp...@apache.org>

[kudu-CR] consensus: split ReplicaState in twain[1]

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Hello Kudu Jenkins,

I'd like you to reexamine a change.  Please visit

    http://gerrit.cloudera.org:8080/4713

to look at the new patch set (#4).

Change subject: consensus: split ReplicaState in twain[1]
......................................................................

consensus: split ReplicaState in twain[1]

Following on the previous refactor, this splits out the parts of the
ReplicaState class that deal with pending consensus rounds into a new
PendingRounds class.

The change is mostly mechanical. The new class is made non-thread-safe
and we still use the synchronization of the ReplicaState class to
protect it. Since all of the methods dealing with pending rounds were
already 'Unlocked', this should be safe. The goal is to later make the
synchronization more fine-grained.

To that end, all of the methods were renamed to remove the 'Unlocked'
suffix.

There were several places in RaftConsensus which were using the
committed index/term tracked by PendingRounds, but it seems plausible
that these would be better tracked elsewhere. I left TODOs to deal with
this rather than making non-mechanical changes in this patch.

[1] https://www.youtube.com/watch?v=ZXRb6nPcx10

Change-Id: I95308ae8a5d65ada016ae08e0e8cf06c54b35909
---
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/consensus/raft_consensus_state.cc
M src/kudu/consensus/raft_consensus_state.h
5 files changed, 290 insertions(+), 299 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/13/4713/4
-- 
To view, visit http://gerrit.cloudera.org:8080/4713
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I95308ae8a5d65ada016ae08e0e8cf06c54b35909
Gerrit-PatchSet: 4
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <dr...@apache.org>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>

[kudu-CR] consensus: split ReplicaState in twain[1]

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Hello David Ribeiro Alves, Mike Percy, Kudu Jenkins,

I'd like you to reexamine a change.  Please visit

    http://gerrit.cloudera.org:8080/4713

to look at the new patch set (#6).

Change subject: consensus: split ReplicaState in twain[1]
......................................................................

consensus: split ReplicaState in twain[1]

Following on the previous refactor, this splits out the parts of the
ReplicaState class that deal with pending consensus rounds into a new
PendingRounds class.

The change is mostly mechanical. The new class is made non-thread-safe
and we still use the synchronization of the ReplicaState class to
protect it. Since all of the methods dealing with pending rounds were
already 'Unlocked', this should be safe. The goal is to later make the
synchronization more fine-grained.

To that end, all of the methods were renamed to remove the 'Unlocked'
suffix.

There were several places in RaftConsensus which were using the
committed index/term tracked by PendingRounds, but it seems plausible
that these would be better tracked elsewhere. I left TODOs to deal with
this rather than making non-mechanical changes in this patch.

[1] https://www.youtube.com/watch?v=ZXRb6nPcx10

Change-Id: I95308ae8a5d65ada016ae08e0e8cf06c54b35909
---
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/consensus/raft_consensus_state.cc
M src/kudu/consensus/raft_consensus_state.h
5 files changed, 293 insertions(+), 299 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/13/4713/6
-- 
To view, visit http://gerrit.cloudera.org:8080/4713
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I95308ae8a5d65ada016ae08e0e8cf06c54b35909
Gerrit-PatchSet: 6
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <dr...@apache.org>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>

[kudu-CR] consensus: split ReplicaState in twain[1]

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change.

Change subject: consensus: split ReplicaState in twain[1]
......................................................................


Patch Set 1:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/4713/1/src/kudu/consensus/raft_consensus_state.h
File src/kudu/consensus/raft_consensus_state.h:

Line 71: class ReplicaState {
> should we rename this to ConsensusMetaState or something?
yea, wanted to defer that to another patch where we clean up the remainder of this class. In fact most of what remains is some locking and a bunch of "pass-through" methods to ConsensusMeta, so maybe this class isn't really necessary at all.

I guess I should update the class doc though.


Line 257: // Tracks the pending consensus rounds being managed by a Raft replica (either leader
> not your fault, but the mix of rounds, ops and transactions in method names
yea, I left a TODO below about this but let me move the TODO up to the top here about cleaning up naming throughout. I tried to minimize renames in this patch just to keep it easy to review.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I95308ae8a5d65ada016ae08e0e8cf06c54b35909
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <dr...@apache.org>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: Yes

[kudu-CR] consensus: split ReplicaState in twain[1]

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change.

Change subject: consensus: split ReplicaState in twain[1]
......................................................................


Patch Set 7: Code-Review+2

carrying the +2 from earlier since it was just nits

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I95308ae8a5d65ada016ae08e0e8cf06c54b35909
Gerrit-PatchSet: 7
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <dr...@apache.org>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: No

[kudu-CR] consensus: split ReplicaState in twain[1]

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has submitted this change and it was merged.

Change subject: consensus: split ReplicaState in twain[1]
......................................................................


consensus: split ReplicaState in twain[1]

Following on the previous refactor, this splits out the parts of the
ReplicaState class that deal with pending consensus rounds into a new
PendingRounds class.

The change is mostly mechanical. The new class is made non-thread-safe
and we still use the synchronization of the ReplicaState class to
protect it. Since all of the methods dealing with pending rounds were
already 'Unlocked', this should be safe. The goal is to later make the
synchronization more fine-grained.

To that end, all of the methods were renamed to remove the 'Unlocked'
suffix.

There were several places in RaftConsensus which were using the
committed index/term tracked by PendingRounds, but it seems plausible
that these would be better tracked elsewhere. I left TODOs to deal with
this rather than making non-mechanical changes in this patch.

[1] https://www.youtube.com/watch?v=ZXRb6nPcx10

Change-Id: I95308ae8a5d65ada016ae08e0e8cf06c54b35909
Reviewed-on: http://gerrit.cloudera.org:8080/4713
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <to...@apache.org>
---
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/consensus/raft_consensus_state.cc
M src/kudu/consensus/raft_consensus_state.h
5 files changed, 293 insertions(+), 299 deletions(-)

Approvals:
  Todd Lipcon: Looks good to me, approved
  Kudu Jenkins: Verified



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I95308ae8a5d65ada016ae08e0e8cf06c54b35909
Gerrit-PatchSet: 8
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <dr...@apache.org>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>

[kudu-CR] consensus: split ReplicaState in twain[1]

Posted by "David Ribeiro Alves (Code Review)" <ge...@cloudera.org>.
David Ribeiro Alves has posted comments on this change.

Change subject: consensus: split ReplicaState in twain[1]
......................................................................


Patch Set 5: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I95308ae8a5d65ada016ae08e0e8cf06c54b35909
Gerrit-PatchSet: 5
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <dr...@apache.org>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: No

[kudu-CR] consensus: split ReplicaState in twain[1]

Posted by "Mike Percy (Code Review)" <ge...@cloudera.org>.
Mike Percy has posted comments on this change.

Change subject: consensus: split ReplicaState in twain[1]
......................................................................


Patch Set 5: Code-Review+2

(1 comment)

http://gerrit.cloudera.org:8080/#/c/4713/3/src/kudu/consensus/raft_consensus.h
File src/kudu/consensus/raft_consensus.h:

Line 450: 
Add comment indicating how this is protected?


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I95308ae8a5d65ada016ae08e0e8cf06c54b35909
Gerrit-PatchSet: 5
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <dr...@apache.org>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: Yes

[kudu-CR] consensus: split ReplicaState in twain[1]

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Hello David Ribeiro Alves, Mike Percy, Kudu Jenkins,

I'd like you to reexamine a change.  Please visit

    http://gerrit.cloudera.org:8080/4713

to look at the new patch set (#7).

Change subject: consensus: split ReplicaState in twain[1]
......................................................................

consensus: split ReplicaState in twain[1]

Following on the previous refactor, this splits out the parts of the
ReplicaState class that deal with pending consensus rounds into a new
PendingRounds class.

The change is mostly mechanical. The new class is made non-thread-safe
and we still use the synchronization of the ReplicaState class to
protect it. Since all of the methods dealing with pending rounds were
already 'Unlocked', this should be safe. The goal is to later make the
synchronization more fine-grained.

To that end, all of the methods were renamed to remove the 'Unlocked'
suffix.

There were several places in RaftConsensus which were using the
committed index/term tracked by PendingRounds, but it seems plausible
that these would be better tracked elsewhere. I left TODOs to deal with
this rather than making non-mechanical changes in this patch.

[1] https://www.youtube.com/watch?v=ZXRb6nPcx10

Change-Id: I95308ae8a5d65ada016ae08e0e8cf06c54b35909
---
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/consensus/raft_consensus_state.cc
M src/kudu/consensus/raft_consensus_state.h
5 files changed, 293 insertions(+), 299 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/13/4713/7
-- 
To view, visit http://gerrit.cloudera.org:8080/4713
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I95308ae8a5d65ada016ae08e0e8cf06c54b35909
Gerrit-PatchSet: 7
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <dr...@apache.org>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>

[kudu-CR] consensus: split ReplicaState in twain[1]

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Hello Kudu Jenkins,

I'd like you to reexamine a change.  Please visit

    http://gerrit.cloudera.org:8080/4713

to look at the new patch set (#2).

Change subject: consensus: split ReplicaState in twain[1]
......................................................................

consensus: split ReplicaState in twain[1]

Following on the previous refactor, this splits out the parts of the
ReplicaState class that deal with pending consensus rounds into a new
PendingRounds class.

The change is mostly mechanical. The new class is made non-thread-safe
and we still use the synchronization of the ReplicaState class to
protect it. Since all of the methods dealing with pending rounds were
already 'Unlocked', this should be safe. The goal is to later make the
synchronization more fine-grained.

To that end, all of the methods were renamed to remove the 'Unlocked'
suffix.

There were several places in RaftConsensus which were using the
committed index/term tracked by PendingRounds, but it seems plausible
that these would be better tracked elsewhere. I left TODOs to deal with
this rather than making non-mechanical changes in this patch.

[1] https://www.youtube.com/watch?v=ZXRb6nPcx10

Change-Id: I95308ae8a5d65ada016ae08e0e8cf06c54b35909
---
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/consensus/raft_consensus_state.cc
M src/kudu/consensus/raft_consensus_state.h
5 files changed, 290 insertions(+), 300 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/13/4713/2
-- 
To view, visit http://gerrit.cloudera.org:8080/4713
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I95308ae8a5d65ada016ae08e0e8cf06c54b35909
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <dr...@apache.org>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>

[kudu-CR] consensus: split ReplicaState in twain[1]

Posted by "David Ribeiro Alves (Code Review)" <ge...@cloudera.org>.
David Ribeiro Alves has posted comments on this change.

Change subject: consensus: split ReplicaState in twain[1]
......................................................................


Patch Set 1:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/4713/1/src/kudu/consensus/raft_consensus_state.h
File src/kudu/consensus/raft_consensus_state.h:

Line 71: class ReplicaState {
should we rename this to ConsensusMetaState or something?


Line 257: // Tracks the pending consensus rounds being managed by a Raft replica (either leader
not your fault, but the mix of rounds, ops and transactions in method names is a bit confusing. can we consolidate?


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I95308ae8a5d65ada016ae08e0e8cf06c54b35909
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <dr...@apache.org>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-HasComments: Yes

[kudu-CR] consensus: split ReplicaState in twain[1]

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change.

Change subject: consensus: split ReplicaState in twain[1]
......................................................................


Patch Set 3:

(3 comments)

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

Line 657: }
> warning: missing username/bug in TODO [google-readability-todo]
removed this TODO, I think it's right.


http://gerrit.cloudera.org:8080/#/c/4713/1/src/kudu/consensus/raft_consensus.h
File src/kudu/consensus/raft_consensus.h:

Line 454:   // TODO(mpercy): Plumb this from ServerBase.
> warning: missing username/bug in TODO [google-readability-todo]
Done


http://gerrit.cloudera.org:8080/#/c/4713/3/src/kudu/consensus/raft_consensus.h
File src/kudu/consensus/raft_consensus.h:

Line 450:   PendingRounds pending_;
> Add comment indicating how this is protected?
Done


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I95308ae8a5d65ada016ae08e0e8cf06c54b35909
Gerrit-PatchSet: 3
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <dr...@apache.org>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: Yes