Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-11871 Avoid usage of KeyValueUtil#ensureKeyValue
  3. HBASE-12068

[Branch-1] Avoid need to always do KeyValueUtil#ensureKeyValue for Filter transformCell

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.99.0
    • 0.99.1
    • Filters
    • None
    • Reviewed
    • Hide
      When custom Filters are used, make sure to override Cell based methods and not keyValue based methods. ie.
      transformCell(Cell) instead of transform(KeyValue)
      getNextCellHint(Cell) instead of getNextKeyHint(KeyValue)
      Else there can be possible performance hit of a conversion of a non KV Cell to a KV which required key and value deep copy.
      Show
      When custom Filters are used, make sure to override Cell based methods and not keyValue based methods. ie. transformCell(Cell) instead of transform(KeyValue) getNextCellHint(Cell) instead of getNextKeyHint(KeyValue) Else there can be possible performance hit of a conversion of a non KV Cell to a KV which required key and value deep copy.

    Description

      During read with Filters added to Scan/Get, the core code calls transformCell(Cell) on the Filter. Most of the filters do not implement transform API so the method from FilterBase will get executed

        @Override
        public Cell transformCell(Cell v) throws IOException {
          // Old filters based off of this class will override KeyValue transform(KeyValue).
          // Thus to maintain compatibility we need to call the old version.
          return transform(KeyValueUtil.ensureKeyValue(v));
        }
      

      Here always it do KeyValueUtil.ensureKeyValue. When a non KV cell comes in, we need recreate KV and do deep copy of key and value!
      We have to stick with this model in branch-1 for BC.
      So as a workaround to avoid possible KV convert, we can implement transformCell(Cell) method in all of our individual Filter classes which just return the incoming cell (So that method from FilterBase wont get executed)

      Attachments

        1. HBASE-12068.patch
          30 kB
          Anoop Sam John

        Issue Links

          Activity

            People

              anoop.hbase Anoop Sam John
              anoop.hbase Anoop Sam John
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: