Skip to content

Add backup protection#16

Merged
krollins-mdb merged 1 commit intomainfrom
DOCSP-58752
Mar 26, 2026
Merged

Add backup protection#16
krollins-mdb merged 1 commit intomainfrom
DOCSP-58752

Conversation

@krollins-mdb
Copy link
Copy Markdown
Collaborator

Prevent runaway backup deletion in GDCD BackUpDb
The existing backup logic unconditionally dropped the oldest backup after every copy, which could silently destroy all backups across a partial run or re-run of GDCD.

Skip copy if a recent backup already exists
Before copying, check whether a same-day or prior-day backup exists. If one does, skip the copy entirely. This prevents overwriting the current backup when re-running a job mid-ingest.

Guard the drop with a minimum history check
Before dropping, require both:

  • At least 3 backups exist
  • The oldest backup is at least 21 days old

With weekly runs, this means the drop won't fire until week 4, after which it maintains a rolling 3-backup window. Clustered re-runs can't trigger the drop because hasRecentBackup blocks new copies from being created.

Refactor: Consolidated duplicate date-parsing logic from findOldestBackup into a shared parseBackupDate helper.

Copy link
Copy Markdown
Collaborator

@dacharyc dacharyc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks for making this safer 😅

@krollins-mdb krollins-mdb merged commit 0b5dc2d into main Mar 26, 2026
2 checks passed
@krollins-mdb krollins-mdb deleted the DOCSP-58752 branch March 26, 2026 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants