[COMMITTERS] pgsql: Shorten timeouts while waiting for logicalrep worker slotattach

Поиск
Список
Период
Сортировка
От Tom Lane
Тема [COMMITTERS] pgsql: Shorten timeouts while waiting for logicalrep worker slotattach
Дата
Msg-id E1dRL47-0004yT-H1@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Shorten timeouts while waiting for logicalrep worker slot attach/detach.

When waiting for a logical replication worker process to start or stop,
we have to busy-wait until we see it add or remove itself from the
LogicalRepWorker slot in shared memory.  Those loops were using a
one-second delay between checks, but on any reasonably modern machine, it
doesn't take more than a couple of msec for a worker to spawn or shut down.
Reduce the loop delays to 10ms to avoid wasting quite so much time in the
related regression tests.

In principle, a better solution would be to fix things so that the waiting
process can be awakened via its latch at the right time.  But that seems
considerably more invasive, which is undesirable for a post-beta fix.
Worker start/stop performance likely isn't of huge interest anyway for
production purposes, so we might not ever get around to it.

In passing, rearrange the second wait loop in logicalrep_worker_stop()
so that the lock is held at the top of the loop, thus saving one lock
acquisition/release per call, and making it look more like the other loop.

Discussion: https://postgr.es/m/30864.1498861103@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/799f8bc76a92d48b0f7988f4cc50da438cacec7c

Modified Files
--------------
src/backend/replication/logical/launcher.c | 35 +++++++++++++++---------------
1 file changed, 17 insertions(+), 18 deletions(-)


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: [COMMITTERS] pgsql: Fix UPDATE of GENERATED ALWAYS identity columns
Следующее
От: Tom Lane
Дата:
Сообщение: [COMMITTERS] pgsql: Clean up misuse and nonuse of poll_query_until().