private static long getCapacity(DatanodeStorageReport report, StorageType t) { long capacity = 0L; for(StorageReport r : report.getStorageReports()) { if (r.getStorage().getStorageType() == t) { capacity += r.getCapacity(); } } return capacity; }
private static long getMaxRemaining(DatanodeStorageReport report, StorageType t) { long max = 0L; for(StorageReport r : report.getStorageReports()) { if (r.getStorage().getStorageType() == t) { if (r.getRemaining() > max) { max = r.getRemaining(); } } } return max; }
StorageReport toStorageReport() { return new StorageReport( new DatanodeStorage(storageID, state, storageType), false, capacity, dfsUsed, remaining, blockPoolUsed, nonDfsUsed); }
void updateState(StorageReport r) { capacity = r.getCapacity(); dfsUsed = r.getDfsUsed(); nonDfsUsed = r.getNonDfsUsed(); remaining = r.getRemaining(); blockPoolUsed = r.getBlockPoolUsed(); }
BackupJournalManager(NamenodeRegistration bnReg, NamenodeRegistration nnReg) { journalInfo = new JournalInfo(nnReg.getLayoutVersion(), nnReg.getClusterID(), nnReg.getNamespaceID()); this.bnReg = bnReg; }
public void updateFromStorage(DatanodeStorage storage) { state = storage.getState(); storageType = storage.getStorageType(); }
/** @return blocks with locations. */ public BlocksWithLocations getBlocks(DatanodeInfo datanode, long size, long minBlockSize) throws IOException { return namenode.getBlocks(datanode, size, minBlockSize); }
@Override protected Void doWork() throws IOException { cachedActiveProxy.rollEditLog(); return null; } };
@Override public Long apply(RemoteEditLog log) { if (null == log) { return HdfsServerConstants.INVALID_TXID; } return log.getStartTxId(); } };
@Override // NodeRegistration public String getAddress() { return getXferAddr(); }
@Override public boolean equals(Object o) { if (!(o instanceof RemoteEditLog)) return false; return this.compareTo((RemoteEditLog)o) == 0; }
public RemoteEditLogManifest(List<RemoteEditLog> logs, long committedTxnId) { this.logs = logs; this.committedTxnId = committedTxnId; checkState(); }
public static BlockStatus fromCode(int code) { for (BlockStatus bs : BlockStatus.values()) { if (bs.code == code) { return bs; } } return null; } }
void startLogSegment(long txId) throws IOException { backupNode.startLogSegment(journalInfo, 0, txId); } }
Capability(boolean isSupported) { supported = isSupported; int bits = ordinal() - 1; mask = (bits < 0) ? 0 : (1L << bits); } public long getMask() {
@Override Double getUtilization(DatanodeStorageReport r, final StorageType t) { long capacity = 0L; long dfsUsed = 0L; for(StorageReport s : r.getStorageReports()) { if (s.getStorage().getStorageType() == t) { capacity += s.getCapacity(); dfsUsed += s.getDfsUsed(); } } return capacity == 0L? null: dfsUsed*100.0/capacity; } }
private long getRemaining(DatanodeStorageReport report, StorageType t) { long remaining = 0L; for(StorageReport r : report.getStorageReports()) { if (r.getStorage().getStorageType() == t) { if (r.getRemaining() >= defaultBlockSize) { remaining += r.getRemaining(); } } } return remaining; }
@Override Double getUtilization(DatanodeStorageReport r, final StorageType t) { long capacity = 0L; long blockPoolUsed = 0L; for(StorageReport s : r.getStorageReports()) { if (s.getStorage().getStorageType() == t) { capacity += s.getCapacity(); blockPoolUsed += s.getBlockPoolUsed(); } } return capacity == 0L? null: blockPoolUsed*100.0/capacity; } }
@Override void accumulateSpaces(DatanodeStorageReport r) { for(StorageReport s : r.getStorageReports()) { final StorageType t = s.getStorage().getStorageType(); totalCapacities.add(t, s.getCapacity()); totalUsedSpaces.add(t, s.getDfsUsed()); } }
@Override void accumulateSpaces(DatanodeStorageReport r) { for(StorageReport s : r.getStorageReports()) { final StorageType t = s.getStorage().getStorageType(); totalCapacities.add(t, s.getCapacity()); totalUsedSpaces.add(t, s.getBlockPoolUsed()); } }