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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to