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: don't include tenants in non-cluster backups #72871

Merged
merged 1 commit into from
Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/ccl/backupccl/backup_planning.go
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ func backupPlanHook(
}
spans = append(spans, tableSpans...)

if p.ExecCfg().Codec.ForSystemTenant() {
if p.ExecCfg().Codec.ForSystemTenant() && backupStmt.Coverage() == tree.AllDescriptors {
// Include all tenants.
tenants, err = retrieveAllTenantsMetadata(
ctx, p.ExecCfg().InternalExecutor, p.ExtendedEvalContext().Txn,
Expand Down
3 changes: 3 additions & 0 deletions pkg/ccl/backupccl/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7011,6 +7011,9 @@ func TestBackupRestoreTenant(t *testing.T) {
return nil
})

systemDB.Exec(t, `BACKUP system.users TO 'nodelocal://1/users'`)
systemDB.CheckQueryResults(t, `SELECT manifest->>'tenants' FROM [SHOW BACKUP 'nodelocal://1/users' WITH as_json]`, [][]string{{"[]"}})

// Prevent a logging assertion that the server ID is initialized multiple times.
log.TestingClearServerIdentifiers()

Expand Down