Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-1765

Delay Result deserialization until asked for and permit access to the raw binary to prevent forced deserialization

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.20.0
    • 0.20.1, 0.90.0
    • Client
    • None
    • Reviewed

    Description

      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?

      Attachments

        1. HBASE-1765-v1.patch
          6 kB
          Jonathan Gray
        2. HBASE-1765-v2.patch
          8 kB
          Jonathan Gray

        Activity

          People

            streamy Jonathan Gray
            streamy Jonathan Gray
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: