Delay Result deserialization until asked for and permit access to the raw
binary to prevent forced deserialization
------------------------------------------------------------------------------------------------------------------
Key: HBASE-1765
URL: https://issues.apache.org/jira/browse/HBASE-1765
Project: Hadoop HBase
Issue Type: Improvement
Components: client
Affects Versions: 0.20.0
Reporter: Jonathan Gray
Assignee: Jonathan Gray
Fix For: 0.20.0, 0.21.0
We have our own API that we use to access HBase from other languages like
erlang, python, c, etc...
The Java gateway that maps from the actual HBase API to our internal API wants
to pass the raw binary received for a Result. As is, we have to deserialize
into an array of KeyValues and then re-serialize into a flat byte[].
We would like to propose modifying Result to not build the KeyValue[] until
it's asked for via client methods (.raw() or .sorted() or any of the map
methods). This is already how the map methods work (we don't build the map
until it's asked for the first time).
The only API change would be adding an additional Result.getBytes() method the
get the raw underlying byte[] that was sent from the server.
The Result.readFields(DataInput) would then only read in the full byte[].
Would add an additional private method Result.readFields() that generated the
KeyValue[]. That would be called whenever a client asks for anything besides
.getBytes().
Since all access to Result is done through those methods (KeyValue[] private
and not directly accessible w/o using those methods) this should not impact any
existing code.
Thoughts?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.