You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "Michael Ho (Code Review)" <ge...@cloudera.org> on 2017/08/30 19:35:49 UTC

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

Michael Ho has uploaded a new change for review.

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................

IMPALA-4670: Introduces RpcMgr class

This patch introduces a new class, RpcMgr which is the abstraction
layer around Kudu RPC core mechanics. It provides an interface
RegisterService() for various services to register themselves.

Kudu RPC is invoked via an auto-generated interface called proxy.
This change implements an inline wrapper for KRPC client to obtain
a proxy for a particular service exported by remote server.

Last but not least, the RpcMgr will start all registered services
if FLAGS_use_krpc is true.

Testing done: a new backend test is added to exercise the code
and demonstrate the way to interact with KRPC framework.

Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
---
M .gitignore
M CMakeLists.txt
M be/src/exec/kudu-util.h
M be/src/rpc/CMakeLists.txt
A be/src/rpc/rpc-mgr-test.cc
A be/src/rpc/rpc-mgr.cc
A be/src/rpc/rpc-mgr.h
A be/src/rpc/rpc-mgr.inline.h
M be/src/runtime/exec-env.cc
M be/src/runtime/exec-env.h
M be/src/scheduling/scheduler-test-util.cc
M be/src/scheduling/scheduler.cc
M be/src/scheduling/scheduler.h
M be/src/util/counting-barrier.h
M be/src/util/network-util.cc
M be/src/util/network-util.h
A common/protobuf/CMakeLists.txt
A common/protobuf/rpc_test.proto
18 files changed, 746 insertions(+), 33 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/01/7901/1
-- 
To view, visit http://gerrit.cloudera.org:8080/7901
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Michael Ho <kw...@cloudera.com>

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 1:

(11 comments)

http://gerrit.cloudera.org:8080/#/c/7901/1//COMMIT_MSG
Commit Message:

Line 16: 
> Could you also mention that there are no services that use KRPC, added in t
Done


http://gerrit.cloudera.org:8080/#/c/7901/2/be/src/rpc/rpc-mgr.cc
File be/src/rpc/rpc-mgr.cc:

PS2, Line 56: CpuInfo::num_cores()
> Is it safe to trust CpuInfo across all platforms, dockers and VMs?
I suppose so or it's a bug in CpuInfo.


PS2, Line 65: Must call RegisterService() before StartServices()
> I think this would be clearer as:
Done


PS2, Line 85: DCHECK(IsResolvedAddress(address));
> This is redundant. The DCHECK is already inside TNetworkAddressToSockaddr()
This is mostly for documentation purpose.


PS2, Line 111: status.IsRemoteError()
> Is this necessary? Isn't it implied by:
Not sure if it's fair to always make the assumption that kudu::rpc::ErrorStatusPB::ERROR_SERVER_TOO_BUSY implies it must come from a remote error.

The KRPC code and test check for both so may make sense to be consistent with them.


http://gerrit.cloudera.org:8080/#/c/7901/2/be/src/rpc/rpc-mgr.h
File be/src/rpc/rpc-mgr.h:

PS2, Line 129: The RPC layer continues to run.
> I think this needs a little more explanation, else it's confusing as to wha
Done


http://gerrit.cloudera.org:8080/#/c/7901/2/be/src/rpc/rpc-mgr.inline.h
File be/src/rpc/rpc-mgr.inline.h:

PS2, Line 36: DCHECK(IsResolvedAddress(address));
> This is redundant. The DCHECK is already inside TNetworkAddressToSockaddr()
It's useful for documentation purpose.


http://gerrit.cloudera.org:8080/#/c/7901/2/be/src/runtime/exec-env.h
File be/src/runtime/exec-env.h:

PS2, Line 194: Impala backend server
> thrift based Impala backend server
Done


PS2, Line 197: KRPC-based service 
> KRPC-based server?
Done


http://gerrit.cloudera.org:8080/#/c/7901/2/be/src/util/network-util.cc
File be/src/util/network-util.cc:

PS2, Line 120: kudu::Sockaddr
> just "Sockaddr"
Done


http://gerrit.cloudera.org:8080/#/c/7901/2/be/src/util/network-util.h
File be/src/util/network-util.h:

Line 23: namespace kudu { class Sockaddr; }
> namespace kudu {
Done


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 6:

(5 comments)

http://gerrit.cloudera.org:8080/#/c/7901/8/be/src/rpc/rpc-mgr.h
File be/src/rpc/rpc-mgr.h:

http://gerrit.cloudera.org:8080/#/c/7901/8/be/src/rpc/rpc-mgr.h@90
PS8, Line 90: t th
> this is kind of a detail but "some" implies that requests can bypass the qu
changed to "new requests"


http://gerrit.cloudera.org:8080/#/c/7901/8/be/src/rpc/rpc-mgr.h@90
PS8, Line 90: l fail
> threads
Done


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr.h
File be/src/rpc/rpc-mgr.h:

http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr.h@76
PS6, Line 76: ///
> Okay. The case I'm worried about with Shutdown() is if this happens while R
The shutdown of the ServicePool will wait for the exit of all service threads so all incoming RPCs being processed would have been replied to before shutdown. All pending incoming RPCs in the service queue will also be replied to too.

When shutting down the messenger, all thread pools (acceptor threads, negotiation threads and reactor threads) encapsulated by it will be shut down too.


http://gerrit.cloudera.org:8080/#/c/7901/8/be/src/scheduling/scheduler.cc
File be/src/scheduling/scheduler.cc:

http://gerrit.cloudera.org:8080/#/c/7901/8/be/src/scheduling/scheduler.cc@72
PS8, Line 72: r_.
> delete
Done


http://gerrit.cloudera.org:8080/#/c/7901/8/be/src/service/impala-server.cc
File be/src/service/impala-server.cc:

http://gerrit.cloudera.org:8080/#/c/7901/8/be/src/service/impala-server.cc@1662
PS8, Line 1662:   item.key = local_backend_id;
> okay. or maybe the exec env should just have the resolved IP in it from Exe
I was wondering if the old code intentionally did an IP address resolution above to capture any change from hostname to IP address ? I suppose it's a fair assumption that any IP address change will involve restarting the cluster so it should be fine to cache the IP.



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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-Change-Number: 7901
Gerrit-PatchSet: 6
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Comment-Date: Thu, 05 Oct 2017 17:43:25 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 10: Code-Review+2

Carry +2.

PS 10 fixed up a CMake target name issue which tricked ninja into thinking there is a circular dependency when there is none. Also clarified a comment in rpc-mgr.h to address Dan's point.


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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-Change-Number: 7901
Gerrit-PatchSet: 10
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Comment-Date: Fri, 06 Oct 2017 02:54:47 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 9:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/7901/8/be/src/rpc/rpc-mgr.h
File be/src/rpc/rpc-mgr.h:

http://gerrit.cloudera.org:8080/#/c/7901/8/be/src/rpc/rpc-mgr.h@90
PS8, Line 90:  new
> changed to "new requests"
What I mean is that requests always go through the queue regardless of the rate.



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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-Change-Number: 7901
Gerrit-PatchSet: 9
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Comment-Date: Thu, 05 Oct 2017 20:47:26 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/7901 )

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 9: Verified-1

Build failed: https://jenkins.impala.io/job/gerrit-verify-dryrun/1308/


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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-Change-Number: 7901
Gerrit-PatchSet: 9
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Comment-Date: Thu, 05 Oct 2017 22:32:17 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 6:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr-test.cc
File be/src/rpc/rpc-mgr-test.cc:

PS6, Line 184: rpc_mgr_.Shutdown();
We don't need to call Shutdown here and in the other tests right? Since it gets called in TearDown() anyway.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-PatchSet: 6
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 1:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/7901/1/.gitignore
File .gitignore:

PS1, Line 18: *.pb.h
            : *.pb.cc
            : *.proxy.h
            : *.proxy.cc
            : *.service.h
            : *.service.cc
Should probably move these to be/.gitignore.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 1:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/7901/1/.gitignore
File .gitignore:

PS1, Line 18: *.pb.h
            : *.pb.cc
            : *.proxy.h
            : *.proxy.cc
            : *.service.h
            : *.service.cc
> Should probably move these to be/.gitignore.
Done


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 8: Code-Review+2

(7 comments)

http://gerrit.cloudera.org:8080/#/c/7901/8/be/src/rpc/rpc-mgr.h
File be/src/rpc/rpc-mgr.h:

http://gerrit.cloudera.org:8080/#/c/7901/8/be/src/rpc/rpc-mgr.h@90
PS8, Line 90: thrads
threads


http://gerrit.cloudera.org:8080/#/c/7901/8/be/src/rpc/rpc-mgr.h@90
PS8, Line 90: some
this is kind of a detail but "some" implies that requests can bypass the queue when there is an available service thread. is that actually the case?


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr.h
File be/src/rpc/rpc-mgr.h:

http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr.h@76
PS6, Line 76: /// terminated. RpcMgr::Init() and RpcMgr::Shutdown() are not thread safe.
> There is none actually. The assumption is that Init() is called from the si
Okay. The case I'm worried about with Shutdown() is if this happens while RPCs are in flight, what happens. It'd be nice to move Impala toward having clean exit behavior, rather than adding more things that could crash when e.g. the impalad process gets a term signal.


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr.h@133
PS6, Line 133: 
> Normally, we shouldn't shutdown as there is really no clean way to shut dow
See my comment above about clean process shutdown. Not sure there's anything to tackle now but let's think it through.


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr.h@156
PS6, Line 156: 
> This is similar to a shared_ptr in a way. KRPC messenger internally uses a 
Not suggesting we change it, just want to check that the scoped_refptr is dictated by the krpc layer API.


http://gerrit.cloudera.org:8080/#/c/7901/8/be/src/scheduling/scheduler.cc
File be/src/scheduling/scheduler.cc:

http://gerrit.cloudera.org:8080/#/c/7901/8/be/src/scheduling/scheduler.cc@72
PS8, Line 72:  is
delete


http://gerrit.cloudera.org:8080/#/c/7901/8/be/src/service/impala-server.cc
File be/src/service/impala-server.cc:

http://gerrit.cloudera.org:8080/#/c/7901/8/be/src/service/impala-server.cc@1662
PS8, Line 1662:     }
okay. or maybe the exec env should just have the resolved IP in it from ExecEnv::StartServices()?



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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-Change-Number: 7901
Gerrit-PatchSet: 8
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Comment-Date: Mon, 02 Oct 2017 21:42:03 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/7901 )

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 10:

Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/1313/


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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-Change-Number: 7901
Gerrit-PatchSet: 10
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Comment-Date: Fri, 06 Oct 2017 03:04:06 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

Posted by "Michael Ho (Code Review)" <ge...@cloudera.org>.
Hello Sailesh Mukil, Dan Hecht, Impala Public Jenkins, 

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

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

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................

IMPALA-4670: Introduces RpcMgr class

This patch introduces a new class, RpcMgr which is the abstraction
layer around KRPC core mechanics. It provides an interface
RegisterService() for various services to register themselves.

Kudu RPC is invoked via an auto-generated interface called proxy.
This change implements an inline wrapper for KRPC client to obtain
a proxy for a particular service exported by remote server.

Last but not least, the RpcMgr will start all registered services
if FLAGS_use_krpc is true. This patch hasn't yet added any service
except for some test services in rpc-mgr-test.

This patch is based on an abandoned patch by Henry Robinson.

Testing done: a new backend test is added to exercise the code
and demonstrate the way to interact with KRPC framework.

Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
---
M CMakeLists.txt
M be/src/exec/kudu-util.h
M be/src/rpc/CMakeLists.txt
A be/src/rpc/rpc-mgr-test.cc
A be/src/rpc/rpc-mgr.cc
A be/src/rpc/rpc-mgr.h
A be/src/rpc/rpc-mgr.inline.h
M be/src/runtime/exec-env.cc
M be/src/runtime/exec-env.h
M be/src/scheduling/scheduler-test-util.cc
M be/src/scheduling/scheduler.cc
M be/src/scheduling/scheduler.h
M be/src/service/impala-server.cc
M be/src/util/counting-barrier.h
M be/src/util/network-util.cc
M be/src/util/network-util.h
M cmake_modules/FindKRPC.cmake
A common/protobuf/CMakeLists.txt
A common/protobuf/rpc_test.proto
19 files changed, 780 insertions(+), 51 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/01/7901/10
-- 
To view, visit http://gerrit.cloudera.org:8080/7901
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-Change-Number: 7901
Gerrit-PatchSet: 10
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 3:

(15 comments)

http://gerrit.cloudera.org:8080/#/c/7901/3/be/src/rpc/rpc-mgr-test.cc
File be/src/rpc/rpc-mgr-test.cc:

PS3, Line 62: int32_t payload_[PAYLOAD_SIZE];
'payload_' can be a private variable.


PS3, Line 60:   TNetworkAddress krpc_address_;
            :   RpcMgr rpc_mgr_;
            :   int32_t payload_[PAYLOAD_SIZE];
Member variable declarations should go below the functions definitions?


PS3, Line 75: SetupScanMemRequest
Could you add a brief function header?


PS3, Line 120: int32_t
nit: I think it would be better to either use int32_t or uint32_t consistently in this function.


PS3, Line 127:  
nit: add some delimiter here


PS3, Line 141: Start a second service which verifies the RPC payload is not corrupted.
nit: Test that a second service, that verifies the RPC payload is not corrupted, can be started.


PS3, Line 188: boost::bind
I'd prefer if we did this with a named lambda instead. What do you think?


PS3, Line 237: boost::bind
Same here


http://gerrit.cloudera.org:8080/#/c/7901/3/be/src/rpc/rpc-mgr.h
File be/src/rpc/rpc-mgr.h:

Line 95: /// port is configurable via FLAGS_acceptor_threads.
I think it would be good to add an example of the function calls a application developer would need to make to send a RPC.

Eg:
<>GetProxy()
proxy->Ping()


PS3, Line 129: The RPC layer will accept incoming
             :   /// connections but no service will be available.
Is that true? UnregisterServices() calls Messenger::Shutdown(), which calls AcceptorPool::Shutdown().


PS3, Line 171: }
nit:
} // namespace impala


http://gerrit.cloudera.org:8080/#/c/7901/3/be/src/rpc/rpc-mgr.inline.h
File be/src/rpc/rpc-mgr.inline.h:

PS3, Line 43: }
nit:
} // namespace impala


http://gerrit.cloudera.org:8080/#/c/7901/3/be/src/runtime/exec-env.h
File be/src/runtime/exec-env.h:

PS3, Line 32: namespace kudu {
            :   namespace client {
            :      class KuduClient;
            :   }
            : }
nit:
Nested namespaces shouldn't be indented, here and in other places.
https://google.github.io/styleguide/cppguide.html#Namespaces


http://gerrit.cloudera.org:8080/#/c/7901/3/be/src/util/network-util.cc
File be/src/util/network-util.cc:

PS3, Line 226: }
Not your change but:

nit:
} // namespace impala


http://gerrit.cloudera.org:8080/#/c/7901/3/common/protobuf/rpc_test.proto
File common/protobuf/rpc_test.proto:

Line 43
Is it not possible to use the existing Kudu protobuf structures for testing from the .proto files?
I'm fine with this too, but I just want to see if we can do away with some duplication.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-PatchSet: 3
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

Posted by "Michael Ho (Code Review)" <ge...@cloudera.org>.
Hello Sailesh Mukil, Dan Hecht, 

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

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

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................

IMPALA-4670: Introduces RpcMgr class

This patch introduces a new class, RpcMgr which is the abstraction
layer around KRPC core mechanics. It provides an interface
RegisterService() for various services to register themselves.

Kudu RPC is invoked via an auto-generated interface called proxy.
This change implements an inline wrapper for KRPC client to obtain
a proxy for a particular service exported by remote server.

