private boolean isReplicaProvided(ReplicaInfo replicaInfo) { if (replicaInfo == null) { return false; } return replicaInfo.getVolume().getStorageType() == StorageType.PROVIDED; }
public ReplicaInfo build() throws IllegalArgumentException { ReplicaInfo info = null; if(volume != null && volume.getStorageType() == StorageType.PROVIDED) { info = buildProvidedReplica(); } else { info = buildLocalReplica(); } return info; } }
private void reportBadBlock(final BPOfferService bpos, final ExtendedBlock block, final String msg) { FsVolumeSpi volume = getFSDataset().getVolume(block); if (volume == null) { LOG.warn("Cannot find FsVolumeSpi to report bad block: " + block); return; } bpos.reportBadBlocks( block, volume.getStorageID(), volume.getStorageType()); LOG.warn(msg); }
@Override public V chooseVolume(final List<V> volumes, long blockSize, String storageId) throws IOException { if (volumes.size() < 1) { throw new DiskOutOfSpaceException("No more available volumes"); } // As all the items in volumes are with the same storage type, // so only need to get the storage type index of the first item in volumes StorageType storageType = volumes.get(0).getStorageType(); int index = storageType != null ? storageType.ordinal() : StorageType.DEFAULT.ordinal(); synchronized (syncLocks[index]) { return chooseVolume(index, volumes, blockSize); } }
@Override public V chooseVolume(List<V> volumes, long replicaSize, String storageId) throws IOException { if (volumes.size() < 1) { throw new DiskOutOfSpaceException("No more available volumes"); } // As all the items in volumes are with the same storage type, // so only need to get the storage type index of the first item in volumes StorageType storageType = volumes.get(0).getStorageType(); int index = storageType != null ? storageType.ordinal() : StorageType.DEFAULT.ordinal(); synchronized (syncLocks[index]) { return doChooseVolume(volumes, replicaSize, storageId); } }
/** * Report a bad block which is hosted on the local DN. * * @param block the bad block which is hosted on the local DN * @param volume the volume that block is stored in and the volume * must not be null * @throws IOException */ public void reportBadBlocks(ExtendedBlock block, FsVolumeSpi volume) throws IOException { BPOfferService bpos = getBPOSForBlock(block); bpos.reportBadBlocks( block, volume.getStorageID(), volume.getStorageType()); }
if (volumes.get(i).getStorageType() == StorageType.PROVIDED) {
for (ReplicaInfo b : volumeMap.replicas(bpid)) { if (b.getVolume().getStorageType() == StorageType.PROVIDED) { continue;
+ " expected length is " + block.getNumBytes()); if (replicaInfo.getVolume().getStorageType() == targetStorageType) { throw new ReplicaAlreadyExistsException("Replica " + replicaInfo + " already exists on storage " + targetStorageType); + replicaInfo.getVolume().getStorageType());
if (oldReplica != null) { LOG.info("Moved {} from StorageType {} to {}", block, oldReplica.getVolume().getStorageType(), storageType);
if (info.getVolume().getStorageType() != StorageType.PROVIDED && info.getBlockFile() == null) {
HdfsConstants.GRANDFATHER_GENERATION_STAMP; if (vol.getStorageType() == StorageType.PROVIDED) { if (memBlockInfo == null) {
private void reportBadBlock(final BPOfferService bpos, final ExtendedBlock block, final String msg) { FsVolumeSpi volume = getFSDataset().getVolume(block); if (volume == null) { LOG.warn("Cannot find FsVolumeSpi to report bad block: " + block); return; } bpos.reportBadBlocks( block, volume.getStorageID(), volume.getStorageType()); LOG.warn(msg); }
/** * Report a bad block which is hosted on the local DN. * * @param block the bad block which is hosted on the local DN * @param volume the volume that block is stored in and the volume * must not be null * @throws IOException */ public void reportBadBlocks(ExtendedBlock block, FsVolumeSpi volume) throws IOException { BPOfferService bpos = getBPOSForBlock(block); bpos.reportBadBlocks( block, volume.getStorageID(), volume.getStorageType()); }
/** * Report a bad block which is hosted on the local DN. * * @param block the bad block which is hosted on the local DN * @param volume the volume that block is stored in and the volume * must not be null * @throws IOException */ public void reportBadBlocks(ExtendedBlock block, FsVolumeSpi volume) throws IOException { BPOfferService bpos = getBPOSForBlock(block); bpos.reportBadBlocks( block, volume.getStorageID(), volume.getStorageType()); }
private void reportBadBlock(final BPOfferService bpos, final ExtendedBlock block, final String msg) { FsVolumeSpi volume = getFSDataset().getVolume(block); if (volume == null) { LOG.warn("Cannot find FsVolumeSpi to report bad block: " + block); return; } bpos.reportBadBlocks( block, volume.getStorageID(), volume.getStorageType()); LOG.warn(msg); }
if (volume.getStorageType() == RAM_DISK) { ((FsVolumeImpl) volume).setCapacityForTesting(ramDiskStorageLimit);
+ " expected length is " + block.getNumBytes()); if (replicaInfo.getVolume().getStorageType() == targetStorageType) { throw new ReplicaAlreadyExistsException("Replica " + replicaInfo + " already exists on storage " + targetStorageType); + replicaInfo.getVolume().getStorageType());
URI fileUri = storageDir.toURI(); String dirWithBlock = "[" + volumeWithBlock.getStorageType() + "]" + fileUri; String newDirs = dirWithBlock; for (String dir : oldDirs) {
bpos.reportBadBlocks(FAKE_BLOCK, mockFSDataset.getVolume(FAKE_BLOCK) .getStorageID(), mockFSDataset.getVolume(FAKE_BLOCK) .getStorageType()); bpos.reportBadBlocks(FAKE_BLOCK, mockFSDataset.getVolume(FAKE_BLOCK) .getStorageID(), mockFSDataset.getVolume(FAKE_BLOCK) .getStorageType()); Thread.sleep(10000); long difference = secondCallTime - firstCallTime;