smiklosovic commented on code in PR #4100:
URL: https://github.com/apache/cassandra/pull/4100#discussion_r2073239593
##########
src/java/org/apache/cassandra/service/snapshot/SnapshotManager.java:
##########
@@ -568,18 +570,33 @@ <T> T executeTask(AbstractSnapshotTask<T> task)
private synchronized void prePopulateSnapshots(TakeSnapshotTask task)
{
Map<ColumnFamilyStore, TableSnapshot> snapshotsToCreate =
task.getSnapshotsToCreate();
- for (Map.Entry<ColumnFamilyStore, TableSnapshot> toCreateEntry :
snapshotsToCreate.entrySet())
+ Map<ColumnFamilyStore, TableSnapshot> snapshotsToOverwrite = new
HashMap<>();
Review Comment:
@frankgh
It is used, if you look closer. What we do is that
1) on 572. we do `snapshotsToCreate = task.getSnapshotsToCreate();`
2) on 592. we do `snapshotsToOverwrite.put(toCreateEntry.getKey(),
existingSnapshot);`
3) on 597. we do `snapshotsToCreate.putAll(snapshotsToOverwrite);`
What that does is that as we iterate over `toCreateEntry :
snapshotsToCreate.entrySet()` at 578 we are removing snapshots to be created by
`toCreate.remove(toCreateEntry.getValue())` which we eventually add at 599 by
`snapshots.addAll(toCreate)`.
So, `snapshots`, will contain, by this addition,_only brand new snapshots to
be created_.
However, by `snapshotsToCreate.putAll(snapshotsToOverwrite)`, we are
effectively overwriting _snapshots to be taken_ with _already existing
snapshots_.
So the result is that `task.getSnapshotsToCreate()` will contain both brand
new snapshots as well as snapshots from `snapshots` list.
--
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]