wake up logical workers after ALTER SUBSCRIPTION - Mailing list pgsql-hackers

From Nathan Bossart
Subject wake up logical workers after ALTER SUBSCRIPTION
Date
Msg-id 20221122004119.GA132961@nathanxps13
Whole thread Raw
Responses Re: wake up logical workers after ALTER SUBSCRIPTION
RE: wake up logical workers after ALTER SUBSCRIPTION
Re: wake up logical workers after ALTER SUBSCRIPTION
List pgsql-hackers
Hi hackers,

While working on avoiding unnecessary wakeups in logical/worker.c (as was
done for walreceiver.c in 05a7be9), I noticed that the tests began taking
much longer.  This seems to be caused by the reduced frequency of calls to
maybe_reread_subscription() in LogicalRepApplyLoop().  Presently,
LogicalRepApplyLoop() only waits for up to a second, so the subscription
info is re-read by workers relatively frequently.  If LogicalRepApplyLoop()
sleeps for longer, the subscription info may not be read for much longer.

I think the fix for this problem can be considered independently, as
relying on frequent wakeups seems less than ideal, and the patch seems to
provide a small improvement even before applying the
avoid-unnecessary-wakeups patch.  On my machine, the attached patch
improved 'check-world -j8' run time by ~12 seconds (from 3min 8sec to 2min
56 sec) and src/test/subscription test time by ~17 seconds (from 139
seconds to 122 seconds).

I put the new logic in launcher.c, but it might make more sense to put it
in logical/worker.c.  I think that might require some new #includes in a
couple of files, but otherwise, the patch would likely look about the same.

Thoughts?

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Improve tab completion for ALTER FUNCTION/PROCEDURE/ROUTINE
Next
From: Michael Paquier
Date:
Subject: Re: ps command does not show walsender's connected db