Skip to content

Commit 079fc80

Browse files
author
Bogdan Tsechoev
committed
Merge branch '614-protect-automatic-snapshots' into 'dle-4-0'
fix: prevent any automatic snapshot from being deleted (#614) See merge request postgres-ai/database-lab!1003
2 parents 5d1fe01 + 40d3b4d commit 079fc80

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Diff for: engine/internal/srv/routes.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,9 @@ func (s *Server) deleteSnapshot(w http.ResponseWriter, r *http.Request) {
229229
return
230230
}
231231

232-
// Prevent deletion of the last snapshot in the pool.
233-
snapshotCnt := len(fsm.SnapshotList())
234-
235-
if fullDataset, _, found := strings.Cut(snapshotID, "@"); found && fullDataset == poolName && snapshotCnt == 1 {
236-
api.SendBadRequestError(w, r, "cannot destroy the last snapshot in the pool")
232+
// Prevent deletion of automatic snapshots in the pool.
233+
if fullDataset, _, found := strings.Cut(snapshotID, "@"); found && fullDataset == poolName {
234+
api.SendBadRequestError(w, r, "cannot destroy automatic snapshot in the pool")
237235
return
238236
}
239237

0 commit comments

Comments
 (0)