You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Alexey Serbin (Code Review)" <ge...@cloudera.org> on 2021/03/26 07:27:40 UTC

[kudu-CR] [consensus] small cleanup on consensus::Peer

Alexey Serbin has uploaded this change for review. ( http://gerrit.cloudera.org:8080/17236


Change subject: [consensus] small cleanup on consensus::Peer
......................................................................

[consensus] small cleanup on consensus::Peer

Peer::LogPrefixUnlocked() was constructing a new string every time it's
called, but all the information in the prefix is immutable for a Peer
instance.  Also, it's possible to set "tablet_id", "caller_uuid", and
"dest_uuid" fields of the Peer::request_ PB structure only once.

Change-Id: Iefce6791d12fbd126ee30104d1005209ad3de3ff
---
M src/kudu/consensus/consensus_peers.cc
M src/kudu/consensus/consensus_peers.h
2 files changed, 19 insertions(+), 14 deletions(-)



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

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iefce6791d12fbd126ee30104d1005209ad3de3ff
Gerrit-Change-Number: 17236
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>

[kudu-CR] [consensus] small cleanup on consensus::Peer

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

Change subject: [consensus] small cleanup on consensus::Peer
......................................................................


Patch Set 1: Code-Review+1


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

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iefce6791d12fbd126ee30104d1005209ad3de3ff
Gerrit-Change-Number: 17236
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Bankim Bhavsar <ba...@cloudera.com>
Gerrit-Reviewer: Grant Henke <gr...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Comment-Date: Fri, 26 Mar 2021 12:42:12 +0000
Gerrit-HasComments: No

[kudu-CR] [consensus] small cleanup on consensus::Peer

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

Change subject: [consensus] small cleanup on consensus::Peer
......................................................................

[consensus] small cleanup on consensus::Peer

Peer::LogPrefixUnlocked() was constructing a new string every time it's
called, but all the information in the prefix is immutable for a Peer
instance.  Also, it's possible to set "tablet_id", "caller_uuid", and
"dest_uuid" fields of the Peer::request_ PB structure only once.

Change-Id: Iefce6791d12fbd126ee30104d1005209ad3de3ff
Reviewed-on: http://gerrit.cloudera.org:8080/17236
Tested-by: Kudu Jenkins
Reviewed-by: Bankim Bhavsar <ba...@cloudera.com>
Reviewed-by: Andrew Wong <aw...@cloudera.com>
---
M src/kudu/consensus/consensus_peers.cc
M src/kudu/consensus/consensus_peers.h
2 files changed, 19 insertions(+), 14 deletions(-)

Approvals:
  Kudu Jenkins: Verified
  Bankim Bhavsar: Looks good to me, but someone else must approve
  Andrew Wong: Looks good to me, approved

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

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iefce6791d12fbd126ee30104d1005209ad3de3ff
Gerrit-Change-Number: 17236
Gerrit-PatchSet: 2
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Andrew Wong <aw...@cloudera.com>
Gerrit-Reviewer: Bankim Bhavsar <ba...@cloudera.com>
Gerrit-Reviewer: Grant Henke <gr...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)

[kudu-CR] [consensus] small cleanup on consensus::Peer

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

Change subject: [consensus] small cleanup on consensus::Peer
......................................................................


Patch Set 1: Code-Review+2

(1 comment)

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

http://gerrit.cloudera.org:8080/#/c/17236/1/src/kudu/consensus/consensus_peers.cc@276
PS1, Line 276:   if (!has_sent_first_request_) {
             :     // Set the 'immutable' fields in the request only once upon first request.
             :     request_.set_tablet_id(tablet_id_);
             :     request_.set_caller_uuid(leader_uuid_);
             :     request_.set_dest_uuid(peer_pb_.permanent_uuid());
             :     has_sent_first_request_ = true;
             :   }
Just for my own understanding, it doesn't really matter when this gets set as long as it's set before sending (or logging, per below) 'request_', right? And in that regard, we're just deferring the setting of it as far as we can?



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

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iefce6791d12fbd126ee30104d1005209ad3de3ff
Gerrit-Change-Number: 17236
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Andrew Wong <aw...@cloudera.com>
Gerrit-Reviewer: Bankim Bhavsar <ba...@cloudera.com>
Gerrit-Reviewer: Grant Henke <gr...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Comment-Date: Mon, 29 Mar 2021 23:33:14 +0000
Gerrit-HasComments: Yes

[kudu-CR] [consensus] small cleanup on consensus::Peer

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

Change subject: [consensus] small cleanup on consensus::Peer
......................................................................


Patch Set 1:

(1 comment)

Thank you for review!

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

http://gerrit.cloudera.org:8080/#/c/17236/1/src/kudu/consensus/consensus_peers.cc@276
PS1, Line 276:   if (!has_sent_first_request_) {
             :     // Set the 'immutable' fields in the request only once upon first request.
             :     request_.set_tablet_id(tablet_id_);
             :     request_.set_caller_uuid(leader_uuid_);
             :     request_.set_dest_uuid(peer_pb_.permanent_uuid());
             :     has_sent_first_request_ = true;
             :   }
> Just for my own understanding, it doesn't really matter when this gets set 
Exactly -- it doesn't matter when exactly to set these fields as long this is done before the request is being sent, or logged, or otherwise used.

Also, since 'tablet_id_', 'leader_uuid_', 'peer_pb_.permanent_uuid()' are de-facto immutable fields in the whole lifespan of a Peer object, it's possible to set them just once instead of re-setting them over and over again.



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

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iefce6791d12fbd126ee30104d1005209ad3de3ff
Gerrit-Change-Number: 17236
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <as...@cloudera.com>
Gerrit-Reviewer: Andrew Wong <aw...@cloudera.com>
Gerrit-Reviewer: Bankim Bhavsar <ba...@cloudera.com>
Gerrit-Reviewer: Grant Henke <gr...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Comment-Date: Mon, 29 Mar 2021 23:48:14 +0000
Gerrit-HasComments: Yes