smiklosovic commented on code in PR #3374:
URL: https://github.com/apache/cassandra/pull/3374#discussion_r1686244766


##########
src/java/org/apache/cassandra/service/snapshot/TableSnapshot.java:
##########
@@ -138,11 +152,21 @@ public boolean isExpiring()
 
     public long computeSizeOnDiskBytes()
     {
-        return snapshotDirs.stream().mapToLong(FileUtils::folderSize).sum();
+        long sum = sizeOnDisk;
+        if (sum == 0)
+        {
+            for (File snapshotDir : snapshotDirs)
+                sizeOnDisk = sum += FileUtils.folderSize(snapshotDir);
+        }

Review Comment:
   It think it would be the best if we just made that method `synchronized`. 
This method is supposed to be called just once anyway because it is not 
counting it all over again, just once, when sum is 0.



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