public inbox for [email protected]
help / color / mirror / Atom feedFrom: Amit Kapila <[email protected]>
To: [email protected] <[email protected]>
Cc: [email protected] <[email protected]>
Cc: Greg Nancarrow <[email protected]>
Cc: Kyotaro Horiguchi <[email protected]>
Cc: [email protected] <[email protected]>
Cc: [email protected] <[email protected]>
Cc: [email protected] <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Failed transaction statistics to measure the logical replication progress
Date: Thu, 17 Feb 2022 15:13:24 +0530
Message-ID: <CAA4eK1+_p89Bm=UvSo6jAu4pjFga+R30+kMWbZ=+mJk5uOsoxQ@mail.gmail.com> (raw)
In-Reply-To: <TYCPR01MB83732A6796425B20CDC76987ED4A9@TYCPR01MB8373.jpnprd01.prod.outlook.com>
References: <CALDaNm0Wg8XwfqUVnBSSahOtNxGDLNOW1_tc4ikZK=tGfqje-A@mail.gmail.com>
<TYCPR01MB8373A9B6508E44E547A98EF5ED779@TYCPR01MB8373.jpnprd01.prod.outlook.com>
<TYCPR01MB83734A7A0596AC7ADB0DCB51ED779@TYCPR01MB8373.jpnprd01.prod.outlook.com>
<[email protected]>
<TYCPR01MB83736371B66F90C71365ED11ED7B9@TYCPR01MB8373.jpnprd01.prod.outlook.com>
<CAJcOf-dmfinJDr=nOmjX1qNiU_mvW5tG3GyVwsQzRnUBb2ky0A@mail.gmail.com>
<TYCPR01MB8373176545F7AE2CCDA23B81ED7D9@TYCPR01MB8373.jpnprd01.prod.outlook.com>
<TYCPR01MB6128932B793A2E0517421607FB469@TYCPR01MB6128.jpnprd01.prod.outlook.com>
<TYCPR01MB83732A6796425B20CDC76987ED4A9@TYCPR01MB8373.jpnprd01.prod.outlook.com>
On Tue, Jan 4, 2022 at 5:22 PM [email protected]
<[email protected]> wrote:
>
> On Friday, December 31, 2021 10:12 AM Tang, Haiying/唐 海英 <[email protected]> wrote:
> > 4)
> > +void
> > +pgstat_send_subworker_xact_stats(LogicalRepWorker *repWorker, bool
> > +force) {
> > + static TimestampTz last_report = 0;
> > + PgStat_MsgSubWorkerXactEnd msg;
> > +
> > + if (!force)
> > + {
> > ...
> > + if (!TimestampDifferenceExceeds(last_report, now,
> > PGSTAT_STAT_INTERVAL))
> > + return;
> > + last_report = now;
> > + }
> > +
> > ...
> > + if (repWorker->commit_count == 0 && repWorker->abort_count ==
> > 0)
> > + return;
> > ...
> >
> > I think it's better to check commit_count and abort_count first, then check if
> > reach PGSTAT_STAT_INTERVAL.
> > Otherwise if commit_count and abort_count are 0, it is possible that the value
> > of last_report has been updated but it didn't send stats in fact. In this case,
> > last_report is not the real time that send last message.
> Yeah, agreed. This fix is right in terms of the variable name aspect.
>
Can't we use pgstat_report_stat() here? Basically, you can update xact
completetion counters during apply, and then from
pgstat_report_stat(), you can invoke a logical replication worker
stats-related function.
--
With Regards,
Amit Kapila.
view thread (2+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Failed transaction statistics to measure the logical replication progress
In-Reply-To: <CAA4eK1+_p89Bm=UvSo6jAu4pjFga+R30+kMWbZ=+mJk5uOsoxQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox