Reload configuration more frequently in apply worker.
От | Zhijie Hou (Fujitsu) |
---|---|
Тема | Reload configuration more frequently in apply worker. |
Дата | |
Msg-id | OS0PR01MB5716AF9079CC0755CD015322947E9@OS0PR01MB5716.jpnprd01.prod.outlook.com обсуждение исходный текст |
Ответы |
Re: Reload configuration more frequently in apply worker.
|
Список | pgsql-hackers |
Hi, Currently, the main loop of apply worker looks like below[1]. Since there are two loops, the inner loop will keep receiving and applying message from publisher until no more message left. The worker only reloads the configuration in the outer loop. This means if the publisher keeps sending messages (it could keep sending multiple transactions), the apply worker won't get a chance to update the GUCs. [1] for(;;) /* outer loop */ { for(;;) /* inner loop */ { len = walrcv_receive() if (len == 0) break; ... apply change } ... if (ConfigReloadPending) { ConfigReloadPending = false; ProcessConfigFile(PGC_SIGHUP); } ... } I think it would be better that the apply worker can reflect user's configuration changes sooner. To achieve this, we can add one more ProcessConfigFile() call in the inner loop. Attach the patch for the same. What do you think ? BTW, I saw one BF failure[2] (it's very rare and only happened once in 4 months) which I think is due to the low frequent reload in apply worker. The attached tap test shows how the failure happened. The test use streaming parallel mode and change logical_replication_mode to immediate, we expect serialization to happen in the test. To reproduce the failure easier, we need to add a sleep(1s) in the inner loop of apply worker so that the apply worker won't be able to consume all messages quickly and will be busy in the inner loop. Then the attached test will fail because the leader apply didn't reload the configuration, thus serialization didn't happen. [2] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=mamba&dt=2023-05-12%2008%3A05%3A41 Best Regards, Hou zj
Вложения
В списке pgsql-hackers по дате отправления: