private void notifyNamenodeBlock(ExtendedBlock block, BlockStatus status, String delHint, String storageUuid, boolean isOnTransientStorage) { checkBlock(block); final ReceivedDeletedBlockInfo info = new ReceivedDeletedBlockInfo( block.getLocalBlock(), status, delHint); final DatanodeStorage storage = dn.getFSDataset().getStorage(storageUuid); for (BPServiceActor actor : bpServices) { actor.getIbrManager().notifyNamenodeBlock(info, storage, isOnTransientStorage); } }
public static ReceivedDeletedBlockInfo convert( ReceivedDeletedBlockInfoProto proto) { ReceivedDeletedBlockInfo.BlockStatus status = null; switch (proto.getStatus()) { case RECEIVING: status = BlockStatus.RECEIVING_BLOCK; break; case RECEIVED: status = BlockStatus.RECEIVED_BLOCK; break; case DELETED: status = BlockStatus.DELETED_BLOCK; break; } return new ReceivedDeletedBlockInfo( PBHelperClient.convert(proto.getBlock()), status, proto.hasDeleteHint() ? proto.getDeleteHint() : null); }
public static StorageReceivedDeletedBlocks[] makeReportForReceivedBlock( Block block, BlockStatus blockStatus, DatanodeStorage storage) { ReceivedDeletedBlockInfo[] receivedBlocks = new ReceivedDeletedBlockInfo[1]; receivedBlocks[0] = new ReceivedDeletedBlockInfo(block, blockStatus, null); StorageReceivedDeletedBlocks[] reports = new StorageReceivedDeletedBlocks[1]; reports[0] = new StorageReceivedDeletedBlocks(storage, receivedBlocks); return reports; }
private static StorageReceivedDeletedBlocks[] makeReportForReceivedBlock( Block block, DatanodeStorage storage) { ReceivedDeletedBlockInfo[] receivedBlocks = new ReceivedDeletedBlockInfo[1]; receivedBlocks[0] = new ReceivedDeletedBlockInfo(block, BlockStatus.RECEIVED_BLOCK, null); StorageReceivedDeletedBlocks[] reports = new StorageReceivedDeletedBlocks[1]; reports[0] = new StorageReceivedDeletedBlocks(storage, receivedBlocks); return reports; }
private void notifyNamenodeBlock(ExtendedBlock block, BlockStatus status, String delHint, String storageUuid, boolean isOnTransientStorage) { checkBlock(block); final ReceivedDeletedBlockInfo info = new ReceivedDeletedBlockInfo( block.getLocalBlock(), status, delHint); final DatanodeStorage storage = dn.getFSDataset().getStorage(storageUuid); for (BPServiceActor actor : bpServices) { actor.getIbrManager().notifyNamenodeBlock(info, storage, isOnTransientStorage); } }
private void notifyNamenodeBlock(ExtendedBlock block, BlockStatus status, String delHint, String storageUuid, boolean isOnTransientStorage) { checkBlock(block); final ReceivedDeletedBlockInfo info = new ReceivedDeletedBlockInfo( block.getLocalBlock(), status, delHint); final DatanodeStorage storage = dn.getFSDataset().getStorage(storageUuid); for (BPServiceActor actor : bpServices) { actor.getIbrManager().notifyNamenodeBlock(info, storage, isOnTransientStorage); } }
public static ReceivedDeletedBlockInfo convert( ReceivedDeletedBlockInfoProto proto) { ReceivedDeletedBlockInfo.BlockStatus status = null; switch (proto.getStatus()) { case RECEIVING: status = BlockStatus.RECEIVING_BLOCK; break; case RECEIVED: status = BlockStatus.RECEIVED_BLOCK; break; case DELETED: status = BlockStatus.DELETED_BLOCK; break; } return new ReceivedDeletedBlockInfo( PBHelper.convert(proto.getBlock()), status, proto.hasDeleteHint() ? proto.getDeleteHint() : null); }
public static ReceivedDeletedBlockInfo convert( ReceivedDeletedBlockInfoProto proto) { ReceivedDeletedBlockInfo.BlockStatus status = null; switch (proto.getStatus()) { case RECEIVING: status = BlockStatus.RECEIVING_BLOCK; break; case RECEIVED: status = BlockStatus.RECEIVED_BLOCK; break; case DELETED: status = BlockStatus.DELETED_BLOCK; break; } return new ReceivedDeletedBlockInfo( PBHelper.convert(proto.getBlock()), status, proto.hasDeleteHint() ? proto.getDeleteHint() : null); }
/** * Inject a fake 'received' block into the BPServiceActor state. */ private void injectBlockReceived() { ReceivedDeletedBlockInfo rdbi = new ReceivedDeletedBlockInfo( getDummyBlock(), BlockStatus.RECEIVED_BLOCK, null); DatanodeStorage s = singletonDn.getFSDataset().getStorage(storageUuid); actor.getIbrManager().notifyNamenodeBlock(rdbi, s, false); }
/** * Inject a fake 'deleted' block into the BPServiceActor state. */ private void injectBlockDeleted() { ReceivedDeletedBlockInfo rdbi = new ReceivedDeletedBlockInfo( getDummyBlock(), BlockStatus.DELETED_BLOCK, null); actor.getIbrManager().addRDBI(rdbi, singletonDn.getFSDataset().getStorage(storageUuid)); }
ReceivedDeletedBlockInfo rdbi = new ReceivedDeletedBlockInfo( new Block(5678, 512, 1000), BlockStatus.DELETED_BLOCK, null); DataNode datanode = cluster.getDataNodes().get(0);
private ExtendedBlock addBlocks(String fileName, String clientName) throws IOException { ExtendedBlock prevBlock = null; for(int jdx = 0; jdx < blocksPerFile; jdx++) { LocatedBlock loc = addBlock(fileName, clientName, prevBlock, null, INodeId.GRANDFATHER_INODE_ID, null); prevBlock = loc.getBlock(); for(DatanodeInfo dnInfo : loc.getLocations()) { int dnIdx = Arrays.binarySearch(datanodes, dnInfo.getXferAddr()); datanodes[dnIdx].addBlock(loc.getBlock().getLocalBlock()); ReceivedDeletedBlockInfo[] rdBlocks = { new ReceivedDeletedBlockInfo( loc.getBlock().getLocalBlock(), ReceivedDeletedBlockInfo.BlockStatus.RECEIVED_BLOCK, null) }; StorageReceivedDeletedBlocks[] report = { new StorageReceivedDeletedBlocks( datanodes[dnIdx].storage.getStorageID(), rdBlocks) }; dataNodeProto.blockReceivedAndDeleted(datanodes[dnIdx].dnRegistration, bpid, report); } // IBRs are asynchronously processed by NameNode. The next // ClientProtocol#addBlock() may throw NotReplicatedYetException. } return prevBlock; }
rdbiList.add(new ReceivedDeletedBlockInfo(new Block(receivedBlock), ReceivedDeletedBlockInfo.BlockStatus.RECEIVED_BLOCK, null)); builder.add(new FinalizedReplica(receivedBlock, null, null)); rdbiList.add(new ReceivedDeletedBlockInfo(new Block(receivingBlock), ReceivedDeletedBlockInfo.BlockStatus.RECEIVING_BLOCK, null)); builder.add(new ReplicaBeingWritten(receivingBlock, null, null, null)); rdbiList.add(new ReceivedDeletedBlockInfo(new Block(receivingReceivedBlock), ReceivedDeletedBlockInfo.BlockStatus.RECEIVING_BLOCK, null)); rdbiList.add(new ReceivedDeletedBlockInfo(new Block(receivingReceivedBlock), ReceivedDeletedBlockInfo.BlockStatus.RECEIVED_BLOCK, null)); builder.add(new FinalizedReplica(receivingReceivedBlock, null, null)); rdbiList.add(new ReceivedDeletedBlockInfo( new Block(ReceivedDeletedBlockId), ReceivedDeletedBlockInfo.BlockStatus.RECEIVED_BLOCK, null)); rdbiList.add(new ReceivedDeletedBlockInfo( new Block(ReceivedDeletedBlockId), ReceivedDeletedBlockInfo.BlockStatus.DELETED_BLOCK, null));
/** * Transfer blocks to another data-node. * Just report on behalf of the other data-node * that the blocks have been received. */ private int transferBlocks( Block blocks[], DatanodeInfo xferTargets[][], String targetStorageIDs[][] ) throws IOException { for(int i = 0; i < blocks.length; i++) { DatanodeInfo blockTargets[] = xferTargets[i]; for(int t = 0; t < blockTargets.length; t++) { DatanodeInfo dnInfo = blockTargets[t]; String targetStorageID = targetStorageIDs[i][t]; DatanodeRegistration receivedDNReg; receivedDNReg = new DatanodeRegistration(dnInfo, new DataStorage(nsInfo), new ExportedBlockKeys(), VersionInfo.getVersion()); ReceivedDeletedBlockInfo[] rdBlocks = { new ReceivedDeletedBlockInfo( blocks[i], ReceivedDeletedBlockInfo.BlockStatus.RECEIVED_BLOCK, null) }; StorageReceivedDeletedBlocks[] report = { new StorageReceivedDeletedBlocks( targetStorageID, rdBlocks) }; dataNodeProto.blockReceivedAndDeleted(receivedDNReg, bpid, report); } } return blocks.length; } }
StorageReceivedDeletedBlocks[] report = { new StorageReceivedDeletedBlocks("Fake-storage-ID-Ignored", new ReceivedDeletedBlockInfo[] { new ReceivedDeletedBlockInfo( blocks[0], BlockStatus.RECEIVED_BLOCK, "") }) }; cluster.getNameNodeRpc().blockReceivedAndDeleted(dnR, poolId, report); StorageReceivedDeletedBlocks[] report = { new StorageReceivedDeletedBlocks("Fake-storage-ID-Ignored", new ReceivedDeletedBlockInfo[] { new ReceivedDeletedBlockInfo( blocks[0], BlockStatus.RECEIVED_BLOCK, "") }) }; cluster.getNameNodeRpc().blockReceivedAndDeleted(dnR, poolId, report);
rdbi[0] = new ReceivedDeletedBlockInfo(block.getBlock().getLocalBlock(), ReceivedDeletedBlockInfo.BlockStatus.DELETED_BLOCK, null); foundBlockOnStorage = true;
ReceivedDeletedBlockInfo[] blocks = { new ReceivedDeletedBlockInfo( new Block(0), ReceivedDeletedBlockInfo.BlockStatus.RECEIVED_BLOCK,