545
技術社區[雲棲]
PostgreSQL 10.0 preview 功能增強 - 增加ProcArrayGroupUpdate等待事件
標簽
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: https://postgr.es/m/CA+TgmobgWHcXDcChX2+BqJDk2dkPVF85ZrJFhUyHHQmw8diTpA@mail.gmail.com
這個patch的討論,詳見郵件組,本文末尾URL。
PostgreSQL社區的作風非常嚴謹,一個patch可能在郵件組中討論幾個月甚至幾年,根據大家的意見反複的修正,patch合並到master已經非常成熟,所以PostgreSQL的穩定性也是遠近聞名的。
參考
最後更新:2017-04-22 17:01:48