On Wed, Feb 18, 2026 at 4:58 PM shveta malik <[email protected]> wrote: > > On Wed, Feb 18, 2026 at 1:12 PM Amit Kapila <[email protected]> wrote: > > > > On Wed, Feb 18, 2026 at 12:36 PM shveta malik <[email protected]> > > wrote: > > > > > > I tested a few scenarios on the latest patch. Sequence sync worker did > > > not stop in below scenarios: > > > > > > 1) When the subscription was disabled. > > > 2) When the only publication for sequences was dropped from > > > subscription ( ALTER SUBSCRIPTION sub1 DROP PUBLICATION pub_seq;) > > > 3) When all sequences were dropped on sub. > > > > > > Application worker stops in scenario 1, seq-sync worker should also > > > stop. See maybe_reread_subscription(). > > > > > > We need to decide the behavior of the seq-sync worker for 2 and 3. > > > > > > > Shouldn't we try to map (2) and (3) to what we do for table publication? > > > > I thought about it, this is what I have in mind: > > 1) When there is no sequences and tables to be synced, we will be > blocking 2 workers slot, one for apply worker and one for seq-sync > worker. While only apply-worker is enough, as it may restart seq-sync > worker as soon as it notices a sequence. > > 2) In case of apply-worker, when no tables are being published, it > hardly does any work. IIUC, it just sends responses to keep-alive > messages. OTOH, seq-sync worker will begin a transaction and query > pg_subscription_rel every few seconds. I feel, we should avoid this > unnecessary activity if possible. > > Overall, I feel the sequence sync worker is logically different from > the table apply worker. It behaves more like an auxiliary worker > managed by the apply worker and derives all of its state from the > system catalogs. >
I understand that sequence-sync worker won't be doing anything useful in such corner cases but the chances of such situations are rare and the consequences are not that bad. Similarly, one can say that we can exit the launcher process when no subscription is present and the system should figure out and restart when required. In this case also, the apply-worker needs to check from time-to-time or needs to be informed to launch the new sequence-sync worker. I think we can evaluate these cases separately and can decide to write a top-up patch if found useful to make sequence-sync worker detect and exit. -- With Regards, Amit Kapila.
