refactor(redshift-serverless): drop the per-snapshot dump loop from clear() (#7056)

Reset empties the snapshot store before clear() runs and deleteDumpTree() removes the whole dump directory, so the loop found nothing to delete.

Co-authored-by: Priamo Germosen <6233424+pgermosen@users.noreply.github.com>
This commit is contained in:
Vũ Thế HuyandPriamo Germosen authored and GitHub committed 2026-10-30 23:16:29 -04:00
1 parent f41f794337
commit 5e0e33e40f
1 file changed
+2 -9
@@ -1372,20 +1372,13 @@ public class RedshiftServerlessService implements Resettable {
}
namespaces.clear();
workgroups.clear();
for (AccountAwareStorageBackend.AccountEntry<RedshiftServerlessSnapshot> entry
: snapshots.scanAllAccountEntries(key -> true)) {
String dump = entry.value().getSqlDump();
if (dump != null && !dump.isBlank()) {
deleteDumpQuietly(Paths.get(dump));
}
}
snapshots.clear();
deleteDumpTree();
}
/**
* Reset empties the stores before it calls {@link #clear()}, so the loop above finds no snapshot
* left to name a dump. Every dump lives under this one directory, copies included.
* Reset empties the stores before it calls {@link #clear()}, so no snapshot is left to name a
* dump. Every dump lives under this one directory, copies included.
*/
private void deleteDumpTree() {
Path root = Paths.get(config.storage().persistentPath()).resolve("redshift-serverless-dumps")