storage = s; long r = s.getRemaining(); if (r >= requiredSize) { remaining += r;
long free = storage.getRemaining(); long lastHeartbeat = node.getLastUpdateMonotonic(); if (lastHeartbeat < oldestHeartbeat) {
void subtractStorage(final DatanodeStorageInfo info, final DatanodeDescriptor node) { assert storageType == info.getStorageType(); capacityUsed -= info.getDfsUsed(); capacityNonDfsUsed -= info.getNonDfsUsed(); blockPoolUsed -= info.getBlockPoolUsed(); if (node.isInService()) { capacityTotal -= info.getCapacity(); capacityRemaining -= info.getRemaining(); } else { capacityTotal -= info.getDfsUsed(); } }
void addStorage(final DatanodeStorageInfo info, final DatanodeDescriptor node) { assert storageType == info.getStorageType(); capacityUsed += info.getDfsUsed(); capacityNonDfsUsed += info.getNonDfsUsed(); blockPoolUsed += info.getBlockPoolUsed(); if (node.isInService()) { capacityTotal += info.getCapacity(); capacityRemaining += info.getRemaining(); } else { capacityTotal += info.getDfsUsed(); } }
/** * Return the sum of remaining spaces of the specified type. If the remaining * space of a storage is less than minSize, it won't be counted toward the * sum. * * @param t The storage type. If null, the type is ignored. * @param minSize The minimum free space required. * @return the sum of remaining spaces that are bigger than minSize. */ public long getRemaining(StorageType t, long minSize) { long remaining = 0; for (DatanodeStorageInfo s : getStorageInfos()) { if (s.getState() == State.NORMAL && (t == null || s.getStorageType() == t)) { long r = s.getRemaining(); if (r >= minSize) { remaining += r; } } } return remaining; }
/** * Return the sum of remaining spaces of the specified type. If the remaining * space of a storage is less than minSize, it won't be counted toward the * sum. * * @param t The storage type. If null, the type is ignored. * @param minSize The minimum free space required. * @return the sum of remaining spaces that are bigger than minSize. */ public long getRemaining(StorageType t, long minSize) { long remaining = 0; for (DatanodeStorageInfo s : getStorageInfos()) { if (s.getState() == State.NORMAL && (t == null || s.getStorageType() == t)) { long r = s.getRemaining(); if (r >= minSize) { remaining += r; } } } return remaining; }
public static StorageReport[] getStorageReportsForDatanode( DatanodeDescriptor dnd) { ArrayList<StorageReport> reports = new ArrayList<StorageReport>(); for (DatanodeStorageInfo storage : dnd.getStorageInfos()) { DatanodeStorage dns = new DatanodeStorage( storage.getStorageID(), storage.getState(), storage.getStorageType()); StorageReport report = new StorageReport( dns ,false, storage.getCapacity(), storage.getDfsUsed(), storage.getRemaining(), storage.getBlockPoolUsed(), 0L); reports.add(report); } return reports.toArray(StorageReport.EMPTY_ARRAY); }