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

NPE happens while replica region is moving

    XMLWordPrintableJSON

    Details

    • Hadoop Flags:
      Reviewed

      Description

      The following code is from AsyncNonMetaRegionLocator#addToCache

      private RegionLocations addToCache(TableCache tableCache, RegionLocations locs) {
        LOG.trace("Try adding {} to cache", locs);
        byte[] startKey = locs.getDefaultRegionLocation().getRegion().getStartKey();
        ...
      }

       we will get a NPE if the locs is without the default region.

       

      The following code is from AsyncRegionLocatorHelper#updateCachedLocationOnError 

      ...
      if (cause instanceof RegionMovedException) {
        RegionMovedException rme = (RegionMovedException) cause;
        HRegionLocation newLoc =
          new HRegionLocation(loc.getRegion(), rme.getServerName(), rme.getLocationSeqNum());
        LOG.debug("Try updating {} with the new location {} constructed by {}", loc, newLoc,
          rme.toString());
        addToCache.accept(newLoc);
      ...

      If the replica region is moving, we will get a RegionMovedException and add the HRegionLocation of replica region to cache. And finally NPE happens.

        

      java.lang.NullPointerExceptionjava.lang.NullPointerException at org.apache.hadoop.hbase.client.AsyncNonMetaRegionLocator.addToCache(AsyncNonMetaRegionLocator.java:240) at org.apache.hadoop.hbase.client.AsyncNonMetaRegionLocator.addLocationToCache(AsyncNonMetaRegionLocator.java:596) at org.apache.hadoop.hbase.client.AsyncRegionLocatorHelper.updateCachedLocationOnError(AsyncRegionLocatorHelper.java:80) at org.apache.hadoop.hbase.client.AsyncNonMetaRegionLocator.updateCachedLocationOnError(AsyncNonMetaRegionLocator.java:610) at org.apache.hadoop.hbase.client.AsyncRegionLocator.updateCachedLocationOnError(AsyncRegionLocator.java:153)
      

        Attachments

        1. HBASE-23376.branch-2.001.patch
          1 kB
          Sun Xin
        2. HBASE-23376.master.v02.dummy.patch
          2 kB
          Sun Xin
        3. HBASE-23376.master.v02.dummy.patch
          2 kB
          Sun Xin

          Activity

            People

            • Assignee:
              Ddupg Sun Xin
              Reporter:
              Ddupg Sun Xin
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: