You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Mike Percy (Code Review)" <ge...@cloudera.org> on 2018/02/08 23:40:26 UTC

[kudu-CR] Add additonal form and tests for GetConsensusRole()

Hello Alexey Serbin,

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

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

to review the following change.


Change subject: Add additonal form and tests for GetConsensusRole()
......................................................................

Add additonal form and tests for GetConsensusRole()

There are cases where calling GetConsensusRole() without creating a
ConsensusStatePB object would be more efficient. This patch adds a
version of GetConsensusRole() with the following signature:

  RaftPeerPB::Role GetConsensusRole(const std::string& peer_uuid,
                                    const std::string& leader_uuid,
                                    const RaftConfigPB& config);

This patch also fixes a bug where the role of a non-voter that was
thought to be the leader would be returned as NON_PARTICIPANT instead of
LEARNER. However, that is an illegal state so it should not actually
affect production code.

Also added a unit test for both forms of GetConsensusRole().

Change-Id: Ic28f15c40ce99f89481cb6869d4843cbc024ed48
---
M src/kudu/consensus/quorum_util-test.cc
M src/kudu/consensus/quorum_util.cc
M src/kudu/consensus/quorum_util.h
3 files changed, 73 insertions(+), 14 deletions(-)



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

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic28f15c40ce99f89481cb6869d4843cbc024ed48
Gerrit-Change-Number: 9260
Gerrit-PatchSet: 1
Gerrit-Owner: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>

[kudu-CR] Add additonal form and tests for GetConsensusRole()

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/9260 )

Change subject: Add additonal form and tests for GetConsensusRole()
......................................................................


Patch Set 1:

(1 comment)

LGTM, just a small nit/question.

http://gerrit.cloudera.org:8080/#/c/9260/1/src/kudu/consensus/quorum_util-test.cc
File src/kudu/consensus/quorum_util-test.cc:

http://gerrit.cloudera.org:8080/#/c/9260/1/src/kudu/consensus/quorum_util-test.cc@287
PS1, Line 287:   ASSERT_EQ(NON_PARTICIPANT, GetConsensusRole("D", cstate)); // Illegal.
Does it make sense to add the following cases:

GetConsensusState("", "", config1);
GetConsensusState("", "A", config1);

?



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

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic28f15c40ce99f89481cb6869d4843cbc024ed48
Gerrit-Change-Number: 9260
Gerrit-PatchSet: 1
Gerrit-Owner: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Comment-Date: Fri, 09 Feb 2018 01:02:15 +0000
Gerrit-HasComments: Yes

[kudu-CR] Add additonal form and tests for GetConsensusRole()

Posted by "Mike Percy (Code Review)" <ge...@cloudera.org>.
Mike Percy has posted comments on this change. ( http://gerrit.cloudera.org:8080/9260 )

Change subject: Add additonal form and tests for GetConsensusRole()
......................................................................


Patch Set 1:

(1 comment)

> Patch Set 1:
> 
> (1 comment)
> 
> LGTM, just a small nit/question.

http://gerrit.cloudera.org:8080/#/c/9260/1/src/kudu/consensus/quorum_util-test.cc
File src/kudu/consensus/quorum_util-test.cc:

http://gerrit.cloudera.org:8080/#/c/9260/1/src/kudu/consensus/quorum_util-test.cc@287
PS1, Line 287:   ASSERT_EQ(NON_PARTICIPANT, GetConsensusRole("D", cstate)); // Illegal.
> Does it make sense to add the following cases:
Done



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

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic28f15c40ce99f89481cb6869d4843cbc024ed48
Gerrit-Change-Number: 9260
Gerrit-PatchSet: 1
Gerrit-Owner: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Comment-Date: Fri, 09 Feb 2018 03:24:35 +0000
Gerrit-HasComments: Yes

[kudu-CR] Add additonal form and tests for GetConsensusRole()

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/9260 )

Change subject: Add additonal form and tests for GetConsensusRole()
......................................................................


Patch Set 2: Code-Review+2


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

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic28f15c40ce99f89481cb6869d4843cbc024ed48
Gerrit-Change-Number: 9260
Gerrit-PatchSet: 2
Gerrit-Owner: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Comment-Date: Fri, 09 Feb 2018 03:25:14 +0000
Gerrit-HasComments: No

[kudu-CR] Add additonal form and tests for GetConsensusRole()

Posted by "Mike Percy (Code Review)" <ge...@cloudera.org>.
Hello Alexey Serbin, Kudu Jenkins, 

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

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

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

Change subject: Add additonal form and tests for GetConsensusRole()
......................................................................

Add additonal form and tests for GetConsensusRole()

There are cases where calling GetConsensusRole() without creating a
ConsensusStatePB object would be more efficient. This patch adds a
version of GetConsensusRole() with the following signature:

  RaftPeerPB::Role GetConsensusRole(const std::string& peer_uuid,
                                    const std::string& leader_uuid,
                                    const RaftConfigPB& config);

This patch also fixes a bug where the role of a non-voter that was
thought to be the leader would be returned as NON_PARTICIPANT instead of
LEARNER. However, that is an illegal state so it should not actually
affect production code.

Also added a unit test for both forms of GetConsensusRole().

Change-Id: Ic28f15c40ce99f89481cb6869d4843cbc024ed48
---
M src/kudu/consensus/quorum_util-test.cc
M src/kudu/consensus/quorum_util.cc
M src/kudu/consensus/quorum_util.h
3 files changed, 75 insertions(+), 14 deletions(-)


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

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ic28f15c40ce99f89481cb6869d4843cbc024ed48
Gerrit-Change-Number: 9260
Gerrit-PatchSet: 2
Gerrit-Owner: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>

[kudu-CR] Add additonal form and tests for GetConsensusRole()

Posted by "Mike Percy (Code Review)" <ge...@cloudera.org>.
Mike Percy has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/9260 )

Change subject: Add additonal form and tests for GetConsensusRole()
......................................................................

Add additonal form and tests for GetConsensusRole()

There are cases where calling GetConsensusRole() without creating a
ConsensusStatePB object would be more efficient. This patch adds a
version of GetConsensusRole() with the following signature:

  RaftPeerPB::Role GetConsensusRole(const std::string& peer_uuid,
                                    const std::string& leader_uuid,
                                    const RaftConfigPB& config);

This patch also fixes a bug where the role of a non-voter that was
thought to be the leader would be returned as NON_PARTICIPANT instead of
LEARNER. However, that is an illegal state so it should not actually
affect production code.

Also added a unit test for both forms of GetConsensusRole().

Change-Id: Ic28f15c40ce99f89481cb6869d4843cbc024ed48
Reviewed-on: http://gerrit.cloudera.org:8080/9260
Reviewed-by: Alexey Serbin <as...@cloudera.com>
Tested-by: Kudu Jenkins
---
M src/kudu/consensus/quorum_util-test.cc
M src/kudu/consensus/quorum_util.cc
M src/kudu/consensus/quorum_util.h
3 files changed, 75 insertions(+), 14 deletions(-)

Approvals:
  Alexey Serbin: Looks good to me, approved
  Kudu Jenkins: Verified

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

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic28f15c40ce99f89481cb6869d4843cbc024ed48
Gerrit-Change-Number: 9260
Gerrit-PatchSet: 3
Gerrit-Owner: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>