From: | Alexey Makhmutov <a(dot)makhmutov(at)postgrespro(dot)ru> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: High CPU consumption in cascade replication with large number of walsenders and ConditionVariable broadcast issues |
Date: | 2025-04-22 12:40:53 |
Message-ID: | 67084e03-e294-46b5-b4a1-8065991b61df@postgrespro.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
After playing with the patch a little more, we’ve come to the
conclusion, that the idea to signal CV broadcast from the timer handler
is a risky one, as it creates a large number of execution paths, which
are not present in current code base. It's hard to prove correctness of
application behavior in each such case, so we've decided to use a
different approach.
In the new version of the patch we use timer handler only to set the
flag, which is then checked in the ProcessStartupProcInterrupts
function. This allow us to send signal on timeout if the startup process
is waiting for the arrival of new WAL records (in ReadRecord), but the
notification may be delayed while record is being applied (during redo
handler invocation from ApplyWalRecord). This could increase delay for
some corner cases with non-trivial WAL records like ‘drop database’, but
this should be a rare case and walsender process have its own limit on
the wait time, so the delay won’t be indefinite even in this case.
A new variant of the patch is attached in case anybody else wants to
play with this patch and approach. A slightly improved test case and
formatted CV patch (which is not strictly required anymore for this
case) are attached as well.
Thanks,
Alexey
Attachment | Content-Type | Size |
---|---|---|
0001-CV-correctly-handle-cv_sleep_target-change-2.patch | text/x-patch | 2.3 KB |
0002-Implement-batching-for-cascade-replication-3.patch | text/x-patch | 9.0 KB |
test_scenario.zip | application/zip | 2.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Borisov | 2025-04-22 13:31:57 | Fortify float4 and float8 regression tests by ordering test results |
Previous Message | Anthonin Bonnefoy | 2025-04-22 12:37:19 | Re: Add Pipelining support in psql |