Last but not least, the RpcMgr will start all registered services
if FLAGS_use_krpc is true. This patch hasn't yet added any service
except for some test services in rpc-mgr-test.

This patch is based on an abandoned patch by Henry Robinson.

Testing done: a new backend test is added to exercise the code
and demonstrate the way to interact with KRPC framework.

Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
---
M CMakeLists.txt
M be/src/exec/kudu-util.h
M be/src/rpc/CMakeLists.txt
A be/src/rpc/rpc-mgr-test.cc
A be/src/rpc/rpc-mgr.cc
A be/src/rpc/rpc-mgr.h
A be/src/rpc/rpc-mgr.inline.h
M be/src/runtime/exec-env.cc
M be/src/runtime/exec-env.h
M be/src/scheduling/scheduler-test-util.cc
M be/src/scheduling/scheduler.cc
M be/src/scheduling/scheduler.h
M be/src/service/impala-server.cc
M be/src/util/counting-barrier.h
M be/src/util/network-util.cc
M be/src/util/network-util.h
A common/protobuf/CMakeLists.txt
A common/protobuf/rpc_test.proto
18 files changed, 777 insertions(+), 50 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/01/7901/9
-- 
To view, visit http://gerrit.cloudera.org:8080/7901
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-Change-Number: 7901
Gerrit-PatchSet: 9
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 6:

(14 comments)

http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/exec/kudu-util.h
File be/src/exec/kudu-util.h:

Line 87: /// Impala Status object.
maybe note that the returned error is always of type GENERAL, i.e. we don't try to translate error codes.


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr.cc
File be/src/rpc/rpc-mgr.cc:

Line 30: using std::move;
why is that needed?


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr.h
File be/src/rpc/rpc-mgr.h:

Line 76: ///
what is the thread safety story of this class? it looks like initializing it is not thread safe, but then Shutdown() is thread safe? i.e. Shutdown() can be called while RPCs to/from services are in flight?  let's briefly document whatever the thread-safety or lack of is.


PS6, Line 89: processed
that's talking about being processed by either acceptor or service, right? As opposed to being processed by 'reactor'.  Could be clarified.


PS6, Line 89: FIFO fixed-size queue
is that queue per service? and is there a queue for connection requests as well? or is it one big global queue?


PS6, Line 104: address
does that one have to be an IP addr or is hostname okay?


PS6, Line 115: being
begin


Line 133:   /// All acceptor and reactor threads within the messenger are also shut down.
what happens to stuff in flight, or should we not care for some reason?


PS6, Line 156: scoped_refptr
I guess using that is kinda required by krpc? What does it do? ServicePool destroys itself based on a ref count or something?


PS6, Line 169: shared_ptr
I guess using shared_ptr here is required by the MessangerBuilder::Build(). Let's note that in the comment.


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/runtime/exec-env.h
File be/src/runtime/exec-env.h:

PS6, Line 135: krpc_port
does that still need to be exposed if we have krpc_address()? And looking ahead to your other patch, it looks like this is used to construct the krpc_address, yet it comes from the krpc address, so I'm confused.


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/scheduling/scheduler.cc
File be/src/scheduling/scheduler.cc:

Line 73
maybe this comment is still useful in the new code (minus the KRPC bits) in a slightly different form:

Store our IP address, so that each ...


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/util/network-util.cc
File be/src/util/network-util.cc:

Line 120:   Sockaddr sock;
okay to ignore, but i think keeping the kudu:: namespace here makes it easier to understand why we have this and where to look. (and since it's not wide-spread, it's not so bad to type it out here).


PS6, Line 218: Sockaddr
same


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-PatchSet: 6
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

Posted by "Michael Ho (Code Review)" <ge...@cloudera.org>.
Michael Ho has uploaded a new patch set (#4).

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................

IMPALA-4670: Introduces RpcMgr class

This patch introduces a new class, RpcMgr which is the abstraction
layer around KRPC core mechanics. It provides an interface
RegisterService() for various services to register themselves.

Kudu RPC is invoked via an auto-generated interface called proxy.
This change implements an inline wrapper for KRPC client to obtain
a proxy for a particular service exported by remote server.

Last but not least, the RpcMgr will start all registered services
if FLAGS_use_krpc is true. This patch hasn't yet added any service
except for some test services in rpc-mgr-test.

This patch is based on an abandoned patch by Henry Robinson.

Testing done: a new backend test is added to exercise the code
and demonstrate the way to interact with KRPC framework.

Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
---
M CMakeLists.txt
M be/src/exec/kudu-util.h
M be/src/rpc/CMakeLists.txt
A be/src/rpc/rpc-mgr-test.cc
A be/src/rpc/rpc-mgr.cc
A be/src/rpc/rpc-mgr.h
A be/src/rpc/rpc-mgr.inline.h
M be/src/runtime/exec-env.cc
M be/src/runtime/exec-env.h
M be/src/scheduling/scheduler-test-util.cc
M be/src/scheduling/scheduler.cc
M be/src/scheduling/scheduler.h
M be/src/util/counting-barrier.h
M be/src/util/network-util.cc
M be/src/util/network-util.h
A common/protobuf/CMakeLists.txt
A common/protobuf/rpc_test.proto
17 files changed, 761 insertions(+), 39 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/01/7901/4
-- 
To view, visit http://gerrit.cloudera.org:8080/7901
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-PatchSet: 4
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 4:

Need to rebase again after https://gerrit.cloudera.org/#/c/7897/5 is merged. That patch changes the c'tor interface of kudu::rpc::Proxy

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-PatchSet: 4
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/7901 )

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 10: Verified+1


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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-Change-Number: 7901
Gerrit-PatchSet: 10
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Comment-Date: Fri, 06 Oct 2017 07:09:54 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

Posted by "Michael Ho (Code Review)" <ge...@cloudera.org>.
Hello Sailesh Mukil, Dan Hecht, 

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

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

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................

IMPALA-4670: Introduces RpcMgr class

This patch introduces a new class, RpcMgr which is the abstraction
layer around KRPC core mechanics. It provides an interface
RegisterService() for various services to register themselves.

Kudu RPC is invoked via an auto-generated interface called proxy.
This change implements an inline wrapper for KRPC client to obtain
a proxy for a particular service exported by remote server.

Last but not least, the RpcMgr will start all registered services
if FLAGS_use_krpc is true. This patch hasn't yet added any service
except for some test services in rpc-mgr-test.

This patch is based on an abandoned patch by Henry Robinson.

Testing done: a new backend test is added to exercise the code
and demonstrate the way to interact with KRPC framework.

Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
---
M CMakeLists.txt
M be/src/exec/kudu-util.h
M be/src/rpc/CMakeLists.txt
A be/src/rpc/rpc-mgr-test.cc
A be/src/rpc/rpc-mgr.cc
A be/src/rpc/rpc-mgr.h
A be/src/rpc/rpc-mgr.inline.h
M be/src/runtime/exec-env.cc
M be/src/runtime/exec-env.h
M be/src/scheduling/scheduler-test-util.cc
M be/src/scheduling/scheduler.cc
M be/src/scheduling/scheduler.h
M be/src/service/impala-server.cc
M be/src/util/counting-barrier.h
M be/src/util/network-util.cc
M be/src/util/network-util.h
A common/protobuf/CMakeLists.txt
A common/protobuf/rpc_test.proto
18 files changed, 774 insertions(+), 39 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/01/7901/8
-- 
To view, visit http://gerrit.cloudera.org:8080/7901
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-Change-Number: 7901
Gerrit-PatchSet: 8
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

Posted by "Michael Ho (Code Review)" <ge...@cloudera.org>.
Michael Ho has uploaded a new patch set (#4).

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................

IMPALA-4670: Introduces RpcMgr class

This patch introduces a new class, RpcMgr which is the abstraction
layer around KRPC core mechanics. It provides an interface
RegisterService() for various services to register themselves.

Kudu RPC is invoked via an auto-generated interface called proxy.
This change implements an inline wrapper for KRPC client to obtain
a proxy for a particular service exported by remote server.

Last but not least, the RpcMgr will start all registered services
if FLAGS_use_krpc is true. This patch hasn't yet added any service
except for some test services in rpc-mgr-test.

This patch is based on an abandoned patch by Henry Robinson.

Testing done: a new backend test is added to exercise the code
and demonstrate the way to interact with KRPC framework.

Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
---
M CMakeLists.txt
M be/src/exec/kudu-util.h
M be/src/rpc/CMakeLists.txt
A be/src/rpc/rpc-mgr-test.cc
A be/src/rpc/rpc-mgr.cc
A be/src/rpc/rpc-mgr.h
A be/src/rpc/rpc-mgr.inline.h
M be/src/runtime/exec-env.cc
M be/src/runtime/exec-env.h
M be/src/scheduling/scheduler-test-util.cc
M be/src/scheduling/scheduler.cc
M be/src/scheduling/scheduler.h
M be/src/util/counting-barrier.h
M be/src/util/network-util.cc
M be/src/util/network-util.h
A common/protobuf/CMakeLists.txt
A common/protobuf/rpc_test.proto
17 files changed, 765 insertions(+), 39 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/01/7901/4
-- 
To view, visit http://gerrit.cloudera.org:8080/7901
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-PatchSet: 4
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 3:

(15 comments)

http://gerrit.cloudera.org:8080/#/c/7901/3/be/src/rpc/rpc-mgr-test.cc
File be/src/rpc/rpc-mgr-test.cc:

PS3, Line 62: int32_t payload_[PAYLOAD_SIZE];
> 'payload_' can be a private variable.
Done


PS3, Line 60:   TNetworkAddress krpc_address_;
            :   RpcMgr rpc_mgr_;
            :   int32_t payload_[PAYLOAD_SIZE];
> Member variable declarations should go below the functions definitions?
Judging from various headers, we aren't quite consistent about it. I have seen examples of both.


PS3, Line 75: SetupScanMemRequest
> Could you add a brief function header?
Done


PS3, Line 120: int32_t
> nit: I think it would be better to either use int32_t or uint32_t consisten
Done


PS3, Line 127:  
> nit: add some delimiter here
Done


PS3, Line 141: Start a second service which verifies the RPC payload is not corrupted.
> nit: Test that a second service, that verifies the RPC payload is not corru
Done


PS3, Line 188: boost::bind
> I'd prefer if we did this with a named lambda instead. What do you think?
Done. I think lambda is fine for small callback in test like this but I find it rather hard to read for bigger callback used in DSS.


PS3, Line 237: boost::bind
> Same here
Done


http://gerrit.cloudera.org:8080/#/c/7901/3/be/src/rpc/rpc-mgr.h
File be/src/rpc/rpc-mgr.h:

Line 95: /// port is configurable via FLAGS_acceptor_threads.
> I think it would be good to add an example of the function calls a applicat
Added pointer to rpc-mgr-test.cc for examples.


PS3, Line 129: The RPC layer will accept incoming
             :   /// connections but no service will be available.
> Is that true? UnregisterServices() calls Messenger::Shutdown(), which calls
Renamed function to Shutdown() and call it in ExecEnv d'tor.


PS3, Line 171: }
> nit:
We don't seem to consistently enforce this rule in many files. May be one should write a script to fix all of these places up.


http://gerrit.cloudera.org:8080/#/c/7901/3/be/src/rpc/rpc-mgr.inline.h
File be/src/rpc/rpc-mgr.inline.h:

PS3, Line 43: }
> nit:
Done


http://gerrit.cloudera.org:8080/#/c/7901/3/be/src/runtime/exec-env.h
File be/src/runtime/exec-env.h:

PS3, Line 32: namespace kudu {
            :   namespace client {
            :      class KuduClient;
            :   }
            : }
> nit:
Done


http://gerrit.cloudera.org:8080/#/c/7901/3/be/src/util/network-util.cc
File be/src/util/network-util.cc:

PS3, Line 226: }
> Not your change but:
Done


http://gerrit.cloudera.org:8080/#/c/7901/3/common/protobuf/rpc_test.proto
File common/protobuf/rpc_test.proto:

Line 43
> Is it not possible to use the existing Kudu protobuf structures for testing
Seems to be more flexible to keep it in a test specific file in case we want to experiment with certain cases.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-PatchSet: 3
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

Posted by "Michael Ho (Code Review)" <ge...@cloudera.org>.
Michael Ho has uploaded a new patch set (#2).

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................

IMPALA-4670: Introduces RpcMgr class

This patch introduces a new class, RpcMgr which is the abstraction
layer around Kudu RPC core mechanics. It provides an interface
RegisterService() for various services to register themselves.

Kudu RPC is invoked via an auto-generated interface called proxy.
This change implements an inline wrapper for KRPC client to obtain
a proxy for a particular service exported by remote server.

Last but not least, the RpcMgr will start all registered services
if FLAGS_use_krpc is true.

This patch is based on an abandoned patch by Henry Robinson.

Testing done: a new backend test is added to exercise the code
and demonstrate the way to interact with KRPC framework.

Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
---
M CMakeLists.txt
M be/.gitignore
M be/src/exec/kudu-util.h
M be/src/rpc/CMakeLists.txt
A be/src/rpc/rpc-mgr-test.cc
A be/src/rpc/rpc-mgr.cc
A be/src/rpc/rpc-mgr.h
A be/src/rpc/rpc-mgr.inline.h
M be/src/runtime/exec-env.cc
M be/src/runtime/exec-env.h
M be/src/scheduling/scheduler-test-util.cc
M be/src/scheduling/scheduler.cc
M be/src/scheduling/scheduler.h
M be/src/util/counting-barrier.h
M be/src/util/network-util.cc
M be/src/util/network-util.h
A common/protobuf/CMakeLists.txt
A common/protobuf/rpc_test.proto
18 files changed, 740 insertions(+), 34 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/01/7901/2
-- 
To view, visit http://gerrit.cloudera.org:8080/7901
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-PatchSet: 2
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 6: Code-Review+1

(1 comment)

http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr-test.cc
File be/src/rpc/rpc-mgr-test.cc:

PS6, Line 65: FLAGS_hostname
Do we want this to be the loopback address since this is only a test?

The thrift-server-test listens on the loopback address instead of the externally visible hostname, but I'm fine either way.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-PatchSet: 6
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 6:

(16 comments)

http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/exec/kudu-util.h
File be/src/exec/kudu-util.h:

http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/exec/kudu-util.h@87
PS6, Line 87: /// Impala Status object.
> maybe note that the returned error is always of type GENERAL, i.e. we don't
Done


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr-test.cc
File be/src/rpc/rpc-mgr-test.cc:

http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr-test.cc@65
PS6, Line 65: FLAGS_hostname
> Do we want this to be the loopback address since this is only a test?
It sees fine as this is closer to what we actually do in ExecEnv::StartServices().


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr-test.cc@184
PS6, Line 184: rpc_mgr_.Shutdown();
> We don't need to call Shutdown here and in the other tests right? Since it 
Done


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr.h
File be/src/rpc/rpc-mgr.h:

http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr.h@76
PS6, Line 76: ///
> what is the thread safety story of this class? it looks like initializing i
There is none actually. The assumption is that Init() is called from the singleton ExecEnv when it's initialized and Shutdown() is called  when the singleton ExecEnv is destroyed.

Comments updated.


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr.h@89
PS6, Line 89: FIFO fixed-size queue
> is that queue per service? and is there a queue for connection requests as 
There is one queue per service. Comment updated.


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr.h@89
PS6, Line 89: processed
> that's talking about being processed by either acceptor or service, right? 
Done


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr.h@104
PS6, Line 104: address
> does that one have to be an IP addr or is hostname okay?
Comments clarified.


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr.h@115
PS6, Line 115: being
> begin
Done


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr.h@133
PS6, Line 133:   /// All acceptor and reactor threads within the messenger are also shut down.
> what happens to stuff in flight, or should we not care for some reason?
Normally, we shouldn't shutdown as there is really no clean way to shut down Impala now. ServicePool internally will return errors to clients of all unprocessed requests.


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr.h@156
PS6, Line 156: scoped_refptr
> I guess using that is kinda required by krpc? What does it do? ServicePool 
This is similar to a shared_ptr in a way. KRPC messenger internally uses a map of service-name to scoped_refptr<ServicePool>> to track all service pools.

It seems safer and more consistent to use a scoped_refptr here to avoid accidentally accessing freed memory. In theory, we can make sure the service_pools_ is cleared before we call messenger_.UnregisterAllServices() but it still seems a bit dicey.


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr.h@169
PS6, Line 169: shared_ptr
> I guess using shared_ptr here is required by the MessangerBuilder::Build().
Yes, required by MessengerBuilder::Build().


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr.cc
File be/src/rpc/rpc-mgr.cc:

http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/rpc/rpc-mgr.cc@30
PS6, Line 30: using std::move;
> why is that needed?
Done


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/runtime/exec-env.h
File be/src/runtime/exec-env.h:

http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/runtime/exec-env.h@135
PS6, Line 135: krpc_port
> does that still need to be exposed if we have krpc_address()? And looking a
Removed. Please take a look at the changed logic in impala-server.cc


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/scheduling/scheduler.cc
File be/src/scheduling/scheduler.cc:

http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/scheduling/scheduler.cc@a73
PS6, Line 73: 
> maybe this comment is still useful in the new code (minus the KRPC bits) in
Done


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/util/network-util.cc
File be/src/util/network-util.cc:

http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/util/network-util.cc@120
PS6, Line 120:   Sockaddr sock;
> okay to ignore, but i think keeping the kudu:: namespace here makes it easi
Done


http://gerrit.cloudera.org:8080/#/c/7901/6/be/src/util/network-util.cc@218
PS6, Line 218: Sockaddr
> same
Done



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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-Change-Number: 7901
Gerrit-PatchSet: 6
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Comment-Date: Fri, 29 Sep 2017 07:02:01 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/7901 )

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................

IMPALA-4670: Introduces RpcMgr class

This patch introduces a new class, RpcMgr which is the abstraction
layer around KRPC core mechanics. It provides an interface
RegisterService() for various services to register themselves.

Kudu RPC is invoked via an auto-generated interface called proxy.
This change implements an inline wrapper for KRPC client to obtain
a proxy for a particular service exported by remote server.

Last but not least, the RpcMgr will start all registered services
if FLAGS_use_krpc is true. This patch hasn't yet added any service
except for some test services in rpc-mgr-test.

This patch is based on an abandoned patch by Henry Robinson.

Testing done: a new backend test is added to exercise the code
and demonstrate the way to interact with KRPC framework.

Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Reviewed-on: http://gerrit.cloudera.org:8080/7901
Reviewed-by: Michael Ho <kw...@cloudera.com>
Tested-by: Impala Public Jenkins
---
M CMakeLists.txt
M be/src/exec/kudu-util.h
M be/src/rpc/CMakeLists.txt
A be/src/rpc/rpc-mgr-test.cc
A be/src/rpc/rpc-mgr.cc
A be/src/rpc/rpc-mgr.h
A be/src/rpc/rpc-mgr.inline.h
M be/src/runtime/exec-env.cc
M be/src/runtime/exec-env.h
M be/src/scheduling/scheduler-test-util.cc
M be/src/scheduling/scheduler.cc
M be/src/scheduling/scheduler.h
M be/src/service/impala-server.cc
M be/src/util/counting-barrier.h
M be/src/util/network-util.cc
M be/src/util/network-util.h
M cmake_modules/FindKRPC.cmake
A common/protobuf/CMakeLists.txt
A common/protobuf/rpc_test.proto
19 files changed, 780 insertions(+), 51 deletions(-)

Approvals:
  Michael Ho: Looks good to me, approved
  Impala Public Jenkins: Verified

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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-Change-Number: 7901
Gerrit-PatchSet: 11
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 1:

(11 comments)

http://gerrit.cloudera.org:8080/#/c/7901/1//COMMIT_MSG
Commit Message:

Line 16: 
Could you also mention that there are no services that use KRPC, added in this patch, and that they'll come in future patches?


http://gerrit.cloudera.org:8080/#/c/7901/2/be/src/rpc/rpc-mgr.cc
File be/src/rpc/rpc-mgr.cc:

PS2, Line 56: CpuInfo::num_cores()
Is it safe to trust CpuInfo across all platforms, dockers and VMs?


PS2, Line 65: Must call RegisterService() before StartServices()
I think this would be clearer as:
"Cannot call RegisterService() after calling StartServices()"


PS2, Line 85: DCHECK(IsResolvedAddress(address));
This is redundant. The DCHECK is already inside TNetworkAddressToSockaddr()


PS2, Line 111: status.IsRemoteError()
Is this necessary? Isn't it implied by:
"err->code() == kudu::rpc::ErrorStatusPB::ERROR_SERVER_TOO_BUSY"

?


http://gerrit.cloudera.org:8080/#/c/7901/2/be/src/rpc/rpc-mgr.h
File be/src/rpc/rpc-mgr.h:

PS2, Line 129: The RPC layer continues to run.
I think this needs a little more explanation, else it's confusing as to what is still running.


