alluxio icon indicating copy to clipboard operation
alluxio copied to clipboard

Unify DefaultBlockWorkerClient with AbstractClient

Open YangchenYe323 opened this issue 2 years ago • 6 comments

What changes are proposed in this pull request?

Make DefaultBlockWorkerClient extends from AbstractClient

Why are the changes needed?

  • Address a todo issue in the codebase
  • Reduce duplicated code
  • Avoid doing the expensive connection when DefaultBlockWorkerClient is constructed, take advantage of the lazy connection mechanism of AbstractClient
  • Improve the flexibility of AbstractClient

Does this PR introduce any user facing changes?

No

YangchenYe323 avatar Jul 07 '22 03:07 YangchenYe323

In order for DefaultBlockWorkerClient to inherit from AbstractClient, three issues have to be addressed:

  1. DefaultBlockWorkerClient might not work with an InetSocketAddress as it might use a domain socket instead. Therefore, AbstractClient is modified to expose a getGrpcServerAddress method used to return whatever server address the client connects to. DefaultBlockWorkerClient overrides this method to return the address it needs for connection.

  2. AbstractClient now can be extended to construct multiple channels corresponding to different GrpcNetworkGroup, so that DefaultBlockWorker can construct two channels, one for streaming and one for normal rpc, for its use.

  3. AbstractClient currently hardcoded a version checking method, which alluxio workers don't hold. Therefore, a switch is exposed to control whether version checking should be run so that DefaultBlockWorkerClient can switch it off.

YangchenYe323 avatar Jul 07 '22 04:07 YangchenYe323

@beinan @dbw9580 Do you mind taking a look at this refactor? Thanks a lot!

YangchenYe323 avatar Jul 10 '22 22:07 YangchenYe323

@dbw9580 Cleaned up a bit and addressed your concerns. Would you like to take another look? Thanks!

YangchenYe323 avatar Jul 26 '22 19:07 YangchenYe323

Please try your best to preserve the behavior of the client, since this is a fundamental class, a lot of things depend on it.

dbw9580 avatar Aug 02 '22 10:08 dbw9580

What tests have been done? How do you make sure not to break some conner cases?

yyongycy avatar Aug 26 '22 01:08 yyongycy

What tests have been done? How do you make sure not to break some conner cases?

Every test case that reads or writes from alluxio uses this class. Also tested the generated tarball against tests in ClientIO cluster.

YangchenYe323 avatar Aug 26 '22 01:08 YangchenYe323

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in two weeks if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jan 31 '23 15:01 github-actions[bot]

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in two weeks if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jun 16 '23 15:06 github-actions[bot]