HBase
  1. HBase
  2. HBASE-5489

Add HTable accessor to get regions for a key range

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.92.1, 0.94.0
    • Component/s: Client
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      It would be nice to have an accessor to find all regions that overlap with a particular range of keys. Right now, the only way to accomplish that is to call HTable.getStartEndKeys(), then follow that with calls to getRegionLocation() for the range of keys you are interested in. This algorithm has 2 drawbacks:

      • It returns more keys than is necessary most of the time. This is especially evident if there are a lot of regions comprising the table and the range of keys is small.
      • It always does a scan of .META. via MetaScannerVisitor for at least HTable.getStartEndKeys(), and perhaps for HRegionLocations that are not already cached by the client.

      An accessor that limited its scans to a specified range could avoid scanning .META. at all if the HRegionLocations being fetched were already cached by the client, thereby potentially making this operation faster in common cases.

      Here's a proposal for the accessor:

      /**

      • Get the corresponding regions for an arbitrary range of keys.
      • <p>
      • @param startRow Starting row in range, inclusive
      • @param endRow Ending row in range, inclusive
      • @return A list of HRegionLocations corresponding to the regions that
      • contain the specified range
      • @throws IOException if a remote or network exception occurs
        */
        public List<HRegionLocation> getRegionsInRange(final byte [] startKey,
        final byte [] endKey) throws IOException
      1. HBASE-5489-4.patch
        0.7 kB
        David S. Wang
      2. HBASE-5489-3-0.92.1.patch
        10 kB
        David S. Wang
      3. HBASE-5489-3.patch
        5 kB
        David S. Wang
      4. HBASE-5489-2.patch
        5 kB
        David S. Wang

        Issue Links

          Activity

          David S. Wang created issue -
          David S. Wang made changes -
          Field Original Value New Value
          Status Open [ 1 ] In Progress [ 3 ]
          Todd Lipcon made changes -
          Link This issue is related to HBASE-5492 [ HBASE-5492 ]
          David S. Wang made changes -
          Status In Progress [ 3 ] Patch Available [ 10002 ]
          Fix Version/s 0.92.1 [ 12318551 ]
          Fix Version/s 0.94.0 [ 12316419 ]
          Fix Version/s 0.96.0 [ 12320040 ]
          David S. Wang made changes -
          Attachment HBASE-5489-2.patch [ 12516685 ]
          David S. Wang made changes -
          Attachment HBASE-5489-3.patch [ 12516706 ]
          stack made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Hadoop Flags Reviewed [ 10343 ]
          Fix Version/s 0.92.1 [ 12318551 ]
          Resolution Fixed [ 1 ]
          David S. Wang made changes -
          Attachment HBASE-5489-3-0.92.1.patch [ 12516717 ]
          stack made changes -
          Fix Version/s 0.92.1 [ 12318551 ]
          Fix Version/s 0.96.0 [ 12320040 ]
          David S. Wang made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          David S. Wang made changes -
          Attachment HBASE-5489-4.patch [ 12516762 ]
          David S. Wang made changes -
          Status Reopened [ 4 ] Patch Available [ 10002 ]
          Lars Hofhansl made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Lars Hofhansl made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              David S. Wang
              Reporter:
              David S. Wang
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development