- 
                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?
Conversation
| 🎊 +1 overall 
 
 This message was automatically generated. | 
| 🎊 +1 overall 
 
 This message was automatically generated. | 
| 🎊 +1 overall 
 
 This message was automatically generated. | 
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.
I have some code style suggestions. I agree that a test would be helpful. Looking into our RpcConnection code, I don't have any strong suggestions
| this.timeoutTimer = timeoutTimer; | ||
| this.codec = codec; | ||
| this.compressor = compressor; | ||
| if (compressor != null) { | 
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 compressor is null because you never read it, and subsequent code is apparently fine with a null value.
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.
| 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 comment
The reason will be displayed to describe this comment to others. Learn more.
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;
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.
will do.
| 🎊 +1 overall 
 
 This message was automatically generated. | 
| 🎊 +1 overall 
 
 This message was automatically generated. | 
| 🎊 +1 overall 
 
 This message was automatically generated. | 
| 💔 -1 overall 
 
 This message was automatically generated. | 
| 🎊 +1 overall 
 
 This message was automatically generated. | 
| 🎊 +1 overall 
 
 This message was automatically generated. | 
I did manual test to make sure this change works, it is hard to put up a unittest for this change.