private int findStorageInfoFromEnd(DatanodeStorageInfo storage) { final int len = getCapacity(); for(int idx = len - 1; idx >= 0; idx--) { DatanodeStorageInfo cur = getStorageInfo(idx); if (storage.equals(cur)) { return idx; } } return -1; }
@Override boolean addStorage(DatanodeStorageInfo storage, Block reportedBlock) { Preconditions.checkArgument(BlockIdManager.isStripedBlockID( reportedBlock.getBlockId()), "reportedBlock is not striped"); Preconditions.checkArgument(BlockIdManager.convertToStripedID( reportedBlock.getBlockId()) == this.getBlockId(), "reported blk_%s does not belong to the group of stored blk_%s", reportedBlock.getBlockId(), this.getBlockId()); int blockIndex = BlockIdManager.getBlockIndex(reportedBlock); int index = blockIndex; DatanodeStorageInfo old = getStorageInfo(index); if (old != null && !old.equals(storage)) { // over replicated // check if the storage has been stored int i = findStorageInfo(storage); if (i == -1) { index = findSlot(); } else { return true; } } addStorage(storage, index, blockIndex); return true; }
if (newStorages != null) { for (DatanodeStorageInfo newStorage : newStorages) { if (newStorage!= null && storage.equals(newStorage)) { isCorrupt = false; break;
if (newStorages != null) { for (DatanodeStorageInfo newStorage : newStorages) { if (newStorage!= null && storage.equals(newStorage)) { isCorrupt = false; break;
for(; i < targets.length && !storages[2].equals(targets[i]); i++); assertTrue(i < targets.length);
for (; i < targets.length && !storages[2].equals(targets[i]); i++); assertTrue(i < targets.length);
if (newStorages != null) { for (DatanodeStorageInfo newStorage : newStorages) { if (newStorage!= null && storage.equals(newStorage)) { isCorrupt = false; break;