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

Wrong result when scaning meta with startRow

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 0.99.0, 0.98.5
    • None
    • None
    • Reviewed

    Description

      When we scan the meta with STARTROW optiion, wrong result may be returned.
      For exmaple: if there are two tables named "a" and "b" in hbase, when we scan the meta with startrow = 'b', the region location of table "a" will be returned but we expect to get the region location of table "b".

      > create 'a', {NAME => 'f'}
      > create 'b', {NAME => 'f'}
      > scan '.META.', {STARTROW => 'b', LIMIT => 1}
      a,,1405655897758.f8b547476b6dc80545e6413c31396, xxxx
      

      The reason is the wrong assumption in MetaKeyComparator

      See: KeyValue.java#2011

            int leftDelimiter = getDelimiter(left, loffset, llength,
                HRegionInfo.DELIMITER);
            int rightDelimiter = getDelimiter(right, roffset, rlength,
                HRegionInfo.DELIMITER);
            if (leftDelimiter < 0 && rightDelimiter >= 0) {
              // Nothing between .META. and regionid.  Its first key. 
              return -1;
            } else if (rightDelimiter < 0 && leftDelimiter >= 0) {
              return 1;
            } else if (leftDelimiter < 0 && rightDelimiter < 0) {
              return 0;
            }
      

      It's a little troublesome to fix this problem for given a start row which contains more than two "," for meta, it's not easy to extract the startKey of region.
      eg: STARTROW => 'aaa,bbb,ccc,xxx'.

      Comments and suggestions are welcomed. Thanks

      Attachments

        1. HBASE-11541-trunk-v1.diff
          7 kB
          Shaohui Liu
        2. HBASE-11541.patch
          7 kB
          Andrew Kyle Purtell
        3. HBASE-11541.patch
          7 kB
          Michael Stack

        Activity

          People

            liushaohui Shaohui Liu
            liushaohui Shaohui Liu
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: