Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backupccl: Add ALTER BACKUP SCHEDULE command. #85489

Merged
merged 1 commit into from
Aug 11, 2022
Merged

Conversation

benbardin
Copy link
Collaborator

Note that only SET RECURRING and SET FULL BACKUP are supported here. I'll add
the other commands shortly.

Release note (enterprise change): Add ALTER BACKUP SCHEDULE command to modify
existing backup schedules.

Partially addresses #84033

@benbardin benbardin requested a review from dt August 2, 2022 19:56
@benbardin benbardin requested a review from a team as a code owner August 2, 2022 19:56
@benbardin benbardin requested a review from a team August 2, 2022 19:56
@benbardin benbardin requested a review from a team as a code owner August 2, 2022 19:56
@cockroach-teamcity
Copy link
Member

This change is Reviewable

pkg/sql/parser/sql.y Outdated Show resolved Hide resolved
pkg/sql/parser/sql.y Outdated Show resolved Hide resolved
pkg/sql/parser/sql.y Outdated Show resolved Hide resolved
pkg/sql/sem/tree/alter_backup_schedule.go Show resolved Hide resolved
pkg/ccl/backupccl/alter_backup_schedule.go Outdated Show resolved Hide resolved
pkg/ccl/backupccl/alter_backup_schedule.go Outdated Show resolved Hide resolved
pkg/ccl/backupccl/alter_backup_schedule.go Outdated Show resolved Hide resolved
@benbardin
Copy link
Collaborator Author

Ready for another look, thank you!

func loadSchedules(
ctx context.Context, p sql.PlanHookState, eval *alterBackupScheduleEval,
) (
*jobs.ScheduledJob,
Copy link
Member

Choose a reason for hiding this comment

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

nit: comments, or named returns, could be helpful here given the multiple returns of the same type. or maybe a little struct with fullJob... incJob, incArgs or something vs the 4 returns? 🤷

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

# Disable incremental backup.

exec-sql
alter backup schedule $fullID set full backup always;
Copy link
Member

Choose a reason for hiding this comment

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

Is there a test that both sets full backup always and changes the recurrence (eg. to daily)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

there is now!


// We don't know if a full backup has completed yet, so pause incremental
// until a full backup completes.
incJob.Pause()
Copy link
Member

Choose a reason for hiding this comment

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

Huh, I'm not sure we want to pause it here? like, say we do 10min inc and we were doing daily full but need to switch to 6h full since the chains are getting long; we do alter ... full backup */6 * ... etc, and then I think we expect our next full to run at 1800 instead of 0000, but we probably expect our inc backups to carry on on their 10min cadence as if nothing changed, no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can only get to this branch if incJob == nil, that is, we were doing no incremental backups of any kind before, but we're adding some now. I think PAUSE is right in that case, no? We could do fancy logic to see if the FULL schedule has been run before, I suppose, but this does seem simpler and quite reasonable.

Note that only SET RECURRING and SET FULL BACKUP are supported here. I'll add
the other commands shortly.

Release note (enterprise change): Add ALTER BACKUP SCHEDULE command to modify
existing backup schedules.
@benbardin
Copy link
Collaborator Author

Tests are green, RFAL! Thanks!

@benbardin
Copy link
Collaborator Author

bors r+

@craig
Copy link
Contributor

craig bot commented Aug 10, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 11, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 11, 2022

Build succeeded:

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.

None yet

4 participants