From: | Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru> |
---|---|
To: | Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com> |
Cc: | Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Logical replication ApplyContext bloat |
Date: | 2017-04-19 12:55:11 |
Message-ID: | C20790EE-4AAC-4592-A88C-CF1B385BB21B@postgrespro.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> On 19 Apr 2017, at 14:30, Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com> wrote:
>
> On 19/04/17 12:46, Stas Kelvich wrote:
>>
>> Right now ApplyContext cleaned after each transaction and by this patch I basically
>> suggest to clean it after each command counter increment.
>>
>> So in your definitions that is ApplyMessageContext, most short-lived one. We can
>> rename now ApplyContext -> ApplyMessageContext to make that clear and avoid
>> possible name conflict when somebody will decide to keep something during whole
>> transaction or worker lifespan.
>
> Yeah we can rename, and then rename the ApplyCacheContext to
> ApplyContext. That would leave the ApplyTransactionContext from Simon's
> proposal which is not really need it anywhere right now and I am not
> sure it will be needed given there is still TopTransactionContext
> present. If we really want ApplyTransactionContext we can probably just
> assign it to TopTransactionContext in ensure_transaction.
>
>>
>> P.S. It also seems to me now that resetting context in ensure_transaction() isn’t that
>> good idea, probably better just explicitly call reset at the end of each function involved.
>>
>
> Well it would definitely improve clarity.
>
Okay, done.
With patch MemoryContextStats() shows following hierarchy during slot operations in
apply worker:
TopMemoryContext: 83824 total in 5 blocks; 9224 free (8 chunks); 74600 used
ApplyContext: 8192 total in 1 blocks; 6520 free (4 chunks); 1672 used
ApplyMessageContext: 8192 total in 1 blocks; 6632 free (11 chunks); 1560 used
ExecutorState: 8192 total in 1 blocks; 7624 free (0 chunks); 568 used
ExprContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used
Attachment | Content-Type | Size |
---|---|---|
apply_contexts.patch | application/octet-stream | 6.1 KB |
unknown_filename | text/plain | 95 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Petr Jelinek | 2017-04-19 13:07:23 | Re: Interval for launching the table sync worker |
Previous Message | Ashutosh Bapat | 2017-04-19 12:42:57 | Re: Fixup some misusage of appendStringInfo and friends |