From 0b5a6d1c70b4281fb54de06c233f0d985ed91aaa Mon Sep 17 00:00:00 2001 From: adityamaru Date: Fri, 26 Aug 2022 09:21:10 -0400 Subject: [PATCH] backupccl: missing txn in restore planning We were not passing in the DescsTxn when dropping defaultdb and postgres during restore planning. This manifested itself as a hung test where the drop defaultdb was waiting for the lease on the database to expire. Release note: None Release justification: low risk bug fix --- pkg/ccl/backupccl/restore_planning.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/ccl/backupccl/restore_planning.go b/pkg/ccl/backupccl/restore_planning.go index 700e37fdbb3d..ef25805cd803 100644 --- a/pkg/ccl/backupccl/restore_planning.go +++ b/pkg/ccl/backupccl/restore_planning.go @@ -653,12 +653,12 @@ func getDatabaseIDAndDesc( func dropDefaultUserDBs(ctx context.Context, execCfg *sql.ExecutorConfig) error { return sql.DescsTxn(ctx, execCfg, func(ctx context.Context, txn *kv.Txn, col *descs.Collection) error { ie := execCfg.InternalExecutor - _, err := ie.Exec(ctx, "drop-defaultdb", nil, "DROP DATABASE IF EXISTS defaultdb") + _, err := ie.Exec(ctx, "drop-defaultdb", txn, "DROP DATABASE IF EXISTS defaultdb") if err != nil { return err } - _, err = ie.Exec(ctx, "drop-postgres", nil, "DROP DATABASE IF EXISTS postgres") + _, err = ie.Exec(ctx, "drop-postgres", txn, "DROP DATABASE IF EXISTS postgres") if err != nil { return err }