From f80dc1a17aba694d1f14148479dbe7c2a286251d Mon Sep 17 00:00:00 2001 From: Anne Zhu Date: Tue, 25 May 2021 11:53:35 -0400 Subject: [PATCH] backupccl: fix include interleaved tables option for scheduled backup This commit fixes the bug that causes error when creating scheduled backup with interleaved tables, when the `include_deprecated_interleaves` option is included, the option gets ignored. Resolves: #65558 Release note (bug fix): scheduled backup with interleaved tables can now be created with the `include_deprecated_interleaves` option. --- pkg/ccl/backupccl/create_scheduled_backup.go | 5 +++-- pkg/ccl/backupccl/create_scheduled_backup_test.go | 13 +++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/pkg/ccl/backupccl/create_scheduled_backup.go b/pkg/ccl/backupccl/create_scheduled_backup.go index 42cbff7f08ed..5a56c6ab61a3 100644 --- a/pkg/ccl/backupccl/create_scheduled_backup.go +++ b/pkg/ccl/backupccl/create_scheduled_backup.go @@ -231,8 +231,9 @@ func doCreateBackupSchedules( // Prepare backup statement (full). backupNode := &tree.Backup{ Options: tree.BackupOptions{ - CaptureRevisionHistory: eval.BackupOptions.CaptureRevisionHistory, - Detached: true, + CaptureRevisionHistory: eval.BackupOptions.CaptureRevisionHistory, + Detached: true, + IncludeDeprecatedInterleaves: eval.BackupOptions.IncludeDeprecatedInterleaves, }, Nested: true, AppendToLatest: false, diff --git a/pkg/ccl/backupccl/create_scheduled_backup_test.go b/pkg/ccl/backupccl/create_scheduled_backup_test.go index a72241fb33cc..b30d1185ab6f 100644 --- a/pkg/ccl/backupccl/create_scheduled_backup_test.go +++ b/pkg/ccl/backupccl/create_scheduled_backup_test.go @@ -279,6 +279,19 @@ func TestSerializesScheduledBackupExecutionArgs(t *testing.T) { }, }, }, + { + name: "full-cluster-with-interleaved-table", + query: "CREATE SCHEDULE FOR BACKUP INTO 'nodelocal://0/backup?AWS_SECRET_ACCESS_KEY=neverappears' WITH INCLUDE_DEPRECATED_INTERLEAVES RECURRING '@hourly'", + user: freeUser, + expectedSchedules: []expectedSchedule{ + { + nameRe: "BACKUP .+", + backupStmt: "BACKUP INTO 'nodelocal://0/backup?AWS_SECRET_ACCESS_KEY=neverappears' WITH detached, include_deprecated_interleaves", + shownStmt: "BACKUP INTO 'nodelocal://0/backup?AWS_SECRET_ACCESS_KEY=redacted' WITH detached, include_deprecated_interleaves", + period: time.Hour, + }, + }, + }, { name: "full-cluster-always", query: "CREATE SCHEDULE FOR BACKUP INTO 'nodelocal://0/backup' RECURRING '@hourly' FULL BACKUP ALWAYS",