http://gerrit.cloudera.org:8080/#/c/7901/2/be/src/rpc/rpc-mgr.inline.h
File be/src/rpc/rpc-mgr.inline.h:

PS2, Line 36: DCHECK(IsResolvedAddress(address));
This is redundant. The DCHECK is already inside TNetworkAddressToSockaddr()


http://gerrit.cloudera.org:8080/#/c/7901/2/be/src/runtime/exec-env.h
File be/src/runtime/exec-env.h:

PS2, Line 194: Impala backend server
thrift based Impala backend server


PS2, Line 197: KRPC-based service 
KRPC-based server?


http://gerrit.cloudera.org:8080/#/c/7901/2/be/src/util/network-util.cc
File be/src/util/network-util.cc:

PS2, Line 120: kudu::Sockaddr
just "Sockaddr"


http://gerrit.cloudera.org:8080/#/c/7901/2/be/src/util/network-util.h
File be/src/util/network-util.h:

Line 23: namespace kudu { class Sockaddr; }
namespace kudu {
class Sockaddr;
}


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

Posted by "Michael Ho (Code Review)" <ge...@cloudera.org>.
Michael Ho has uploaded a new patch set (#3).

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................

IMPALA-4670: Introduces RpcMgr class

This patch introduces a new class, RpcMgr which is the abstraction
layer around KRPC core mechanics. It provides an interface
RegisterService() for various services to register themselves.

Kudu RPC is invoked via an auto-generated interface called proxy.
This change implements an inline wrapper for KRPC client to obtain
a proxy for a particular service exported by remote server.

Last but not least, the RpcMgr will start all registered services
if FLAGS_use_krpc is true. This patch hasn't yet added any service
except for some test services in rpc-mgr-test.

This patch is based on an abandoned patch by Henry Robinson.

Testing done: a new backend test is added to exercise the code
and demonstrate the way to interact with KRPC framework.

Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
---
M CMakeLists.txt
M be/src/exec/kudu-util.h
M be/src/rpc/CMakeLists.txt
A be/src/rpc/rpc-mgr-test.cc
A be/src/rpc/rpc-mgr.cc
A be/src/rpc/rpc-mgr.h
A be/src/rpc/rpc-mgr.inline.h
M be/src/runtime/exec-env.cc
M be/src/runtime/exec-env.h
M be/src/scheduling/scheduler-test-util.cc
M be/src/scheduling/scheduler.cc
M be/src/scheduling/scheduler.h
M be/src/util/counting-barrier.h
M be/src/util/network-util.cc
M be/src/util/network-util.h
A common/protobuf/CMakeLists.txt
A common/protobuf/rpc_test.proto
17 files changed, 746 insertions(+), 37 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/01/7901/3
-- 
To view, visit http://gerrit.cloudera.org:8080/7901
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-PatchSet: 3
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/7901 )

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 9:

Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/1308/


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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-Change-Number: 7901
Gerrit-PatchSet: 9
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Comment-Date: Thu, 05 Oct 2017 18:26:51 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

Posted by "Michael Ho (Code Review)" <ge...@cloudera.org>.
Michael Ho has uploaded a new patch set (#5).

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................

IMPALA-4670: Introduces RpcMgr class

This patch introduces a new class, RpcMgr which is the abstraction
layer around KRPC core mechanics. It provides an interface
RegisterService() for various services to register themselves.

Kudu RPC is invoked via an auto-generated interface called proxy.
This change implements an inline wrapper for KRPC client to obtain
a proxy for a particular service exported by remote server.

Last but not least, the RpcMgr will start all registered services
if FLAGS_use_krpc is true. This patch hasn't yet added any service
except for some test services in rpc-mgr-test.

This patch is based on an abandoned patch by Henry Robinson.

Testing done: a new backend test is added to exercise the code
and demonstrate the way to interact with KRPC framework.

Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
---
M CMakeLists.txt
M be/src/exec/kudu-util.h
M be/src/rpc/CMakeLists.txt
A be/src/rpc/rpc-mgr-test.cc
A be/src/rpc/rpc-mgr.cc
A be/src/rpc/rpc-mgr.h
A be/src/rpc/rpc-mgr.inline.h
M be/src/runtime/exec-env.cc
M be/src/runtime/exec-env.h
M be/src/scheduling/scheduler-test-util.cc
M be/src/scheduling/scheduler.cc
M be/src/scheduling/scheduler.h
M be/src/util/counting-barrier.h
M be/src/util/network-util.cc
M be/src/util/network-util.h
A common/protobuf/CMakeLists.txt
A common/protobuf/rpc_test.proto
17 files changed, 765 insertions(+), 39 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/01/7901/5
-- 
To view, visit http://gerrit.cloudera.org:8080/7901
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-PatchSet: 5
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>

[Impala-ASF-CR] IMPALA-4670: Introduces RpcMgr class

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

Change subject: IMPALA-4670: Introduces RpcMgr class
......................................................................


Patch Set 9: Code-Review+2

Carry +2


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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8adb10ae375d7bf945394c38a520f12d29cf7b46
Gerrit-Change-Number: 7901
Gerrit-PatchSet: 9
Gerrit-Owner: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Dan Hecht <dh...@cloudera.com>
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Comment-Date: Thu, 05 Oct 2017 17:43:40 +0000
Gerrit-HasComments: No