HDFS-11883: [SPS] : Handle NPE in BlockStorageMovementTracker when dropSPSWork() called. Contributed by Surendra Singh Lilhore.

This commit is contained in:
Uma Maheswara Rao G 2017-05-30 18:12:17 -07:00 committed by Uma Maheswara Rao Gangumalla
parent 5ce332dc9a
commit e53f89ccc3

View File

@ -88,13 +88,17 @@ public void run() {
long trackId = result.getTrackId(); long trackId = result.getTrackId();
List<Future<BlockMovementResult>> blocksMoving = moverTaskFutures List<Future<BlockMovementResult>> blocksMoving = moverTaskFutures
.get(trackId); .get(trackId);
if (blocksMoving == null) {
LOG.warn("Future task doesn't exist for trackId " + trackId);
continue;
}
blocksMoving.remove(future); blocksMoving.remove(future);
List<BlockMovementResult> resultPerTrackIdList = List<BlockMovementResult> resultPerTrackIdList =
addMovementResultToTrackIdList(result); addMovementResultToTrackIdList(result);
// Completed all the scheduled blocks movement under this 'trackId'. // Completed all the scheduled blocks movement under this 'trackId'.
if (blocksMoving.isEmpty()) { if (blocksMoving.isEmpty() || moverTaskFutures.get(trackId) == null) {
synchronized (moverTaskFutures) { synchronized (moverTaskFutures) {
moverTaskFutures.remove(trackId); moverTaskFutures.remove(trackId);
} }