HBase
  1. HBase
  2. HBASE-10311

Add Scan object to preScannerNext and postScannerNext methods on RegionObserver

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 0.96.1.1
    • Fix Version/s: None
    • Component/s: Coprocessors
    • Labels:
      None

      Description

      I'd like to be able to access the org.apache.hadoop.hbase.client.Scan that was used to create a scanner in the RegionObserver.preScannerNext and RegionObserver.postScannerNext methods.

      The Scan object is available in the preScannerOpen method, but not in the preScannerNext or postScannerNext methods.

      The reason is that I'd like to access the attributes of the Scan object. I want to do some resource management in the coprocessor based on some attributes of the Scan object (like, who created it).

      Alternatively, does anybody know of another way to get hold of the Scan object in these methods without modifying things?

      1. HBASE-10311.patch
        14 kB
        Neil Ferguson

        Activity

        Hide
        stack added a comment -

        Closing at Mr Neil Ferguson's suggestion. This seems like something we should doc in CP section of refguide given two of you fellas bumped into the prob. Let me try do that and point to this issue.

        Show
        stack added a comment - Closing at Mr Neil Ferguson 's suggestion. This seems like something we should doc in CP section of refguide given two of you fellas bumped into the prob. Let me try do that and point to this issue.
        Hide
        Anoop Sam John added a comment -

        Actually it will be the same scanner object being passed in next() and next CP hooks. Yes we already use this VisibilityController. I was about to come here and suggest this and then saw you realized it alreay on your own.. Good
        We can not change the CP signature in released major versions. But can change in Trunk only ( if needed) .. Here it looks not needed at all.. So I will close this issue.

        Show
        Anoop Sam John added a comment - Actually it will be the same scanner object being passed in next() and next CP hooks. Yes we already use this VisibilityController. I was about to come here and suggest this and then saw you realized it alreay on your own.. Good We can not change the CP signature in released major versions. But can change in Trunk only ( if needed) .. Here it looks not needed at all.. So I will close this issue.
        Hide
        Neil Ferguson added a comment -

        Just made this patch, then realised that I can accomplish what I want by mapping RegionScanner -> Scan in postScannerOpen, then looking up this map in preScannerNext and postScannerNext.

        VisibilityController seems to do something similar already using a weak hashmap.

        This approach seems a little brittle, since there's theoretically no guarantee that the scanner that is passed to postScannerOpen is the same on that is passed to preScannerNext and postScannerNext. Perhaps we should change the docs to explicitly specify that this will always be the case.

        Anyway, since it doesn't involve changing the coprocessor interface, I'll take this approach. The patch to modify the coprocessor interface is attached if anyone wants it. Feel free to close this ticket otherwise.

        Show
        Neil Ferguson added a comment - Just made this patch, then realised that I can accomplish what I want by mapping RegionScanner -> Scan in postScannerOpen, then looking up this map in preScannerNext and postScannerNext. VisibilityController seems to do something similar already using a weak hashmap. This approach seems a little brittle, since there's theoretically no guarantee that the scanner that is passed to postScannerOpen is the same on that is passed to preScannerNext and postScannerNext. Perhaps we should change the docs to explicitly specify that this will always be the case. Anyway, since it doesn't involve changing the coprocessor interface, I'll take this approach. The patch to modify the coprocessor interface is attached if anyone wants it. Feel free to close this ticket otherwise.
        Hide
        Neil Ferguson added a comment -

        Patch attached

        Show
        Neil Ferguson added a comment - Patch attached

          People

          • Assignee:
            Unassigned
            Reporter:
            Neil Ferguson
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development