HBase
  1. HBase
  2. HBASE-3978

rowlock lease renew doesn't work when custom coprocessor/RegionObserver indicates to bypass default action

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.92.0
    • Fix Version/s: 0.92.0
    • Component/s: Coprocessors, regionserver
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      Region server will keep extending the lease on the rowlock as long as there is some action on the row. This is done inside HRegionServer.getLockFromId, where it renew the lease on the rowlock. However, when coprocessor "pre-action" observer is used, getLockFromId is skipped if default action is bypassed. Take HRegionServer.exists as example, RegionCoprocessorHost.preExists could return Boolean object if one of the regionobservers indicates default action should be bypassed; thus getLockFromId didn't called and the lease on the lock doesn't get renewed.

      public boolean exists(byte[] regionName, Get get) throws IOException {
      checkOpen();
      requestCount.incrementAndGet();
      try {
      HRegion region = getRegion(regionName);
      if (region.getCoprocessorHost() != null) {
      Boolean result = region.getCoprocessorHost().preExists(get);
      if (result != null)

      { return result.booleanValue(); }

      }
      Result r = region.get(get, getLockFromId(get.getLockId()));
      boolean result = r != null && !r.isEmpty();
      if (region.getCoprocessorHost() != null)

      { result = region.getCoprocessorHost().postExists(get, result); }

      return result;
      } catch (Throwable t)

      { throw convertThrowableToIOE(cleanup(t)); }

      }

      The application scenario is:
      a) client application passes in a rowlock object in an action.
      b) there is custom coprocessor/observer used.
      c) For a given action, the custom coprocessor/observer might tell coprocessor framework to bypass the default action.

      From client application point of view, the behavior is sometimes the rowlock will timeout even though client is accessing the row all the time, depending on whether coprocessor/observer wants to bypass the default action.

      This applies to several other actions as well, increment, checkAndPut, checkandDelete.

        Activity

        Hide
        stack added a comment -

        You have a patch Ming?

        Show
        stack added a comment - You have a patch Ming?
        Hide
        Ming Ma added a comment -

        Stack, here is the fix. Please review. Thanks.

        Show
        Ming Ma added a comment - Stack, here is the fix. Please review. Thanks.
        Hide
        Andrew Purtell added a comment -

        Yep, this is a bug. Good catch Ming.

        +1 on patch. Will commit after local tests.

        Show
        Andrew Purtell added a comment - Yep, this is a bug. Good catch Ming. +1 on patch. Will commit after local tests.
        Hide
        Andrew Purtell added a comment -

        Committed after all local tests pass.

        Show
        Andrew Purtell added a comment - Committed after all local tests pass.
        Hide
        Hudson added a comment -

        Integrated in HBase-TRUNK #1976 (See https://builds.apache.org/job/HBase-TRUNK/1976/)

        Show
        Hudson added a comment - Integrated in HBase-TRUNK #1976 (See https://builds.apache.org/job/HBase-TRUNK/1976/ )

          People

          • Assignee:
            Ming Ma
            Reporter:
            Ming Ma
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development