From: | Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com> |
---|---|
To: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru> |
Cc: | Noah Misch <noah(at)leadboat(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: logical replication worker and statistics |
Date: | 2017-04-14 16:09:19 |
Message-ID: | 394ebe96-b03f-2ffa-530a-47fc60e1af16@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 12/04/17 05:41, Peter Eisentraut wrote:
> On 4/10/17 13:06, Stas Kelvich wrote:
>>
>>> On 10 Apr 2017, at 19:50, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
>>>
>>> On 4/10/17 05:49, Stas Kelvich wrote:
>>>> Here is small patch to call statistics in logical worker. Originally i thought that stat
>>>> collection during logical replication should manually account amounts of changed tuples,
>>>> but seems that it is already smoothly handled on relation level. So call to
>>>> pgstat_report_stat() is enough.
>>>
>>> I wonder whether we need a similar call somewhere in tablesync.c. It
>>> seems to work without it, though.
>>
>> I thought it spins up the same worker from worker.c.
>
> It depends on which of the various tablesync scenarios happens. If the
> apply lags behind the tablesync, then the apply doesn't process commit
> messages until it has caught up. So the part of the code you patched
> wouldn't be called.
>
Indeed, if catchup phase didn't happen (because tablesync was faster
than apply) then the commit handler is never called so all the changes
made by copy would be forgotten. Also the tablesync worker might exit
from process_syncing_tables() call which is called before we report
stats in the commit handler so again some changes might be forgotten.
I attached modified version of the patch that also reports stats in
finish_sync_worker() when there is outstanding transaction. The test can
stay the same.
--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Attachment | Content-Type | Size |
---|---|---|
call_pgstat_report_statv2.diff | text/x-diff | 2.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Verite | 2017-04-14 16:37:09 | Re: Variable substitution in psql backtick expansion |
Previous Message | Jaime Casanova | 2017-04-14 15:51:40 | Re: Patch: Write Amplification Reduction Method (WARM) |