This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 07639859ec HDDS-10504. Remove unused VolumeInfo#configuredCapacity 
(#6363)
07639859ec is described below

commit 07639859ec4a48ae97d6e933475991c8dda9e4ca
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Mon Mar 11 15:49:05 2024 +0100

    HDDS-10504. Remove unused VolumeInfo#configuredCapacity (#6363)
---
 .../ozone/container/common/volume/VolumeInfo.java     | 19 +------------------
 .../ozone/container/common/volume/VolumeUsage.java    |  6 +-----
 2 files changed, 2 insertions(+), 23 deletions(-)

diff --git 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeInfo.java
 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeInfo.java
index 6ee35ba6b0..0fde0903c2 100644
--- 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeInfo.java
+++ 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeInfo.java
@@ -100,11 +100,6 @@ public final class VolumeInfo {
   // Space usage calculator
   private final VolumeUsage usage;
 
-  // Capacity configured. This is useful when we want to
-  // limit the visible capacity for tests. If negative, then we just
-  // query from the filesystem.
-  private long configuredCapacity;
-
   private long reservedInBytes;
 
   /**
@@ -115,7 +110,6 @@ public final class VolumeInfo {
     private final String rootDir;
     private SpaceUsageCheckFactory usageCheckFactory;
     private StorageType storageType;
-    private long configuredCapacity;
 
     public Builder(String root, ConfigurationSource config) {
       this.rootDir = root;
@@ -127,11 +121,6 @@ public final class VolumeInfo {
       return this;
     }
 
-    public Builder configuredCapacity(long capacity) {
-      this.configuredCapacity = capacity;
-      return this;
-    }
-
     public Builder usageCheckFactory(SpaceUsageCheckFactory factory) {
       this.usageCheckFactory = factory;
       return this;
@@ -206,9 +195,6 @@ public final class VolumeInfo {
     this.storageType = (b.storageType != null ?
         b.storageType : StorageType.DEFAULT);
 
-    this.configuredCapacity = (b.configuredCapacity != 0 ?
-        b.configuredCapacity : -1);
-
     SpaceUsageCheckFactory usageCheckFactory = b.usageCheckFactory;
     if (usageCheckFactory == null) {
       usageCheckFactory = SpaceUsageCheckFactory.create(b.conf);
@@ -222,10 +208,7 @@ public final class VolumeInfo {
   }
 
   public long getCapacity() {
-    if (configuredCapacity < 0) {
-      return Math.max(usage.getCapacity() - reservedInBytes, 0);
-    }
-    return configuredCapacity;
+    return Math.max(usage.getCapacity() - reservedInBytes, 0);
   }
 
   /**
diff --git 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeUsage.java
 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeUsage.java
index b2a66ba16b..eafce1b4c4 100644
--- 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeUsage.java
+++ 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeUsage.java
@@ -34,7 +34,7 @@ import static 
org.apache.hadoop.hdds.HddsConfigKeys.HDDS_DATANODE_VOLUME_MIN_FRE
  * Class that wraps the space df of the Datanode Volumes used by SCM
  * containers.
  */
-public class VolumeUsage implements SpaceUsageSource {
+public class VolumeUsage {
 
   private final CachingSpaceUsageSource source;
   private boolean shutdownComplete;
@@ -47,7 +47,6 @@ public class VolumeUsage implements SpaceUsageSource {
     start(); // TODO should start only on demand
   }
 
-  @Override
   public long getCapacity() {
     return Math.max(source.getCapacity(), 0);
   }
@@ -60,7 +59,6 @@ public class VolumeUsage implements SpaceUsageSource {
    *                      remainingReserved
    * B) avail = fsAvail - Max(reserved - other, 0);
    */
-  @Override
   public long getAvailable() {
     return source.getAvailable() - getRemainingReserved();
   }
@@ -70,12 +68,10 @@ public class VolumeUsage implements SpaceUsageSource {
     return available - getRemainingReserved(precomputedVolumeSpace);
   }
 
-  @Override
   public long getUsedSpace() {
     return source.getUsedSpace();
   }
 
-  @Override
   public SpaceUsageSource snapshot() {
     return source.snapshot();
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to