HBase
  1. HBase
  2. HBASE-5517

Region Server Coprocessor : Suggestion for change when next() call with nbRows>1

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 0.92.0
    • Fix Version/s: None
    • Component/s: Coprocessors
    • Labels:
      None

      Description

      Originated from the discussion under HBASE-2038 [Coprocessor based IHBase]

      Currently preNext() and postNext() will be called once for a next() call into HRegionServer.
      But if the next() is being called with nbRows>1, co processor should provide a chance to do some operation before, after every next() calls into region as part of call next(int scannerId, int nbRows).

      In case of usage of coprocessor with IHBase, before making any calls of next() into a Region, we need to make a reseek() to a row based on the index information.

        Issue Links

          Activity

          Hide
          Anoop Sam John added a comment -

          In HRegionServer next(final long scannerId, int nbRows)

          for (int i = 0; i < nbRows
                    && currentScanResultSize < maxScannerResultSize; i++) {
                  requestCount.incrementAndGet();
          

          Here if next() is called with nbRows=10 we are treating it as 10 requests came to RS. We treat it as 10 different operations on the RS.In that case we better contact the CP 10 times rather than 1 time? Correct me if I am wrong...

          Show
          Anoop Sam John added a comment - In HRegionServer next(final long scannerId, int nbRows) for ( int i = 0; i < nbRows && currentScanResultSize < maxScannerResultSize; i++) { requestCount.incrementAndGet(); Here if next() is called with nbRows=10 we are treating it as 10 requests came to RS. We treat it as 10 different operations on the RS.In that case we better contact the CP 10 times rather than 1 time? Correct me if I am wrong...
          Hide
          Andrew Purtell added a comment -

          You should be able to achieve what you want with a custom scanner that implements RegionScanner.

          Use the coprocessor preScannerOpen. In that hook, wrap the passed in RegionScanner with an instance of a custom wrapper class that extends RegionScanner, and return that instance of your scanner wrapper.

          Then in your wrapper, in the implementation of next(List<KeyValue> result, int limit), use a for loop to call next(List<KeyValue> results).

          Then in your wrapper, in the implementation of next(List<KeyValue> results), call reseek or whatever, and then call the next(List<KeyValue> results) method of the scanner you are wrapping.

          Show
          Andrew Purtell added a comment - You should be able to achieve what you want with a custom scanner that implements RegionScanner. Use the coprocessor preScannerOpen. In that hook, wrap the passed in RegionScanner with an instance of a custom wrapper class that extends RegionScanner, and return that instance of your scanner wrapper. Then in your wrapper, in the implementation of next(List<KeyValue> result, int limit), use a for loop to call next(List<KeyValue> results). Then in your wrapper, in the implementation of next(List<KeyValue> results), call reseek or whatever, and then call the next(List<KeyValue> results) method of the scanner you are wrapping.
          Hide
          Anoop Sam John added a comment -

          As per Andrew's comment above, we can have the alternate solution of creating the wrapper for RegionScanner and get the functionality.

          So marking this issue as closed and wont fix

          Show
          Anoop Sam John added a comment - As per Andrew's comment above, we can have the alternate solution of creating the wrapper for RegionScanner and get the functionality. So marking this issue as closed and wont fix

            People

            • Assignee:
              Unassigned
              Reporter:
              Anoop Sam John
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development