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


##########
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:
   Yeah this can happen in earlier versions (before 
[HDDS-7751](https://issues.apache.org/jira/browse/HDDS-7751)). Now it cannot 
happen anymore because a user will not be able to create a bucket with no quota 
if volume has quota.
   Also total quota of buckets in a volume cannot exceed the volume's quota. 
   
   In your example vol1 has 1GB quota, and buck1 has 1GB quota. then the user 
will not be able to create buck2 with 1GB of quota.
   
   It makes sense in the first case (you mentioned, if there is no quota set 
for bucket) to report volumes total given quota and all bytes used in volume 
**sum (bucket.usedBytes for each bucket in volume)** something like that. 
   
   But I fear that there might be a case where volume has quota, and some of 
the buckets in that volume has quota but not all of them.
   
   For example vol1 has 3GB of quota, /vol1/buck1 has 2GB quota. /vol1/buck2 
has no quota in this case available quota should be **min(volume quota - sum 
(bucket.usedBytes for each bucket in volume), bucket quota (if there is) - 
usedBytes in the bucket**).
   
   What is your suggestion to deal with earlier version case (before 
[HDDS-7751](https://issues.apache.org/jira/browse/HDDS-7751))



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