Re: Logical replication and multimaster

Поиск
Список
Период
Сортировка
Искать
От
Petr Jelinek
Тема
Re: Logical replication and multimaster
Дата
Msg-id
56605A90.2010306@2ndquadrant.com
Ответ на
Список
Дерево обсуждения
Logical replication and multimaster Konstantin Knizhnik <k.knizhnik@postgrespro.ru>
Re: Logical replication and multimaster Robert Haas <robertmhaas@gmail.com>
Re: Logical replication and multimaster Konstantin Knizhnik <k.knizhnik@postgrespro.ru>
Re: Logical replication and multimaster Craig Ringer <craig@2ndquadrant.com>
Re: Logical replication and multimaster konstantin knizhnik <k.knizhnik@postgrespro.ru>
Re: Logical replication and multimaster Craig Ringer <craig@2ndquadrant.com>
Re: Logical replication and multimaster Petr Jelinek <petr@2ndquadrant.com>
Re: Logical replication and multimaster Craig Ringer <craig@2ndquadrant.com>
Re: Logical replication and multimaster Craig Ringer <craig@2ndquadrant.com>
Re: Logical replication and multimaster konstantin knizhnik <k.knizhnik@postgrespro.ru>
Re: Logical replication and multimaster Andres Freund <andres@anarazel.de>
Re: Logical replication and multimaster Craig Ringer <craig@2ndquadrant.com>
Re: Logical replication and multimaster konstantin knizhnik <k.knizhnik@postgrespro.ru>
Re: Logical replication and multimaster Craig Ringer <craig@2ndquadrant.com>
Re: Logical replication and multimaster Konstantin Knizhnik <k.knizhnik@postgrespro.ru>
Re: Logical replication and multimaster Craig Ringer <craig@2ndquadrant.com>
Re: Logical replication and multimaster Simon Riggs <simon@2ndQuadrant.com>
Re: Logical replication and multimaster Konstantin Knizhnik <k.knizhnik@postgrespro.ru>
Re: Logical replication and multimaster Konstantin Knizhnik <k.knizhnik@postgrespro.ru>
Re: Logical replication and multimaster Andres Freund <andres@anarazel.de>
Re: Logical replication and multimaster Simon Riggs <simon@2ndQuadrant.com>
Re: Logical replication and multimaster Andres Freund <andres@anarazel.de>
Re: Logical replication and multimaster Simon Riggs <simon@2ndQuadrant.com>
Re: Logical replication and multimaster Simon Riggs <simon@2ndQuadrant.com>
Re: Logical replication and multimaster "Shulgin, Oleksandr" <oleksandr.shulgin@zalando.de>
Re: Logical replication and multimaster Simon Riggs <simon@2ndQuadrant.com>
Re: Logical replication and multimaster Craig Ringer <craig@2ndquadrant.com>
Re: Logical replication and multimaster Craig Ringer <craig@2ndquadrant.com>
Re: Logical replication and multimaster Robert Haas <robertmhaas@gmail.com>
Re: Logical replication and multimaster Craig Ringer <craig@2ndquadrant.com>
Re: Logical replication and multimaster Andres Freund <andres@anarazel.de>
Re: Logical replication and multimaster Robert Haas <robertmhaas@gmail.com>
Re: Logical replication and multimaster Petr Jelinek <petr@2ndquadrant.com>
Re: Logical replication and multimaster Craig Ringer <craig@2ndquadrant.com>
Re: Logical replication and multimaster David Fetter <david@fetter.org>
Re: Logical replication and multimaster Jim Nasby <Jim.Nasby@BlueTreble.com>
Re: [HACKERS] Logical replication and multimaster Jon Erdman <jon@thewickedtribe.net>
Re: Logical replication and multimaster Jon Erdman <postgresql@thewickedtribe.net>
Re: Logical replication and multimaster Craig Ringer <craig@2ndquadrant.com>
On 2015-12-03 14:32, Craig Ringer wrote:
> On 3 December 2015 at 15:27, konstantin knizhnik
> > wrote:
>
>     3. What is the right way of creation of background worker requiring
>     access to shared memory, i.e. having control structure in main memory?
>
>
> This is documented and well established.
>
>     As far as I understand background workers have to be registered
>     either PG_init, either outside Postmaster environment.
>     If extension requires access to shared memory, then it should be
>     registered in shared_preload_libraries list and should be
>     initialized using shmem_startup hook.
>
>
> Correct.
>
> You can use dynamic shmem instead, but there are some issues there IIRC.
> Petr may have more to say there.
> Take a look at the BDR code for some examples, and there are some in
> contrib too I think.
>

If you have your own flock of dynamic workers that you manage yourself, 
it's probably easier to use dynamic shared memory. You can see some 
examples in the tests and also in the parallel query code for how to do 
it. The only real issue we faced with using dynamic shared memory was 
that we needed to do IPC from normal backends and that gets complicated 
when you don't have the worker info in the normal shmem.


The registration timing and working with normal shmem is actually not a 
problem. Just register shmem start hook in _PG_init and if you are 
registering any bgworkers there as well make sure you set bgw_start_time 
correctly (usually what you want is BgWorkerStart_RecoveryFinished). 
Then you'll have the shmem hook called before the bgworker is actually 
started.

--  Petr Jelinek                  http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services


В списке pgsql-hackers по дате отправления
От: Amit Kapila
Дата:
От: Jeff Janes
Дата:
FAQ