We have received a report from the field that a backend apparently stuck on
ProcArrayLock in SetGlobalSession(). This is an attempt to check if the stuck
backend is actually looping infinitely, waiting for the leader process in the
distributed session to initialise.
BackendId firstBackend = InvalidBackendId;
int bCount = 0;
int bPids[MaxBackends];
+ unsigned int retry_count = 0;
/* If nothing changed do nothing */
if (MyCoordId == coordid && MyCoordPid == coordpid)
*/
if (bCount > 0)
{
- /* XXX sleep ? */
+ /*
+ * Sleep for a short while and try again. Emit a WARNING if we
+ * retry often.
+ */
+ pg_usleep(1000*1000L);
+ if (++retry_count % 100 == 0)
+ elog(WARNING, "Retrying %uth time for the first "
+ "backend to initialise", retry_count);
goto retry;
}
else