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:
[email protected]


Reply via email to