HBASE-20531 RS may throw NPE when close meta regions in shutdown procedure.

This commit is contained in:
huzheng 2018-05-04 19:44:10 +08:00
parent acd0d1e446
commit 971f5350e8
1 changed files with 11 additions and 11 deletions

View File

@ -1052,15 +1052,6 @@ public class HRegionServer extends HasThread implements
if (this.storefileRefresher != null) this.storefileRefresher.cancel(true); if (this.storefileRefresher != null) this.storefileRefresher.cancel(true);
sendShutdownInterrupt(); sendShutdownInterrupt();
// Stop the quota manager
if (rsQuotaManager != null) {
rsQuotaManager.stop();
}
if (rsSpaceQuotaManager != null) {
rsSpaceQuotaManager.stop();
rsSpaceQuotaManager = null;
}
// Stop the snapshot and other procedure handlers, forcefully killing all running tasks // Stop the snapshot and other procedure handlers, forcefully killing all running tasks
if (rspmHost != null) { if (rspmHost != null) {
rspmHost.stop(this.abortRequested || this.killed); rspmHost.stop(this.abortRequested || this.killed);
@ -1106,6 +1097,15 @@ public class HRegionServer extends HasThread implements
LOG.info("stopping server " + this.serverName + "; all regions closed."); LOG.info("stopping server " + this.serverName + "; all regions closed.");
} }
// Stop the quota manager
if (rsQuotaManager != null) {
rsQuotaManager.stop();
}
if (rsSpaceQuotaManager != null) {
rsSpaceQuotaManager.stop();
rsSpaceQuotaManager = null;
}
//fsOk flag may be changed when closing regions throws exception. //fsOk flag may be changed when closing regions throws exception.
if (this.fsOk) { if (this.fsOk) {
shutdownWAL(!abortRequested); shutdownWAL(!abortRequested);
@ -3697,9 +3697,9 @@ public class HRegionServer extends HasThread implements
@Override @Override
public boolean reportFileArchivalForQuotas(TableName tableName, public boolean reportFileArchivalForQuotas(TableName tableName,
Collection<Entry<String,Long>> archivedFiles) { Collection<Entry<String, Long>> archivedFiles) {
RegionServerStatusService.BlockingInterface rss = rssStub; RegionServerStatusService.BlockingInterface rss = rssStub;
if (rss == null) { if (rss == null || rsSpaceQuotaManager == null) {
// the current server could be stopping. // the current server could be stopping.
LOG.trace("Skipping file archival reporting to HMaster as stub is null"); LOG.trace("Skipping file archival reporting to HMaster as stub is null");
return false; return false;