You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2021/04/05 22:08:31 UTC

[GitHub] [hbase] ndimiduk commented on a change in pull request #3113: HBASE-25640 Support hbase rpc compression for remote rpc only

ndimiduk commented on a change in pull request #3113:
URL: https://github.com/apache/hbase/pull/3113#discussion_r607361992



##########
File path: hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcConnection.java
##########
@@ -89,7 +90,18 @@ protected RpcConnection(Configuration conf, HashedWheelTimer timeoutTimer, Conne
       MetricsConnection metrics) throws IOException {
     this.timeoutTimer = timeoutTimer;
     this.codec = codec;
-    this.compressor = compressor;
+    if (compressor != null) {
+      // Only enable compression for remote rpcs.
+      InetSocketAddress remoteAddr = Address.toSocketAddress(remoteId.getAddress());

Review comment:
       nit: this would be easier to read if you extract the `isLocal(ConnectionId)` logic into an external method. Then you can have a simpler conditional clause. Something like,
   
   ```
       this.compressor = isLocal(remoteId) ? null : compressor;
   ```

##########
File path: hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcConnection.java
##########
@@ -89,7 +90,18 @@ protected RpcConnection(Configuration conf, HashedWheelTimer timeoutTimer, Conne
       MetricsConnection metrics) throws IOException {
     this.timeoutTimer = timeoutTimer;
     this.codec = codec;
-    this.compressor = compressor;
+    if (compressor != null) {

Review comment:
       nit: no need to check if `compressor` is `null` because you never read it, and subsequent code is apparently fine with a `null` value.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org