@Override public boolean equals(Object o) { if (!(o instanceof ReceivedDeletedBlockInfo)) { return false; } ReceivedDeletedBlockInfo other = (ReceivedDeletedBlockInfo) o; return this.block.equals(other.getBlock()) && this.status == other.status && this.delHints != null && this.delHints.equals(other.delHints); }
/** Put the block to this IBR. */ void put(ReceivedDeletedBlockInfo rdbi) { blocks.put(rdbi.getBlock(), rdbi); increaseBlocksCounter(rdbi); }
/** * Put the all blocks to this IBR unless the block already exists. * @param rdbis list of blocks to add. * @return the number of missing blocks added. */ int putMissing(ReceivedDeletedBlockInfo[] rdbis) { int count = 0; for (ReceivedDeletedBlockInfo rdbi : rdbis) { if (!blocks.containsKey(rdbi.getBlock())) { put(rdbi); count++; } } return count; } }
/** * Add a block for notification to NameNode. * If another entry exists for the same block it is removed. */ @VisibleForTesting synchronized void addRDBI(ReceivedDeletedBlockInfo rdbi, DatanodeStorage storage) { // Make sure another entry for the same block is first removed. // There may only be one such entry. for (PerStorageIBR perStorage : pendingIBRs.values()) { if (perStorage.remove(rdbi.getBlock()) != null) { break; } } getPerStorageIBR(storage).put(rdbi); }
switch (rdbi.getStatus()) { case DELETED_BLOCK: removeStoredBlock(storageInfo, rdbi.getBlock(), node); deleted++; break; case RECEIVED_BLOCK: addBlock(storageInfo, rdbi.getBlock(), rdbi.getDelHints()); received++; break; case RECEIVING_BLOCK: receiving++; processAndHandleReportedBlock(storageInfo, rdbi.getBlock(), ReplicaState.RBW, null); break; rdbi.getStatus(), rdbi.getBlock(), node);
public static ReceivedDeletedBlockInfoProto convert( ReceivedDeletedBlockInfo receivedDeletedBlockInfo) { ReceivedDeletedBlockInfoProto.Builder builder = ReceivedDeletedBlockInfoProto.newBuilder(); ReceivedDeletedBlockInfoProto.BlockStatus status; switch (receivedDeletedBlockInfo.getStatus()) { case RECEIVING_BLOCK: status = ReceivedDeletedBlockInfoProto.BlockStatus.RECEIVING; break; case RECEIVED_BLOCK: status = ReceivedDeletedBlockInfoProto.BlockStatus.RECEIVED; break; case DELETED_BLOCK: status = ReceivedDeletedBlockInfoProto.BlockStatus.DELETED; break; default: throw new IllegalArgumentException("Bad status: " + receivedDeletedBlockInfo.getStatus()); } builder.setStatus(status); if (receivedDeletedBlockInfo.getDelHints() != null) { builder.setDeleteHint(receivedDeletedBlockInfo.getDelHints()); } return builder.setBlock( PBHelperClient.convert(receivedDeletedBlockInfo.getBlock())).build(); }
/** Put the block to this IBR. */ void put(ReceivedDeletedBlockInfo rdbi) { blocks.put(rdbi.getBlock(), rdbi); }
/** Put the block to this IBR. */ void put(ReceivedDeletedBlockInfo rdbi) { blocks.put(rdbi.getBlock(), rdbi); }
public boolean equals(Object o){ if (!(o instanceof ReceivedDeletedBlockInfo)) { return false; } ReceivedDeletedBlockInfo other = (ReceivedDeletedBlockInfo)o; return this.block.equals(other.getBlock()) && (this.delHints.equals(other.delHints) || this.delHints.equals(WILDCARD_HINT) || other.delHints.equals(WILDCARD_HINT)); }
@Override public boolean equals(Object o) { if (!(o instanceof ReceivedDeletedBlockInfo)) { return false; } ReceivedDeletedBlockInfo other = (ReceivedDeletedBlockInfo) o; return this.block.equals(other.getBlock()) && this.status == other.status && this.delHints != null && this.delHints.equals(other.delHints); }
@Override public boolean equals(Object o) { if (!(o instanceof ReceivedDeletedBlockInfo)) { return false; } ReceivedDeletedBlockInfo other = (ReceivedDeletedBlockInfo) o; return this.block.equals(other.getBlock()) && this.status == other.status && this.delHints != null && this.delHints.equals(other.delHints); }
/** * Put the all blocks to this IBR unless the block already exists. * @param rdbis list of blocks to add. * @return the number of missing blocks added. */ int putMissing(ReceivedDeletedBlockInfo[] rdbis) { int count = 0; for (ReceivedDeletedBlockInfo rdbi : rdbis) { if (!blocks.containsKey(rdbi.getBlock())) { put(rdbi); count++; } } return count; } }
/** * Put the all blocks to this IBR unless the block already exists. * @param rdbis list of blocks to add. * @return the number of missing blocks added. */ int putMissing(ReceivedDeletedBlockInfo[] rdbis) { int count = 0; for (ReceivedDeletedBlockInfo rdbi : rdbis) { if (!blocks.containsKey(rdbi.getBlock())) { put(rdbi); count++; } } return count; } }
/** * Add a block for notification to NameNode. * If another entry exists for the same block it is removed. */ @VisibleForTesting synchronized void addRDBI(ReceivedDeletedBlockInfo rdbi, DatanodeStorage storage) { // Make sure another entry for the same block is first removed. // There may only be one such entry. for (PerStorageIBR perStorage : pendingIBRs.values()) { if (perStorage.remove(rdbi.getBlock()) != null) { break; } } getPerStorageIBR(storage).put(rdbi); }
/** * Add a block for notification to NameNode. * If another entry exists for the same block it is removed. */ @VisibleForTesting synchronized void addRDBI(ReceivedDeletedBlockInfo rdbi, DatanodeStorage storage) { // Make sure another entry for the same block is first removed. // There may only be one such entry. for (PerStorageIBR perStorage : pendingIBRs.values()) { if (perStorage.remove(rdbi.getBlock()) != null) { break; } } getPerStorageIBR(storage).put(rdbi); }
switch (rdbi.getStatus()) { case DELETED_BLOCK: removeStoredBlock(storageInfo, rdbi.getBlock(), node); deleted++; break; case RECEIVED_BLOCK: addBlock(storageInfo, rdbi.getBlock(), rdbi.getDelHints()); received++; break; case RECEIVING_BLOCK: receiving++; processAndHandleReportedBlock(storageInfo, rdbi.getBlock(), ReplicaState.RBW, null); break; rdbi.getStatus(), rdbi.getBlock(), node);
switch (rdbi.getStatus()) { case DELETED_BLOCK: removeStoredBlock(storageInfo, rdbi.getBlock(), node); deleted++; break; case RECEIVED_BLOCK: addBlock(storageInfo, rdbi.getBlock(), rdbi.getDelHints()); received++; break; case RECEIVING_BLOCK: receiving++; processAndHandleReportedBlock(storageInfo, rdbi.getBlock(), ReplicaState.RBW, null); break; rdbi.getStatus(), rdbi.getBlock(), node);
public static ReceivedDeletedBlockInfoProto convert( ReceivedDeletedBlockInfo receivedDeletedBlockInfo) { ReceivedDeletedBlockInfoProto.Builder builder = ReceivedDeletedBlockInfoProto.newBuilder(); ReceivedDeletedBlockInfoProto.BlockStatus status; switch (receivedDeletedBlockInfo.getStatus()) { case RECEIVING_BLOCK: status = ReceivedDeletedBlockInfoProto.BlockStatus.RECEIVING; break; case RECEIVED_BLOCK: status = ReceivedDeletedBlockInfoProto.BlockStatus.RECEIVED; break; case DELETED_BLOCK: status = ReceivedDeletedBlockInfoProto.BlockStatus.DELETED; break; default: throw new IllegalArgumentException("Bad status: " + receivedDeletedBlockInfo.getStatus()); } builder.setStatus(status); if (receivedDeletedBlockInfo.getDelHints() != null) { builder.setDeleteHint(receivedDeletedBlockInfo.getDelHints()); } return builder.setBlock(PBHelper.convert(receivedDeletedBlockInfo.getBlock())) .build(); }
public static ReceivedDeletedBlockInfoProto convert( ReceivedDeletedBlockInfo receivedDeletedBlockInfo) { ReceivedDeletedBlockInfoProto.Builder builder = ReceivedDeletedBlockInfoProto.newBuilder(); ReceivedDeletedBlockInfoProto.BlockStatus status; switch (receivedDeletedBlockInfo.getStatus()) { case RECEIVING_BLOCK: status = ReceivedDeletedBlockInfoProto.BlockStatus.RECEIVING; break; case RECEIVED_BLOCK: status = ReceivedDeletedBlockInfoProto.BlockStatus.RECEIVED; break; case DELETED_BLOCK: status = ReceivedDeletedBlockInfoProto.BlockStatus.DELETED; break; default: throw new IllegalArgumentException("Bad status: " + receivedDeletedBlockInfo.getStatus()); } builder.setStatus(status); if (receivedDeletedBlockInfo.getDelHints() != null) { builder.setDeleteHint(receivedDeletedBlockInfo.getDelHints()); } return builder.setBlock(PBHelper.convert(receivedDeletedBlockInfo.getBlock())) .build(); }