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


##########
src/java/org/apache/cassandra/db/ColumnFamilyStore.java:
##########
@@ -3302,7 +3229,7 @@ public double getDroppableTombstoneRatio()
     @Override
     public long trueSnapshotsSize()
     {
-        return getDirectories().trueSnapshotsSize();
+        return SnapshotManager.instance.trueSnapshotsSize(metadata(), 
directories);

Review Comment:
   @frankgh 
   
   Yes, this is intended behavior. The way it works is that there are two 
"sizes" of a snapshot. "true allocated size" of a snapshot in a snapshot 
directory is the size of all files which are located in the snapshot dir BUT 
THEY ARE NOT IN HOT DATA DIR.
   
   In other words, because a snapshot is just a collection of hardlinks, then 
if you take a snapshot then its size is ... 0. Why? Because every file in a 
snapshot has its counterpart in a hot / live data dir.
   
   But when some SSTables in hot data dir are compacted away, for example, then 
the hardlink / file in snapshot dir suddenly becomes "real" and it starts to be 
counted towards true snapshot size ...
   
   If I have data dir with 10 GiB of data and I take a snapshot, the data don't 
occupy 20GiB, they still occupy 10GiB. So "true snapshot size" is effectively 0.



##########
src/java/org/apache/cassandra/db/ColumnFamilyStore.java:
##########
@@ -3302,7 +3229,7 @@ public double getDroppableTombstoneRatio()
     @Override
     public long trueSnapshotsSize()
     {
-        return getDirectories().trueSnapshotsSize();
+        return SnapshotManager.instance.trueSnapshotsSize(metadata(), 
directories);

Review Comment:
   @frankgh 
   
   Yes, this is intended behavior. The way it works is that there are two 
"sizes" of a snapshot. "true allocated size" of a snapshot in a snapshot 
directory is the size of all files which are located in the snapshot dir BUT 
THEY ARE NOT IN HOT DATA DIR.
   
   In other words, because a snapshot is just a collection of hardlinks, then 
if you take a snapshot then its size is ... 0. Why? Because every file in a 
snapshot has its counterpart in a hot / live data dir.
   
   But when some SSTables in hot data dir are compacted away, for example, then 
the hardlink / file in snapshot dir suddenly becomes "real" and it starts to be 
counted towards true snapshot size ...
   
   If I have a data dir with 10 GiB of data and I take a snapshot, the data 
don't occupy 20GiB, they still occupy 10GiB. So "true snapshot size" is 
effectively 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