DatanodeStorage toDatanodeStorage() { return new DatanodeStorage(storageID, DatanodeStorage.State.NORMAL, storageType); }
/** * @deprecated Use {@link #StorageReceivedDeletedBlocks( * DatanodeStorage, ReceivedDeletedBlockInfo[])} instead */ @Deprecated public StorageReceivedDeletedBlocks(final String storageID, final ReceivedDeletedBlockInfo[] blocks) { this.storage = new DatanodeStorage(storageID); this.blocks = blocks; }
StorageReport toStorageReport() { return new StorageReport( new DatanodeStorage(storageID, state, storageType), false, capacity, dfsUsed, remaining, blockPoolUsed, nonDfsUsed); }
ProvidedStorageMap(RwLock lock, BlockManager bm, Configuration conf) throws IOException { storageId = conf.get(DFSConfigKeys.DFS_PROVIDER_STORAGEUUID, DFSConfigKeys.DFS_PROVIDER_STORAGEUUID_DEFAULT); providedEnabled = conf.getBoolean( DFSConfigKeys.DFS_NAMENODE_PROVIDED_ENABLED, DFSConfigKeys.DFS_NAMENODE_PROVIDED_ENABLED_DEFAULT); if (!providedEnabled) { // disable mapping aliasMap = null; providedDescriptor = null; providedStorageInfo = null; return; } DatanodeStorage ds = new DatanodeStorage( storageId, State.NORMAL, StorageType.PROVIDED); providedDescriptor = new ProvidedDescriptor(); providedStorageInfo = providedDescriptor.createProvidedStorage(ds); this.defaultReplication = conf.getInt(DFSConfigKeys.DFS_REPLICATION_KEY, DFSConfigKeys.DFS_REPLICATION_DEFAULT); this.bm = bm; this.lock = lock; // load block reader into storage Class<? extends BlockAliasMap> aliasMapClass = conf.getClass( DFSConfigKeys.DFS_PROVIDED_ALIASMAP_CLASS, TextFileRegionAliasMap.class, BlockAliasMap.class); aliasMap = ReflectionUtils.newInstance(aliasMapClass, conf); LOG.info("Loaded alias map class: " + aliasMap.getClass() + " storage: " + providedStorageInfo); }
/** * Activate a volume to serve requests. * @throws IOException if the storage UUID already exists. */ private void activateVolume( ReplicaMap replicaMap, Storage.StorageDirectory sd, StorageType storageType, FsVolumeReference ref) throws IOException { try (AutoCloseableLock lock = datasetLock.acquire()) { DatanodeStorage dnStorage = storageMap.get(sd.getStorageUuid()); if (dnStorage != null) { final String errorMsg = String.format( "Found duplicated storage UUID: %s in %s.", sd.getStorageUuid(), sd.getVersionFile()); LOG.error(errorMsg); throw new IOException(errorMsg); } volumeMap.addAll(replicaMap); storageMap.put(sd.getStorageUuid(), new DatanodeStorage(sd.getStorageUuid(), DatanodeStorage.State.NORMAL, storageType)); asyncDiskService.addVolume((FsVolumeImpl) ref.getVolume()); volumes.addVolume(ref); } }
} else { info[i] = new StorageReceivedDeletedBlocks( new DatanodeStorage(sBlock.getStorageUuid()), rdBlocks);
@Deprecated public StorageReceivedDeletedBlocks(final String storageID, final ReceivedDeletedBlockInfo[] blocks) { this.storage = new DatanodeStorage(storageID); this.blocks = blocks; }
@Deprecated public StorageReceivedDeletedBlocks(final String storageID, final ReceivedDeletedBlockInfo[] blocks) { this.storage = new DatanodeStorage(storageID); this.blocks = blocks; }
SimulatedStorage(long cap, DatanodeStorage.State state) { capacity = cap; dnStorage = new DatanodeStorage( "SimulatedStorage-" + DatanodeStorage.generateUuid(), state, StorageType.DEFAULT); this.volume = new SimulatedVolume(this); }
SimulatedStorage(long cap, DatanodeStorage.State state) { capacity = cap; dnStorage = new DatanodeStorage( "SimulatedStorage-" + DatanodeStorage.generateUuid(), state, StorageType.DEFAULT); }
public static DatanodeDescriptor getDatanodeDescriptor(String ipAddr, String rackLocation, boolean initializeStorage) { return getDatanodeDescriptor(ipAddr, rackLocation, initializeStorage? new DatanodeStorage(DatanodeStorage.generateUuid()): null); }
public static DatanodeStorage convert(DatanodeStorageProto s) { return new DatanodeStorage(s.getStorageUuid(), PBHelper.convertState(s.getState()), PBHelper.convertStorageType(s.getStorageType())); }
public static DatanodeStorage convert(DatanodeStorageProto s) { return new DatanodeStorage(s.getStorageUuid(), convertState(s.getState()), convertStorageType(s.getStorageType())); }
public static DatanodeStorageInfo createDatanodeStorageInfo( String storageID, String ip, String rack, String hostname, StorageType type) { final DatanodeStorage storage = new DatanodeStorage(storageID, DatanodeStorage.State.NORMAL, type); final DatanodeDescriptor dn = BlockManagerTestUtil.getDatanodeDescriptor( ip, rack, storage, hostname); return BlockManagerTestUtil.newDatanodeStorageInfo(dn, storage); }
public static DatanodeStorage convert(DatanodeStorageProto s) { return new DatanodeStorage(s.getStorageUuid(), PBHelper.convertState(s.getState()), PBHelper.convertStorageType(s.getStorageType())); }
public static StorageReport convert(StorageReportProto p) { long nonDfsUsed = p.hasNonDfsUsed() ? p.getNonDfsUsed() : p.getCapacity() - p.getDfsUsed() - p.getRemaining(); return new StorageReport(p.hasStorage() ? convert(p.getStorage()) : new DatanodeStorage(p.getStorageUuid()), p.getFailed(), p.getCapacity(), p.getDfsUsed(), p.getRemaining(), p.getBlockPoolUsed(), nonDfsUsed); }
public static StorageReport convert(StorageReportProto p) { long nonDfsUsed = p.hasNonDfsUsed() ? p.getNonDfsUsed() : p.getCapacity() - p.getDfsUsed() - p.getRemaining(); return new StorageReport(p.hasStorage() ? convert(p.getStorage()) : new DatanodeStorage(p.getStorageUuid()), p.getFailed(), p.getCapacity(), p.getDfsUsed(), p.getRemaining(), p.getBlockPoolUsed(), nonDfsUsed); }
public static StorageReport convert(StorageReportProto p) { long nonDfsUsed = p.hasNonDfsUsed() ? p.getNonDfsUsed() : p.getCapacity() - p.getDfsUsed() - p.getRemaining(); return new StorageReport(p.hasStorage() ? convert(p.getStorage()) : new DatanodeStorage(p.getStorageUuid()), p.getFailed(), p.getCapacity(), p.getDfsUsed(), p.getRemaining(), p.getBlockPoolUsed(), nonDfsUsed); }
@Test public void TestConvertDatanodeStorage() { DatanodeStorage dns1 = new DatanodeStorage( "id1", DatanodeStorage.State.NORMAL, StorageType.SSD); DatanodeStorageProto proto = PBHelper.convert(dns1); DatanodeStorage dns2 = PBHelper.convert(proto); compare(dns1, dns2); }
public static DatanodeDescriptor getLocalDatanodeDescriptor( boolean initializeStorage) { DatanodeDescriptor dn = new DatanodeDescriptor(DFSTestUtil.getLocalDatanodeID()); if (initializeStorage) { dn.updateStorage(new DatanodeStorage(DatanodeStorage.generateUuid())); } return dn; }