You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "priyeshkaratha (via GitHub)" <gi...@apache.org> on 2026/02/10 16:22:37 UTC

[PR] HDDS-14552. [Recon] Improve Ozone Capacity Reporting with Reserved Space and FS Capacity Breakdown [ozone]

priyeshkaratha opened a new pull request, #9742:
URL: https://github.com/apache/ozone/pull/9742

   ## What changes were proposed in this pull request?
   This pull request significantly enhances the storage reporting capabilities within Recon by introducing a more detailed GlobalStorageReport. The changes involve refactoring the data model to include granular metrics like reserved space and file system capacity, updating the backend endpoint to populate these new fields, and modifying the frontend to accurately display this expanded information. This provides users with a more comprehensive understanding of their Ozone cluster's storage utilization.
   
   ## What is the link to the Apache JIRA
   
   [HDDS-14552](https://issues.apache.org/jira/browse/HDDS-14552)
   
   ## How was this patch tested?
   
   API changes tested using unit testing.
   UI tested manually.
   <img width="3414" height="1734" alt="image" src="https://github.com/user-attachments/assets/a52808d3-cb96-4ebb-b905-8b98db6183c5" />
   
   
   


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-14552. [Recon] Improve Ozone Capacity Reporting with Reserved Space and FS Capacity Breakdown [ozone]

Posted by "ArafatKhan2198 (via GitHub)" <gi...@apache.org>.
ArafatKhan2198 commented on code in PR #9742:
URL: https://github.com/apache/ozone/pull/9742#discussion_r2850996535


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/GlobalStorageReport.java:
##########
@@ -29,33 +29,125 @@
  */
 public class GlobalStorageReport {
 
-  @JsonProperty("totalUsedSpace")
-  private long totalUsedSpace;
+  @JsonProperty("totalFileSystemCapacity")
+  private long totalFileSystemCapacity;
 
-  @JsonProperty("totalFreeSpace")
-  private long totalFreeSpace;
+  @JsonProperty("totalReservedSpace")
+  private long totalReservedSpace;
 
-  @JsonProperty("totalCapacity")
-  private long totalCapacity;
+  @JsonProperty("totalOzoneCapacity")
+  private long totalOzoneCapacity;
 
-  public GlobalStorageReport() {
+  @JsonProperty("totalOzoneUsedSpace")
+  private long totalOzoneUsedSpace;
+
+  @JsonProperty("totalOzoneFreeSpace")
+  private long totalOzoneFreeSpace;
+
+  @JsonProperty("totalOzonePreAllocatedContainerSpace")
+  private long totalOzonePreAllocatedContainerSpace;
+
+  @JsonProperty("totalMinimumFreeSpace")
+  private long totalMinimumFreeSpace;
+
+  public long getTotalFileSystemCapacity() {
+    return totalFileSystemCapacity;
+  }
+
+  public long getTotalReservedSpace() {
+    return totalReservedSpace;
+  }
+
+  public long getTotalOzoneCapacity() {
+    return totalOzoneCapacity;
+  }
+
+  public long getTotalOzoneUsedSpace() {
+    return totalOzoneUsedSpace;
+  }
+
+  public long getTotalOzoneFreeSpace() {
+    return totalOzoneFreeSpace;
   }
 
-  public GlobalStorageReport(long totalUsedSpace, long totalFreeSpace, long totalCapacity) {
-    this.totalUsedSpace = totalUsedSpace;
-    this.totalFreeSpace = totalFreeSpace;
-    this.totalCapacity = totalCapacity;
+  public long getTotalOzonePreAllocatedContainerSpace() {
+    return totalOzonePreAllocatedContainerSpace;
   }
 
-  public long getTotalUsedSpace() {
-    return totalUsedSpace;
+  public long getTotalMinimumFreeSpace() {
+    return totalMinimumFreeSpace;
   }
 
-  public long getTotalFreeSpace() {
-    return totalFreeSpace;
+  public GlobalStorageReport() {
+  }
+
+  public GlobalStorageReport(Builder builder) {
+    this.totalFileSystemCapacity = builder.totalReservedSpace + builder.totalOzoneCapacity;

Review Comment:
   Is this formula correct and shoudn't the value be aggregated from `DatanodeStorageReport.filesystemCapacity`



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/db.json:
##########
@@ -6869,18 +6869,20 @@
   },
   "utilization": {
     "globalStorage": {
-        "totalUsedSpace": 30679040,
-        "totalFreeSpace": 539776978944,
-        "totalCapacity": 879519597390
+      "totalFileSystemCapacity": 879788032846,
+      "totalReservedSpace": 268435456,
+      "totalOzoneCapacity": 879519597390,
+      "totalOzoneFreeSpace": 539776978944,
+      "totalOzoneUsedSpace": 30679040,
+      "totalOzonePreAllocatedContainerSpace":1022024
     },
     "globalNamespace": {
         "totalUsedSpace": 12349932,
         "totalKeys": 1576
     },
     "usedSpaceBreakdown": {
         "openKeyBytes": 19255266,
-        "committedKeyBytes": 1249923,
-        "preAllocatedContainerBytes": 1022024

Review Comment:
   Before this PR, `CONTAINER PRE-ALLOCATED` on the frontend read from `usedSpaceBreakdown.preAllocatedContainerBytes`. This PR moves it to `globalStorage.totalOzonePreAllocatedContainerSpace` instead, and removes `preAllocatedContainerBytes` from the TypeScript type.
   
   However, the backend was never updated to match. `UsedSpaceBreakDown.java` still has the field declared, and the endpoint still computes the value and includes it in the JSON response. So the API is still sending something like:
   
   ```json
   "usedSpaceBreakdown": {
     "openKeyBytes": 123,
     "committedKeyBytes": 456,
     "preAllocatedContainerBytes": 789   <-- still here, nobody reads it
   }
   ```
   
   The frontend just ignores it now since the TypeScript type no longer has that property. It's not a runtime bug the UI works fine but it's dead weight in the API response and misleading to anyone reading the backend code, because the field looks like it's being used but it isn't. 



##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/GlobalStorageReport.java:
##########
@@ -29,33 +29,125 @@
  */
 public class GlobalStorageReport {
 
-  @JsonProperty("totalUsedSpace")
-  private long totalUsedSpace;
+  @JsonProperty("totalFileSystemCapacity")
+  private long totalFileSystemCapacity;

Review Comment:
   `GlobalStorageReport.java` — `totalFileSystemCapacity` is computed incorrectly
   The constructor derives `totalFileSystemCapacity` as `reserved + ozoneCapacity`, but this is an approximation, not the real filesystem capacity. The actual FS capacity is the OS-reported disk size per datanode (getFsCapacity()), which is already being fetched in getStorageReport() and stored in DatanodeStorageReport.filesystemCapacity.
   
   
   This will also cause the integration test to fail since it validates against the real per-datanode sum it accumulates `scmReport.getFsCapacity()` across datanodes and asserts it equals `storageResponse.getGlobalStorage().getTotalFileSystemCapacity()`. Since the endpoint returns reserved + ozoneCapacity instead, these two values will differ.
   
   The fix is to not compute it implicitly in the constructor. Add setTotalFileSystemCapacity() to the Builder, then in the endpoint aggregate it from the already-collected nodeStorageReports using mapToLong(DatanodeStorageReport::getFilesystemCapacity).sum() and pass it in explicitly. Since nodeStorageReports is collected before calculateGlobalStorageReport() is called, this just requires passing the list into that method or reordering the aggregation slightly.
   
   Please correct me if any of my assumptions are Incorrect.



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/__tests__/mocks/capacityMocks/capacityResponseMocks.ts:
##########
@@ -18,18 +18,20 @@
 
 export const StorageDistribution = {
   globalStorage: {
-    totalUsedSpace: 4096,
-    totalFreeSpace: 4096,
-    totalCapacity: 10240
+    totalFileSystemCapacity : 11264,
+    totalOzoneUsedSpace: 4096,
+    totalOzoneFreeSpace: 4096,
+    totalOzoneCapacity: 10240,
+    totalReservedSpace:1024,
+    totalOzonePreAllocatedContainerSpace: 1024

Review Comment:
   Minor - Spacing inconsistencies in mock/constants. 
   
   ```
   totalReservedSpace:1024,              // missing space after colon
   totalFileSystemCapacity : 11264,      // extra space before colon
   totalOzonePreAllocatedContainerSpace:1022024  // missing space in db.json
   ```



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/capacity/capacity.tsx:
##########
@@ -253,6 +252,31 @@ const Capacity: React.FC<object> = () => {
     </span>
   );
 
+  const totalCapacityDesc = (
+    <span>
+      TOTAL CAPACITY

Review Comment:
   The tile is labeled "TOTAL CAPACITY" which makes users expect to see the full disk size. But the number shown is actually `totalOzoneCapacity` which is the disk size **minus** the reserved space. So it's not the true total.
   
   Think of it like this:
   
   ```
   Full Disk = 100 GB
   Reserved  =  10 GB
   Ozone     =  90 GB  ← this is what the tile shows
   ```
   
   A user looking at the tile labeled "TOTAL CAPACITY" would expect to see 100 GB, but they're seeing 90 GB instead. The tooltip does explain the breakdown, but the tile label and the number are still mismatched the label says "total" but the value isn't total.
   
   The fix is simple: either rename the tile label from `TOTAL CAPACITY` to `OZONE CAPACITY` so it matches what's actually being shown, or show `totalFileSystemCapacity` (the real full disk size) as the tile value instead.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-14552. [Recon] Improve Ozone Capacity Reporting with Reserved Space and FS Capacity Breakdown [ozone]

Posted by "priyeshkaratha (via GitHub)" <gi...@apache.org>.
priyeshkaratha commented on code in PR #9742:
URL: https://github.com/apache/ozone/pull/9742#discussion_r2853082576


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/db.json:
##########
@@ -6869,18 +6869,20 @@
   },
   "utilization": {
     "globalStorage": {
-        "totalUsedSpace": 30679040,
-        "totalFreeSpace": 539776978944,
-        "totalCapacity": 879519597390
+      "totalFileSystemCapacity": 879788032846,
+      "totalReservedSpace": 268435456,
+      "totalOzoneCapacity": 879519597390,
+      "totalOzoneFreeSpace": 539776978944,
+      "totalOzoneUsedSpace": 30679040,
+      "totalOzonePreAllocatedContainerSpace":1022024
     },
     "globalNamespace": {
         "totalUsedSpace": 12349932,
         "totalKeys": 1576
     },
     "usedSpaceBreakdown": {
         "openKeyBytes": 19255266,
-        "committedKeyBytes": 1249923,
-        "preAllocatedContainerBytes": 1022024

Review Comment:
   Backend code is handled [here](https://github.com/apache/ozone/pull/9742/changes#diff-90c47feb1f59ab8deb7cef12eb06d485afcd0dad1a77f3fc8d1716fe7a0ba19bR130-R132)  to incorporate globalStorage.totalOzonePreAllocatedContainerSpace. But problem is it not removed from usedbyetes. So that cleanup is required. This moving is done based on latest design reviews and comments.
   I will be cleaning up this part from usedSpaceBreakdown



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-14552. [Recon] Improve Ozone Capacity Reporting with Reserved Space and FS Capacity Breakdown [ozone]

Posted by "priyeshkaratha (via GitHub)" <gi...@apache.org>.
priyeshkaratha commented on code in PR #9742:
URL: https://github.com/apache/ozone/pull/9742#discussion_r2853190926


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/capacity/capacity.tsx:
##########
@@ -253,6 +252,31 @@ const Capacity: React.FC<object> = () => {
     </span>
   );
 
+  const totalCapacityDesc = (
+    <span>
+      TOTAL CAPACITY

Review Comment:
   This one have discussed to show only ozone capacity as total capacity available user to use. 
   cc : @devmadhuu 



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-14552. [Recon] Improve Ozone Capacity Reporting with Reserved Space and FS Capacity Breakdown [ozone]

Posted by "priyeshkaratha (via GitHub)" <gi...@apache.org>.
priyeshkaratha commented on PR #9742:
URL: https://github.com/apache/ozone/pull/9742#issuecomment-3961021003

   @ArafatKhan2198  thanks for your review. I have addressed all of them. Please have a look again


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-14552. [Recon] Improve Ozone Capacity Reporting with Reserved Space and FS Capacity Breakdown [ozone]

Posted by "priyeshkaratha (via GitHub)" <gi...@apache.org>.
priyeshkaratha commented on PR #9742:
URL: https://github.com/apache/ozone/pull/9742#issuecomment-3922673811

   @devmadhuu @devabhishekpal @ArafatKhan2198 can you please review the changes?


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-14552. [Recon] Improve Ozone Capacity Reporting with Reserved Space and FS Capacity Breakdown [ozone]

Posted by "priyeshkaratha (via GitHub)" <gi...@apache.org>.
priyeshkaratha commented on code in PR #9742:
URL: https://github.com/apache/ozone/pull/9742#discussion_r2853082576


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/db.json:
##########
@@ -6869,18 +6869,20 @@
   },
   "utilization": {
     "globalStorage": {
-        "totalUsedSpace": 30679040,
-        "totalFreeSpace": 539776978944,
-        "totalCapacity": 879519597390
+      "totalFileSystemCapacity": 879788032846,
+      "totalReservedSpace": 268435456,
+      "totalOzoneCapacity": 879519597390,
+      "totalOzoneFreeSpace": 539776978944,
+      "totalOzoneUsedSpace": 30679040,
+      "totalOzonePreAllocatedContainerSpace":1022024
     },
     "globalNamespace": {
         "totalUsedSpace": 12349932,
         "totalKeys": 1576
     },
     "usedSpaceBreakdown": {
         "openKeyBytes": 19255266,
-        "committedKeyBytes": 1249923,
-        "preAllocatedContainerBytes": 1022024

Review Comment:
   This is right. I missed to cleanup. Thanks for the catch.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-14552. [Recon] Improve Ozone Capacity Reporting with Reserved Space and FS Capacity Breakdown [ozone]

Posted by "priyeshkaratha (via GitHub)" <gi...@apache.org>.
priyeshkaratha commented on code in PR #9742:
URL: https://github.com/apache/ozone/pull/9742#discussion_r2853059041


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/GlobalStorageReport.java:
##########
@@ -29,33 +29,125 @@
  */
 public class GlobalStorageReport {
 
-  @JsonProperty("totalUsedSpace")
-  private long totalUsedSpace;
+  @JsonProperty("totalFileSystemCapacity")
+  private long totalFileSystemCapacity;

Review Comment:
   From the `StorageVolume` implementation, the values originate from `reportBuilder()`:
   
   ```java
   SpaceUsageSource.Fixed fsUsage = volumeUsage.realUsage();
   SpaceUsageSource usage = volumeUsage.getCurrentUsage(fsUsage);
   
   builder.setCapacity(usage.getCapacity())
          .setRemaining(usage.getAvailable())
          .setScmUsed(usage.getUsedSpace())
          .setReserved(volumeUsage.getReservedInBytes())
          .setFsCapacity(fsUsage.getCapacity())
          .setFsAvailable(fsUsage.getAvailable());
   ```
   
   And in `getCurrentUsage()`:
   
   ```java
   return reservedInBytes == 0
       ? real
       : new SpaceUsageSource.Fixed(
           Math.max(real.getCapacity() - reservedInBytes, 0),
           Math.max(real.getAvailable() - getRemainingReserved(real), 0),
           real.getUsedSpace());
   ```
   
   Based on above code ozoneCapacity is calculated as:
   
   fsCapacity - reserved
   
   So effectively:
   
   fsCapacity = ozoneCapacity + reserved
   
   Since both reserved and ozoneCapacity are derived directly from the same fsCapacity value, adding them back should always give the original filesystem capacity. So this is not an approximation. I will be always give same result.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-14552. [Recon] Improve Ozone Capacity Reporting with Reserved Space and FS Capacity Breakdown [ozone]

Posted by "ArafatKhan2198 (via GitHub)" <gi...@apache.org>.
ArafatKhan2198 merged PR #9742:
URL: https://github.com/apache/ozone/pull/9742


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-14552. [Recon] Improve Ozone Capacity Reporting with Reserved Space and FS Capacity Breakdown [ozone]

Posted by "priyeshkaratha (via GitHub)" <gi...@apache.org>.
priyeshkaratha commented on code in PR #9742:
URL: https://github.com/apache/ozone/pull/9742#discussion_r2853066123


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/GlobalStorageReport.java:
##########
@@ -29,33 +29,125 @@
  */
 public class GlobalStorageReport {
 
-  @JsonProperty("totalUsedSpace")
-  private long totalUsedSpace;
+  @JsonProperty("totalFileSystemCapacity")
+  private long totalFileSystemCapacity;
 
-  @JsonProperty("totalFreeSpace")
-  private long totalFreeSpace;
+  @JsonProperty("totalReservedSpace")
+  private long totalReservedSpace;
 
-  @JsonProperty("totalCapacity")
-  private long totalCapacity;
+  @JsonProperty("totalOzoneCapacity")
+  private long totalOzoneCapacity;
 
-  public GlobalStorageReport() {
+  @JsonProperty("totalOzoneUsedSpace")
+  private long totalOzoneUsedSpace;
+
+  @JsonProperty("totalOzoneFreeSpace")
+  private long totalOzoneFreeSpace;
+
+  @JsonProperty("totalOzonePreAllocatedContainerSpace")
+  private long totalOzonePreAllocatedContainerSpace;
+
+  @JsonProperty("totalMinimumFreeSpace")
+  private long totalMinimumFreeSpace;
+
+  public long getTotalFileSystemCapacity() {
+    return totalFileSystemCapacity;
+  }
+
+  public long getTotalReservedSpace() {
+    return totalReservedSpace;
+  }
+
+  public long getTotalOzoneCapacity() {
+    return totalOzoneCapacity;
+  }
+
+  public long getTotalOzoneUsedSpace() {
+    return totalOzoneUsedSpace;
+  }
+
+  public long getTotalOzoneFreeSpace() {
+    return totalOzoneFreeSpace;
   }
 
-  public GlobalStorageReport(long totalUsedSpace, long totalFreeSpace, long totalCapacity) {
-    this.totalUsedSpace = totalUsedSpace;
-    this.totalFreeSpace = totalFreeSpace;
-    this.totalCapacity = totalCapacity;
+  public long getTotalOzonePreAllocatedContainerSpace() {
+    return totalOzonePreAllocatedContainerSpace;
   }
 
-  public long getTotalUsedSpace() {
-    return totalUsedSpace;
+  public long getTotalMinimumFreeSpace() {
+    return totalMinimumFreeSpace;
   }
 
-  public long getTotalFreeSpace() {
-    return totalFreeSpace;
+  public GlobalStorageReport() {
+  }
+
+  public GlobalStorageReport(Builder builder) {
+    this.totalFileSystemCapacity = builder.totalReservedSpace + builder.totalOzoneCapacity;

Review Comment:
   Yes, https://github.com/apache/ozone/pull/9742#discussion_r2853059041



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org