HBase
  1. HBase
  2. HBASE-6359

KeyValue may return incorrect values after readFields()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.94.2
    • Component/s: None
    • Labels:
    • Hadoop Flags:
      Reviewed
    • Tags:
      noob

      Description

      When the same KeyValue object is used multiple times for deserialization using readFields, some methods may return incorrect values. Here is a sequence of operations that will reproduce the problem:

      1. A KeyValue is created whose key has length 10. The private field keyLength is initialized to 0.
      2. KeyValue.getKeyLength() is called. This reads the key length 10 from the backing array and caches it in keyLength.
      3. KeyValue.readFields() is called to deserialize a new value. The keyLength field is not cleared and keeps its value of 10, even though this value is probably incorrect.
      4. If getKeyLength() is called, the value 10 will be returned.

      For example, in a reducer with Iterable<KeyValue>, all values after the first one from the iterable are likely to return incorrect values from getKeyLength().

      The solution is to clear all memoized values in KeyValue.readFields(). I'll write a patch for this soon.

        Activity

        stack made changes -
        Fix Version/s 0.94.2 [ 12321884 ]
        Fix Version/s 0.95.0 [ 12324094 ]
        stack made changes -
        Fix Version/s 0.98.0 [ 12323143 ]
        stack made changes -
        Fix Version/s 0.98.0 [ 12323143 ]
        Fix Version/s 0.94.2 [ 12321884 ]
        Lars Hofhansl made changes -
        Fix Version/s 0.94.2 [ 12321884 ]
        stack made changes -
        Fix Version/s 0.95.0 [ 12324094 ]
        Fix Version/s 0.96.0 [ 12320040 ]
        Fix Version/s 0.94.2 [ 12321884 ]
        Lars Hofhansl made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Ted Yu made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Hadoop Flags Reviewed [ 10343 ]
        Resolution Fixed [ 1 ]
        Lars Hofhansl made changes -
        Fix Version/s 0.96.0 [ 12320040 ]
        Fix Version/s 0.94.2 [ 12321884 ]
        Dave Revell made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Dave Revell made changes -
        Attachment HBASE-6359-trunk-v1.diff [ 12538974 ]
        stack made changes -
        Field Original Value New Value
        Labels noob
        Tags noob
        Dave Revell created issue -

          People

          • Assignee:
            Dave Revell
            Reporter:
            Dave Revell
          • Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development