Skip to content

Commit

Permalink
backupccl: don't include tenants in non-cluster backups
Browse files Browse the repository at this point in the history
Release note (bug fix): System tenant backups of individual tables and databases no longer include tenants as well.
  • Loading branch information
dt committed Nov 17, 2021
1 parent bac19fb commit ddd8761
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
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

0 comments on commit ddd8761

Please sign in to comment.