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

MSLab May cause the Bytes.toLong not work correctly for increment

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.94.2
    • None
    • None
    • Reviewed

    Description

      When use MemStoreLAB, the KeyValues will share the byte array allocated by the MemStoreLAB, all the KeyValues' "bytes" attributes are the same byte array. When use the functions such as Bytes.toLong(byte[] bytes, int offset):

        public static long toLong(byte[] bytes, int offset) {
          return toLong(bytes, offset, SIZEOF_LONG);
        }
      
        public static long toLong(byte[] bytes, int offset, final int length) {
          if (length != SIZEOF_LONG || offset + length > bytes.length) {
            throw explainWrongLengthOrOffset(bytes, offset, length, SIZEOF_LONG);
          }
          long l = 0;
          for(int i = offset; i < offset + length; i++) {
            l <<= 8;
            l ^= bytes[i] & 0xFF;
          }
          return l;
        }
      

      If we do not put a long value to the KeyValue, and read it as a long value in HRegion.increment(),the check

      offset + length > bytes.length
      

      will take no effects, because the bytes.length is not equal to keyLength+valueLength, indeed it is MemStoreLAB chunkSize which is default 2048 * 1024.

      I will paste the patch later.

      Attachments

        1. HBASE-6520-trunk-v1.patch
          2 kB
          ShiXing
        2. HBASE-6520-0.94-v1.patch
          2 kB
          ShiXing

        Activity

          People

            xingshi ShiXing
            xingshi ShiXing
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: