标签
PostgreSQL , 10.0 , 等待事件 , ProcArrayGroupUpdate
背景
ProcArrayGroupUpdate等待事件,指事务结束后,将当前xid从ProcArray移除的事件。
506 /*
507 * If the list was not empty, the leader will clear our XID. It is
508 * impossible to have followers without a leader because the first process
509 * that has added itself to the list will always have nextidx as
510 * INVALID_PGPROCNO.
511 */
512 if (nextidx != INVALID_PGPROCNO)
513 {
514 int extraWaits = 0;
515
516 /* Sleep until the leader clears our XID. */
517 pgstat_report_wait_start(WAIT_EVENT_PROCARRAY_GROUP_UPDATE);
518 for (;;)
519 {
520 /* acts as a read barrier */
521 PGSemaphoreLock(proc->sem);
522 if (!proc->procArrayGroupMember)
523 break;
524 extraWaits++;
525 }
526 pgstat_report_wait_end();
527
528 Assert(pg_atomic_read_u32(&proc->procArrayGroupNext) == INVALID_PGPROCNO);
529
530 /* Fix semaphore count for any absorbed wakeups */
531 while (extraWaits-- > 0)
532 PGSemaphoreUnlock(proc->sem);
533 return;
534 }
patch 如下
Add ProcArrayGroupUpdate wait event.
author Robert Haas <rhaas@postgresql.org>
Sat, 8 Apr 2017 01:41:47 +0800 (13:41 -0400)
committer Robert Haas <rhaas@postgresql.org>
Sat, 8 Apr 2017 01:41:47 +0800 (13:41 -0400)
commit d4116a771925379c33cf4c6634ca620ed08b551d
tree 27f53d0c2833c66a78809bdb2db57c23d20cb0b9 tree | snapshot
parent dbb2a931478a397a2b655eb77e8be8c1ca136f63 commit | diff
Add ProcArrayGroupUpdate wait event.
Discussion: http://postgr.es/m/CA+TgmobgWHcXDcChX2+BqJDk2dkPVF85ZrJFhUyHHQmw8diTpA@mail.gmail.com
这个patch的讨论,详见邮件组,本文末尾URL。
PostgreSQL社区的作风非常严谨,一个patch可能在邮件组中讨论几个月甚至几年,根据大家的意见反复的修正,patch合并到master已经非常成熟,所以PostgreSQL的稳定性也是远近闻名的。