|
@@ -227,6 +227,9 @@ public class BlockManager {
|
|
|
|
|
|
/** for block replicas placement */
|
|
/** for block replicas placement */
|
|
private BlockPlacementPolicy blockplacement;
|
|
private BlockPlacementPolicy blockplacement;
|
|
|
|
+
|
|
|
|
+ /** Check whether name system is running before terminating */
|
|
|
|
+ private boolean checkNSRunning = true;
|
|
|
|
|
|
public BlockManager(final Namesystem namesystem, final FSClusterStats stats,
|
|
public BlockManager(final Namesystem namesystem, final FSClusterStats stats,
|
|
final Configuration conf) throws IOException {
|
|
final Configuration conf) throws IOException {
|
|
@@ -356,6 +359,12 @@ public class BlockManager {
|
|
return blockTokenSecretManager;
|
|
return blockTokenSecretManager;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** Allow silent termination of replication monitor for testing */
|
|
|
|
+ @VisibleForTesting
|
|
|
|
+ void enableRMTerminationForTesting() {
|
|
|
|
+ checkNSRunning = false;
|
|
|
|
+ }
|
|
|
|
+
|
|
private boolean isBlockTokenEnabled() {
|
|
private boolean isBlockTokenEnabled() {
|
|
return blockTokenSecretManager != null;
|
|
return blockTokenSecretManager != null;
|
|
}
|
|
}
|
|
@@ -3129,6 +3138,9 @@ assert storedBlock.findDatanode(dn) < 0 : "Block " + block
|
|
+ " while shutting down.", t);
|
|
+ " while shutting down.", t);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
+ } else if (!checkNSRunning && t instanceof InterruptedException) {
|
|
|
|
+ LOG.info("Stopping ReplicationMonitor for testing.");
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
LOG.fatal("ReplicationMonitor thread received Runtime exception. ", t);
|
|
LOG.fatal("ReplicationMonitor thread received Runtime exception. ", t);
|
|
terminate(1, t);
|
|
terminate(1, t);
|