martin-g commented on issue #1186: HBASE-19146 Update Protobuf to 3.11.4
URL: https://github.com/apache/hbase/pull/1186#issuecomment-589551849
 
 
   > That is correct and if private, you could just remove it rather than try 
and make it work w/ new PB ..... but is it not used by ByteStringer ? Also 
private but internally has a flag set to true on whether to use 
HBaseZeroCopyByteString ? (If not available or failed construct, we fall back 
to false).
   
   In current version (with protobuf 2.5.0) ByteStringer creates 
`LiteralByteString` when the flag is `true`:
   
   
https://github.com/apache/hbase/blob/fe0d49bc521537985752f093ed7ab06542dc33b5/hbase-protocol/src/main/java/org/apache/hadoop/hbase/util/ByteStringer.java#L58-L60
   
   
https://github.com/apache/hbase/blob/fe0d49bc521537985752f093ed7ab06542dc33b5/hbase-protocol/src/main/java/com/google/protobuf/HBaseZeroCopyByteString.java#L46-L48
   
   Since this PR (with protobuf 3.x) it will use `ByteString#wrap(byte[])` 
   
   
https://github.com/apache/hbase/pull/1186/files#diff-1a50ff406e272d422930cf33f2c95ca7R46
   
   which does the same:
   
   
https://github.com/protocolbuffers/protobuf/blob/v3.11.4/java/core/src/main/java/com/google/protobuf/ByteString.java#L391
   
   So creating `ByteString` from `byte[]` is still zero-copy.
   com.google.protobuf.HBaseZeroCopyByteString class is still needed because it 
makes `#wrap(byte[])` **public**. com.google.protobuf.ByteString#wrap(byte[]) 
is package-private.
   
   Getting `byte[]` from `ByteString` seems not used by HBase itself and this 
is the reason why `HBaseZeroCopyByteString#zeroCopyGetBytes(ByteString)` is now 
removed.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to