Adding clarification to description of IPC wait events XactGroupUpdate and ProcArrayGroupUpdate

From: SAMEER KUMAR <sameer(dot)kasi200x(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Adding clarification to description of IPC wait events XactGroupUpdate and ProcArrayGroupUpdate
Date: 2024-07-25 03:13:39
Message-ID: CAGPeHmh6UMrKQHKCmX+5vV5TH9P=Kw9en3k68qEem6J=yrZPUA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

While preparing for my presentation on PostgreSQL Wait Events at
PgConf India, I was trying to understand *IPC:XactGroupUpdate* in more
detail. PostgreSQL documentation [1] mentions:

> A process is waiting for the group leader to update the transaction status at the end of a _parallel operation_.

I looked at `TransactionGroupUpdateXidStatus` in PostgreSQL code (`clog.c`)
Line `481` [2] sets this wait event.

And after reading the code, my understanding is - It does not
necessarily need to be a "_parallel operation_". Or maybe I am just
misinterpreting "parallel operation" in this context. But it is
possible for other users to confuse it with the parallel query (and
parallel workers) feature.

**My understanding is -**

In order to avoid `XactSLRULock` being passed between backends,
backends waiting for it will add themselves to the queue [3]. The
first backend in the queue (also the leader) will be the only one to
acquire `XactSLRULock` and update the XID status for all those pids
which are in the queue. This IPC wait event (`XactGroupUpdate`) is
observed in other backened processes who are in the queue, waiting for
the group leader to update the XID status.

We can add more clarity on what this wait event means. A similar
change should be done for `ProcArrayGroupUpdate` to indicate that the
wait event is a result of concurrent backend processes trying to clear
the transaction id (instead of saying "parallel operation”).

I am attaching a patch for consideration. This should also be
backpatched-through version 13.

[1] https://www.postgresql.org/docs/current/monitoring-stats.html#WAIT-EVENT-IPC-TABLE
[2] https://github.com/postgres/postgres/blob/master/src/backend/access/transam/clog.c#L481
[3] https://github.com/postgres/postgres/blob/master/src/backend/access/transam/clog.c#L399

Thanks,
Sameer
DB Specialist,
Amazon Web Services

Attachment Content-Type Size
v1-0001-Update-the-description-of-IPC-wait-events-XactGro.patch application/octet-stream 2.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2024-07-25 03:16:51 Re: pg_upgrade and logical replication
Previous Message Amit Kapila 2024-07-25 03:13:03 Re: pg_upgrade and logical replication