fix(rds): reject cluster snapshot copies with missing data (#8908)

CopyDBClusterSnapshot no longer treats a missing stored archive as an empty dump and reports the copy available. It now fails with DBClusterSnapshotNotFoundFault before writing the target's metadata or data, as RestoreDBClusterFromSnapshot and snapshot export already do, while a present archive, an empty one included, is copied as before.

Closes #7679
This commit is contained in:
Andre Kurait authored and GitHub committed 2026-11-18 20:56:54 -04:00
1 parent c2d285ed2f
commit 127b412414
2 files changed
+44 -1

No files matched your search

@@ -2717,7 +2717,9 @@ public class RdsService implements Resettable, ResourceProvider {
copiedTags.putAll(tags);
}
copy.setTags(copiedTags);
String sqlDump = snapshotData.get(clusterSnapshotDataKey(effectiveRegion, sourceId)).orElse("");
String sqlDump = snapshotData.get(clusterSnapshotDataKey(effectiveRegion, sourceId))
.orElseThrow(() -> new AwsException("DBClusterSnapshotNotFoundFault",
"DB cluster snapshot data for " + sourceId + " not found.", 404));
snapshotData.put(clusterSnapshotDataKey(effectiveRegion, targetSnapshotId), sqlDump);
putClusterSnapshotForScope(accountId, effectiveRegion, targetSnapshotId, copy);
LOG.infov("Copied DB cluster snapshot {0} to {1}", sourceId, targetSnapshotId);