You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Sun Xin (Jira)" <ji...@apache.org> on 2019/12/09 02:00:08 UTC
[jira] [Resolved] (HBASE-23376) NPE happens while replica region is
moving
[ https://issues.apache.org/jira/browse/HBASE-23376?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sun Xin resolved HBASE-23376.
-----------------------------
Resolution: Fixed
> NPE happens while replica region is moving
> ------------------------------------------
>
> Key: HBASE-23376
> URL: https://issues.apache.org/jira/browse/HBASE-23376
> Project: HBase
> Issue Type: Bug
> Components: read replicas
> Reporter: Sun Xin
> Assignee: Sun Xin
> Priority: Minor
> Attachments: HBASE-23376.branch-2.001.patch
>
>
> The following code is from AsyncNonMetaRegionLocator#addToCache
> {code:java}
> private RegionLocations addToCache(TableCache tableCache, RegionLocations locs) {
> LOG.trace("Try adding {} to cache", locs);
> byte[] startKey = locs.getDefaultRegionLocation().getRegion().getStartKey();
> ...
> }{code}
> we will get a NPE if the locs is without the default region.
>
> The following code is from AsyncRegionLocatorHelper#updateCachedLocationOnError
> {code:java}
> ...
> 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);
> ...{code}
> If the replica region is moving, we will get a RegionMovedException and add the HRegionLocation of replica region to cache. And finally NPE happens.
>
> {code:java}
> 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)
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)