diff --git a/src/backend/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.c index ba664df7cce..e9061cab7a6 100644 --- a/src/backend/storage/lmgr/lwlock.c +++ b/src/backend/storage/lmgr/lwlock.c @@ -79,6 +79,7 @@ #include "miscadmin.h" #include "pg_trace.h" #include "pgstat.h" +#include "access/xlogrecovery.h" #include "port/pg_bitutils.h" #include "postmaster/postmaster.h" #include "storage/proc.h" @@ -1057,7 +1058,7 @@ LWLockQueueSelf(LWLock *lock, LWLockMode mode) MyProc->lwWaitMode = mode; /* LW_WAIT_UNTIL_FREE waiters are always at the front of the queue */ - if (mode == LW_WAIT_UNTIL_FREE) + if (mode == LW_WAIT_UNTIL_FREE || AmStartupProcess()) proclist_push_head(&lock->waiters, MyProcNumber, lwWaitLink); else proclist_push_tail(&lock->waiters, MyProcNumber, lwWaitLink);