use of org.apache.hadoop.hdfs.server.datanode.FsDatasetTestUtils.MaterializedReplica in project hadoop by apache.
the class MiniDFSCluster method corruptBlockOnDataNodesHelper.
private int corruptBlockOnDataNodesHelper(ExtendedBlock block, boolean deleteBlockFile) throws IOException {
int blocksCorrupted = 0;
for (DataNode dn : getDataNodes()) {
try {
MaterializedReplica replica = getFsDatasetTestUtils(dn).getMaterializedReplica(block);
if (deleteBlockFile) {
replica.deleteData();
} else {
replica.corruptData();
}
blocksCorrupted++;
} catch (ReplicaNotFoundException e) {
// Ignore.
}
}
return blocksCorrupted;
}
use of org.apache.hadoop.hdfs.server.datanode.FsDatasetTestUtils.MaterializedReplica in project hadoop by apache.
the class TestDFSShell method corrupt.
private static void corrupt(List<MaterializedReplica> replicas, String content) throws IOException {
StringBuilder sb = new StringBuilder(content);
char c = content.charAt(0);
sb.setCharAt(0, ++c);
for (MaterializedReplica replica : replicas) {
replica.corruptData(sb.toString().getBytes("UTF8"));
}
}
Aggregations