HBASE-25640 Support hbase rpc compression for remote rpc only
This commit is contained in:
parent
024248994f
commit
abc22aa0a6
|
@ -31,6 +31,7 @@ import org.apache.hadoop.hbase.security.SecurityInfo;
|
|||
import org.apache.hadoop.hbase.security.User;
|
||||
import org.apache.hadoop.hbase.security.provider.SaslClientAuthenticationProvider;
|
||||
import org.apache.hadoop.hbase.security.provider.SaslClientAuthenticationProviders;
|
||||
import org.apache.hadoop.hbase.util.Addressing;
|
||||
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
|
||||
import org.apache.hadoop.hbase.util.Pair;
|
||||
import org.apache.hadoop.io.compress.CompressionCodec;
|
||||
|
@ -89,7 +90,18 @@ abstract class RpcConnection {
|
|||
MetricsConnection metrics) throws IOException {
|
||||
this.timeoutTimer = timeoutTimer;
|
||||
this.codec = codec;
|
||||
if (compressor != null) {
|
||||
// Only enable compression for remote rpcs.
|
||||
InetSocketAddress remoteAddr = Address.toSocketAddress(remoteId.getAddress());
|
||||
if (!remoteAddr.isUnresolved() && Addressing.isLocalAddress(remoteAddr.getAddress())) {
|
||||
this.compressor = null;
|
||||
} else {
|
||||
this.compressor = compressor;
|
||||
}
|
||||
} else {
|
||||
this.compressor = null;
|
||||
}
|
||||
|
||||
this.conf = conf;
|
||||
this.metrics = metrics;
|
||||
User ticket = remoteId.getTicket();
|
||||
|
|
Loading…
Reference in New Issue