Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix(PITR): kill connections to _pitr database (#2382)

Yilong Lidbc9f3b954ce
diff --git a/server/task_executor_pitr_cutover.go b/server/task_executor_pitr_cutover.go
index addff5fa3d..525e5f9b13 100644
--- a/server/task_executor_pitr_cutover.go
+++ b/server/task_executor_pitr_cutover.go
@@ -205,6 +205,10 @@ func (*PITRCutoverTaskExecutor) pitrCutoverPostgres(ctx context.Context, driver
if err := pgKillConnectionsToDatabase(ctx, db, task.Database.Name); err != nil {
return err
}
+ // Kill connection to the _pitr database in case there's someone connecting to all of the existing databases like postgres-exporter.
+ if err := pgKillConnectionsToDatabase(ctx, db, pitrDatabaseName); err != nil {
+ return err
+ }
if _, err := db.ExecContext(ctx, fmt.Sprintf("ALTER DATABASE %s RENAME TO %s;", pitrDatabaseName, task.Database.Name)); err != nil {
return errors.Wrapf(err, "failed to rename database %q to %q", pitrDatabaseName, task.Database.Name)
}