diff --git a/src/backend/distributed/utils/maintenanced.c b/src/backend/distributed/utils/maintenanced.c index fe33c7a26..4b943c18c 100644 --- a/src/backend/distributed/utils/maintenanced.c +++ b/src/backend/distributed/utils/maintenanced.c @@ -212,8 +212,13 @@ CitusMaintenanceDaemonMain(Datum main_arg) HASH_FIND, NULL); if (!myDbData) { - /* should never happen */ - ereport(ERROR, (errmsg("got lost finding myself"))); + /* + * 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. + */ + proc_exit(0); } LWLockRelease(&MaintenanceDaemonControl->lock);