diff --git a/src/backend/distributed/utils/maintenanced.c b/src/backend/distributed/utils/maintenanced.c index 8e144bc43..3953d3437 100644 --- a/src/backend/distributed/utils/maintenanced.c +++ b/src/backend/distributed/utils/maintenanced.c @@ -361,14 +361,21 @@ CitusMaintenanceDaemonMain(Datum main_arg) { /* * When the database crashes, background workers are restarted, but - * the state in shared memory is lost. In that case, we exit and - * wait for a session to call InitializeMaintenanceDaemonBackend - * to properly add it to the hash. + * the state in shared memory is lost. In that case, we exit and wait + * for Postmaster calling __PG_Init which in turn calls + * InitializeMaintenanceDaemonForAdminDB. */ proc_exit(0); } + if (found && myDbData->workerPid != 0) + { + /* Another maintenance daemon is running.*/ + + proc_exit(0); + } + if (!found) { /* ensure the values in MaintenanceDaemonDBData are zero */