LeonGao91 commented on a change in pull request #2625:
URL: https://github.com/apache/hadoop/pull/2625#discussion_r566443106
##########
File path:
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/MountVolumeInfo.java
##########
@@ -102,9 +116,28 @@ boolean addVolume(FsVolumeImpl volume) {
return true;
}
-
void removeVolume(FsVolumeImpl target) {
storageTypeVolumeMap.remove(target.getStorageType());
+ capacityRatioMap.remove(target.getStorageType());
+ }
+
+ /**
+ * Set customize capacity ratio for a storage type.
+ * Return false if the value is too big.
+ */
+ boolean setCapacityRatio(StorageType storageType,
+ double capacityRatio) {
+ double leftover = 1;
+ for (Map.Entry<StorageType, Double> e : capacityRatioMap.entrySet()) {
+ if (e.getKey() != storageType) {
+ leftover -= e.getValue();
+ }
+ }
+ if (leftover < capacityRatio) {
+ return false;
+ }
+ capacityRatioMap.put(storageType, capacityRatio);
Review comment:
I think later it will be convenient when we add a feature to update the
capacity ratio without restarting datanode. It should be pretty harmless for
now.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]