-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-25640 Support hbase rpc compression for remote rpc only #3113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,7 @@ | |
| 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 @@ 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()); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: this would be easier to read if you extract the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will do. |
||
| 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(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no need to check if
compressorisnullbecause you never read it, and subsequent code is apparently fine with anullvalue.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking if compressor is null is that it can avoid a dns resolution if compressor is null (no compression is configured), which is the common use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, okay. A comment to this effect would help the casual reader.