Re: Unresolved repliaction hang and stop problem.

Поиск
Список
Период
Сортировка
От Amit Kapila
Тема Re: Unresolved repliaction hang and stop problem.
Дата
Msg-id CAA4eK1Ldfjr9UzpNXP_z57crth+0tp=0yAA63+LUKHy06RsYXQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Unresolved repliaction hang and stop problem.  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Список pgsql-hackers
On Thu, Jun 17, 2021 at 7:28 AM Kyotaro Horiguchi
<horikyota.ntt@gmail.com> wrote:
>
> At Wed, 16 Jun 2021 18:28:28 -0400, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote in
> > On 2021-Jun-16, Ha Ka wrote:
> > # Children      Self  Command   Shared Object  Symbol
> > # ........  ........  ........  .............  ..................................
> > #
> >    100.00%     0.00%  postgres  postgres       [.] exec_replication_command
> >             |
> >             ---exec_replication_command
> >                WalSndLoop
> >                XLogSendLogical
> >                LogicalDecodingProcessRecord
> >                |
> >                 --99.51%--ReorderBufferQueueChange
> >                           |
> >                           |--96.06%--hash_seq_search
> >                           |
> >                           |--1.78%--ReorderBufferSerializeTXN
> >                           |          |
> >                           |           --0.52%--errstart
> >                           |
> >                            --0.76%--deregister_seq_scan
> >
> > What this tells me is that ReorderBufferQueueChange is spending a lot of
> > time doing hash_seq_search, which probably is the one in
> > ReorderBufferTXNByXid.
>
> I don't see a call to hash_*seq*_search there. Instead, I see one in
> ReorderBufferCheckMemoryLimit().
>
> If added an elog line in hash_seq_search that is visited only when it
> is called under ReorderBufferQueueChange, then set
> logical_decoding_work_mem to 64kB.
>
> Running the following query calls hash_seq_search (relatively) frequently.
>
> pub=# create table t1 (a int primary key);
> pub=# create publication p1 for table t1;
> sub=# create table t1 (a int primary key);
> sub=# create subscription s1 connection 'host=/tmp port=5432' publication p1;
> pub=# insert into t1 (select a from generate_series(0, 9999) a);
>
> The insert above makes 20 calls to ReorderBufferLargestTXN() (via
> ReorderBufferCheckmemoryLimit()), which loops over hash_seq_search.
>

If there are large transactions then someone can probably set
logical_decoding_work_mem to a higher value.

-- 
With Regards,
Amit Kapila.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: Fix for segfault in logical replication on master
Следующее
От: Fabien COELHO
Дата:
Сообщение: Re: pgbench logging broken by time logic changes