summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavan Deolasee2019-08-08 06:50:56 +0000
committerPavan Deolasee2019-08-08 06:53:49 +0000
commit31dfe47342eabe8ad72c000a103e54a94b49c912 (patch)
treee45f4eb041b164843dcfad2cd8f3a58f31368d9a
parent1369b5cc4f9875857e2fc05e6e66cc7f78eeeaf3 (diff)
Emit a WARNING if the first backend doesn't complete initialisationXL_10_STABLE
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.
-rw-r--r--src/backend/utils/init/miscinit.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index 6cb6db29d9..ba510fa949 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -654,6 +654,7 @@ SetGlobalSession(Oid coordid, int coordpid)
BackendId firstBackend = InvalidBackendId;
int bCount = 0;
int bPids[MaxBackends];
+ unsigned int retry_count = 0;
/* If nothing changed do nothing */
if (MyCoordId == coordid && MyCoordPid == coordpid)
@@ -697,7 +698,14 @@ retry:
*/
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