sadanand48 commented on code in PR #4226:
URL: https://github.com/apache/ozone/pull/4226#discussion_r1095716508


##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneFileSystem.java:
##########
@@ -1010,6 +1013,24 @@ listingPageSize, uri, workingDir, getUsername())
     return statusList;
   }
 
+  @Override
+  public FsStatus getStatus(Path p) throws IOException {
+    BasicOzoneClientAdapterImpl adapterImpl =
+        (BasicOzoneClientAdapterImpl) adapter;
+    OzoneBucket bucket = adapterImpl.getBucket();
+    long usedBytes = bucket.getUsedBytes();
+    long quota = Long.MAX_VALUE;
+    if (bucket.getQuotaInBytes() > -1) {
+      quota = bucket.getQuotaInBytes();
+    } else {
+      OzoneVolume volume = adapterImpl.getVolume();
+      if (volume.getQuotaInBytes() > -1) {
+        quota = volume.getQuotaInBytes();

Review Comment:
   Thanks @mohan3d for explaining the scenarios. HDDS-7751 was an OM server 
side fix but this PR makes a change on the client ( by introducing new API 
getStatus). It can happen that new client (with getStatus implemented) talks to 
old OM server (without HDDS-7751) , so I think we need to handle for cases 2 & 
3. The calculations look good for all the cases you mentioned and I think it is 
simpler to use vol.listBuckets like in the code snippet 
   
   
   > Another example:
   /vol1 (quota=5GB)
   /vol1/buck1 (quota=3GB, usedBytes=2GB)
   /vol1/buck2 (quota=-1, usedBytes=2.5GB)
   
   Although I wonder if this case is possible, If volume quota is set to 5GB , 
and buck1 has 3GB  quota , then in the other bucket you cannot write more than 
(5-3=2GB) right, so usedBytes cannot be more than 2GB.
   
   
   



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