Re: Tracking wait event for latches

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Tracking wait event for latches
Date: 2016-09-21 04:53:19
Message-ID: CAB7nPqTeUSj-Sqp9VOXiKbUc58-JbUd+x0j4A1HW_TQsgXYjCw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 21, 2016 at 1:03 PM, Thomas Munro
<thomas(dot)munro(at)enterprisedb(dot)com> wrote:
> Yeah but that's at run time. I meant you could help developers
> discover ASAP if they add a new item to one place but not the other
> with a compile time assertion:
> const char *
> GetWaitEventIdentifier(uint16 eventId)
> {
> StaticAssertStmt(lengthof(WaitEventNames) == WE_LAST_TYPE + 1,
> "WaitEventNames must match WaitEventIdentifiers");
> if (eventId > WE_LAST_TYPE)
> return "???";
> return WaitEventNames[eventId];
> }

Ah, OK, good idea. I had AssertStmt in mind, not StaticAssertStmt.

> You missed a couple that are hiding inside #ifdef WIN32:
>
> From pgstat.c:
> + EVENT_PGSTAT_MAIN);
>
> From syslogger.c:
> + EVENT_SYSLOGGER_MAIN);

Oops. Fixed those ones and checked the builds on WIN32.
--
Michael

Attachment Content-Type Size
wait-event-set-v6.patch text/plain 29.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2016-09-21 05:20:53 Re: [HACKERS] Error running custom plugin: “output plugins have to declare the _PG_output_plugin_init symbol”
Previous Message Thomas Munro 2016-09-21 04:03:00 Re: Tracking wait event for latches