|
@@ -751,14 +751,14 @@ public class DFSUtilClient {
|
|
public static class CorruptedBlocks {
|
|
public static class CorruptedBlocks {
|
|
private Map<ExtendedBlock, Set<DatanodeInfo>> corruptionMap;
|
|
private Map<ExtendedBlock, Set<DatanodeInfo>> corruptionMap;
|
|
|
|
|
|
- public CorruptedBlocks() {
|
|
|
|
- this.corruptionMap = new HashMap<>();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* Indicate a block replica on the specified datanode is corrupted
|
|
* Indicate a block replica on the specified datanode is corrupted
|
|
*/
|
|
*/
|
|
public void addCorruptedBlock(ExtendedBlock blk, DatanodeInfo node) {
|
|
public void addCorruptedBlock(ExtendedBlock blk, DatanodeInfo node) {
|
|
|
|
+ if (corruptionMap == null) {
|
|
|
|
+ corruptionMap = new HashMap<>();
|
|
|
|
+ }
|
|
|
|
+
|
|
Set<DatanodeInfo> dnSet = corruptionMap.get(blk);
|
|
Set<DatanodeInfo> dnSet = corruptionMap.get(blk);
|
|
if (dnSet == null) {
|
|
if (dnSet == null) {
|
|
dnSet = new HashSet<>();
|
|
dnSet = new HashSet<>();
|
|
@@ -770,7 +770,8 @@ public class DFSUtilClient {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * @return the map that contains all the corruption entries.
|
|
|
|
|
|
+ * @return the map that contains all the corruption entries, or null if
|
|
|
|
+ * there were no corrupted entries
|
|
*/
|
|
*/
|
|
public Map<ExtendedBlock, Set<DatanodeInfo>> getCorruptionMap() {
|
|
public Map<ExtendedBlock, Set<DatanodeInfo>> getCorruptionMap() {
|
|
return corruptionMap;
|
|
return corruptionMap;
|