未验证 提交 00e28196 编写于 作者: H Hubert Zhang 提交者: GitHub

Skip forward QE notice for Background workers.

Background workers have no client at all, so no need to forward QE message.
On the other hand, MyProcPort is not initialized in background workers.
While forward notice currently assume MyProcPort is already initialized.

This is firstly detected by diskquota background worker.
It also reported by #6756 which causes GDD infinite loop.
GDD currently set the MyProcPort manually. This commit also removes MyProcPort in GDD, since there is no client in GDD process neither. So GDD and background worker will both skip generate/forward QE notice.

Co-authored-by: Zhenghua Lyu zlv@pivotal.io
Reviewed-by: NHeikki Linnakangas <hlinnakangas@pivotal.io>
Reviewed-by: NPengcheng Tang <petang@pivotal.io>
上级 27e43d3b
......@@ -512,7 +512,11 @@ MPPnoticeReceiver(void *arg, const PGresult *res)
SegmentDatabaseDescriptor *segdbDesc = (SegmentDatabaseDescriptor *) arg;
if (!res)
/*
* If MyProcPort is NULL, there is no client, so no need to generate notice.
* One example is that there is no client for a background worker.
*/
if (!res || MyProcPort == NULL)
return;
strcpy(message, "missing error text");
......@@ -693,12 +697,15 @@ MPPnoticeReceiver(void *arg, const PGresult *res)
void
forwardQENotices(void)
{
bool hasNotices = false;
while (qeNotices_head)
{
QENotice *notice;;
StringInfoData msgbuf;
notice = qeNotices_head;
hasNotices = true;
/*
* Unlink it first, so that if something goes wrong in sending it to
......@@ -803,6 +810,6 @@ forwardQENotices(void)
}
PG_END_TRY();
}
pq_flush();
if (hasNotices)
pq_flush();
}
......@@ -153,7 +153,6 @@ NON_EXEC_STATIC void
GlobalDeadLockDetectorMain(int argc, char *argv[])
{
sigjmp_buf local_sigjmp_buf;
Port portbuf;
char *fullpath;
IsUnderPostmaster = true;
......@@ -330,12 +329,6 @@ GlobalDeadLockDetectorMain(int argc, char *argv[])
InitializeSessionUserIdStandalone();
memset(&portbuf, 0, sizeof(portbuf));
MyProcPort = &portbuf;
MyProcPort->user_name = MemoryContextStrdup(TopMemoryContext,
GetUserNameFromId(GetAuthenticatedUserId()));
MyProcPort->database_name = DB_FOR_COMMON_ACCESS;
/* close the transaction we started above */
CommitTransactionCommand();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册