Hi, I see that in the archiver code, in the function pgarch_MainLoop, the archiver sleeps for a certain time or until there's a signal. The time it sleeps for is represented by:
timeout = PGARCH_AUTOWAKE_INTERVAL - (curtime - last_copy_time); It so happens that last_copy_time and curtime are always set at the same time which always makes timeout equal (actually roughly equal) to PGARCH_AUTOWAKE_INTERVAL. I see that this behaviour was introduced as a part of the commit: d75288fb27b8fe0a926aaab7d75816f091ecdc27. The discussion thread is: https://postgr.es/m/20180629.173418.190173462.horiguchi.kyot...@lab.ntt.co.jp The change was introduced in v31, with the following comment in the discussion thread: - pgarch_MainLoop start the loop with wakened = true when both notified or timed out. Otherwise time_to_stop is set and exits from the loop immediately. So the variable wakened is actually useless. Removed it. This behaviour was different before the commit: d75288fb27b8fe0a926aaab7d75816f091ecdc27, in which the archiver keeps track of how much time has elapsed since last_copy_time in case there was a signal, and it results in a smaller subsequent value of timeout, until timeout is zero. This also avoids calling pgarch_ArchiverCopyLoop before PGARCH_AUTOWAKE_INTERVAL in case there's an intermittent signal. With the current changes it may be okay to always sleep for PGARCH_AUTOWAKE_INTERVAL, but that means curtime and last_copy_time are no more needed. I would like to validate if my understanding is correct, and which of the behaviours we would like to retain. Thanks & Regards, Sravan Velagandula EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company