adoroszlai commented on code in PR #7798:
URL: https://github.com/apache/ozone/pull/7798#discussion_r1939858831


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/fs/CachingSpaceUsageSource.java:
##########
@@ -104,7 +105,15 @@ public long getUsedSpace() {
   @Override
   public SpaceUsageSource snapshot() {
     try (AutoCloseableLock ignored = lock.readLock(null, null)) {
-      return new Fixed(cachedCapacity, cachedAvailable, cachedUsedSpace);
+      if (cachedUsage != null) {
+        return cachedUsage;

Review Comment:
   No, because because at this point we have the read lock, it cannot be reset 
to `null`.



##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/fs/CachingSpaceUsageSource.java:
##########
@@ -104,7 +105,15 @@ public long getUsedSpace() {
   @Override
   public SpaceUsageSource snapshot() {
     try (AutoCloseableLock ignored = lock.readLock(null, null)) {
-      return new Fixed(cachedCapacity, cachedAvailable, cachedUsedSpace);
+      if (cachedUsage != null) {
+        return cachedUsage;

Review Comment:
   No, because at this point we have the read lock, it cannot be reset to 
`null`.



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