@@ -381,8 +381,8 @@ ItemCompletionHandler resolveItemAndAddSnapshotIds(SnapshotDeletionsItem item) {
381381
382382 if (startedDeletionSnapshots .containsAll (itemCompletedSnapshotIds )
383383 && startedDeletionSnapshots .containsAll (itemInProgressSnapshotIds )) {
384- // item is only targeting snapshots whose deletion is already running so it need only wait for that deletion to
385- // finish, even if the rest of the batch creates/updates a WAITING deletion
384+ // item is only targeting snapshots whose deletion is already present and STARTED so it need only wait for that
385+ // deletion to finish, even if the rest of the batch creates/updates a WAITING deletion
386386 batchCompletionHandler .appendToFinalLog (item .snapshots );
387387 if (item .waitForCompletion ) {
388388 item .startedDeletionUuid = startedDeletionUuid ;
@@ -391,9 +391,10 @@ ItemCompletionHandler resolveItemAndAddSnapshotIds(SnapshotDeletionsItem item) {
391391 return ItemCompletionHandler .COMPLETE_LISTENER_IMMEDIATELY ;
392392 }
393393 }
394- // else add all the item's snapshots to the new deletion, even though there may be duplicates, because the running
395- // deletion may fail and then the new deletion succeeds but in that case we shouldn't report success unless the new
396- // deletion really did delete all the snapshots requested by this item.
394+ // else add all the item's snapshots to a WAITING deletion D2 (creating D2 if it does not already exist) even though
395+ // this may duplicate entries which are already present in an ongoing STARTED deletion D1: D1 may fail but if D2 then
396+ // goes on to succeed then it's important that D2 alone really did delete all the snapshots requested by this item,
397+ // because the item's listener will report only the outcome of D2.
397398
398399 snapshotIds .addAll (itemCompletedSnapshotIds );
399400 snapshotIds .addAll (itemInProgressSnapshotIds );
0 commit comments