RE: POC: enable logical decoding when wal_level = 'replica' without a server restart
От | Hayato Kuroda (Fujitsu) |
---|---|
Тема | RE: POC: enable logical decoding when wal_level = 'replica' without a server restart |
Дата | |
Msg-id | OSCPR01MB14966C5E31CA0ACAD07AF8B5FF524A@OSCPR01MB14966.jpnprd01.prod.outlook.com обсуждение исходный текст |
Ответ на | Re: POC: enable logical decoding when wal_level = 'replica' without a server restart (Masahiko Sawada <sawada.mshk@gmail.com>) |
Ответы |
Re: POC: enable logical decoding when wal_level = 'replica' without a server restart
|
Список | pgsql-hackers |
Dear Sawada-san, While reading more, I found a race condition. In this case the effective_wal_level can be logical even when there is no logical slot. UpdateLogicalDecodingStatusEndOfRecovery() checks the number of slots of the logical slot then release the lock once. Then startup process acquires the lock once and compare with IsLogicalDecodingEnabled(), then update the status afterward if needed. So, wal_level can be inconsistent if the status is changed after the n_logical_slots is read. Steps: a) constructed a primary-standby system b) createad a logical slot on the primary c) createad a logical slot on the standby d) sent a promote signal to standby e) dropped a logical slot on standby, just after startup process released LogicalDecodingControlLock in UpdateLogicalDecodingStatusEndOfRecovery(). After the above, effective_wal_level was keep turning on. Is it the expected behavior? ``` postgres=# SELECT slot_name FROM pg_replication_slots ; slot_name ----------- (0 rows) postgres=# show effective_wal_level ; effective_wal_level --------------------- logical (1 row) postgres=# SELECT pg_is_in_recovery (); pg_is_in_recovery ------------------- f (1 row) ``` Best regards, Hayato Kuroda FUJITSU LIMITED
В списке pgsql-hackers по дате отправления: