List of usage examples for org.apache.hadoop.hdfs.server.blockmanagement BlockManager getBlockCollection
BlockCollection getBlockCollection(BlockInfo b)
From source file:backup.namenode.NameNodeBackupBlockCheckProcessor.java
License:Apache License
private void restoreAll(BackupReportWriter writer, ExtendedBlockEnum<NullWritable> buEnum) throws Exception { writer.startRestoreAll();/*from w ww . j a v a 2s .c o m*/ ExtendedBlock block; BlockManager blockManager = namenode.getNamesystem().getBlockManager(); while ((block = buEnum.next()) != null) { org.apache.hadoop.hdfs.protocol.ExtendedBlock heb = BackupUtil.toHadoop(block); BlockCollection blockCollection = blockManager.getBlockCollection(heb.getLocalBlock()); if (blockCollection == null) { try { writer.restoreBlock(block); processor.requestRestore(block); } catch (Exception e) { LOG.error("Unknown error while trying to restore block " + block, e); writer.restoreBlockError(block); } } } writer.completeRestoreAll(); }