Re: Statistics updates is delayed when using `commit and chain`

From: Japin Li <japinli(at)hotmail(dot)com>
To: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
Cc: Lætitia Avrot <laetitia(dot)avrot(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Statistics updates is delayed when using `commit and chain`
Date: 2021-07-10 02:31:34
Message-ID: MEYP282MB16691D91C25CB36079C9AC19B6179@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


On Fri, 09 Jul 2021 at 20:25, John Naylor <john(dot)naylor(at)enterprisedb(dot)com> wrote:
> On Fri, Jul 9, 2021 at 7:15 AM Japin Li <japinli(at)hotmail(dot)com> wrote:
>> > /* Send out notify signals and transmit self-notifies */
>> > ProcessCompletedNotifies();
>> >
>> > /*
>> > * Also process incoming notifies, if any. This is
> mostly to
>> > * ensure stable behavior in tests: if any notifies were
>> > * received during the just-finished transaction,
> they'll be
>> > * seen by the client before ReadyForQuery is.
>> > */
>> > if (notifyInterruptPending)
>> > ProcessNotifyInterrupt();
>
> It seems the above would also be skipped in chained transactions -- do we
> need to handle notifies as well?
>

Thanks for your review! Modified.

>> Attached fixes it by call pgstat_report_stat() when we a in COMMIT AND
> CHAIN mode.
>> Any thoughts?
>
> Do we need equivalent logic within the TBLOCK_SUBCOMMIT case also? Either
> way, a comment is probably in order.

Add a new function ProcessNotifiesAndStat() to process notifies and report
statistics, then call this function in TBLOCK_SUBCOMMIT, TBLOCK_END,
TBLOCK_ABORT_END, TBLOCK_ABORT_PENDING and TBLOCK_SUBCOMMIT cases.

Please consider v2 patch to review.

--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.

Attachment Content-Type Size
v2-0001-update-table-stats-after-commit-and-chain.patch text/x-patch 2.8 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2021-07-10 11:56:17 Re: BUG #17083: [PATCH] PostgreSQL fails to build with OpenLDAP 2.5.x
Previous Message PG Bug reporting form 2021-07-09 20:00:01 BUG #17098: Assert failed on composing an error message when adding a type to an extension being dropped