RE: suppressing useless wakeups in logical/worker.c - Mailing list pgsql-hackers

From Hayato Kuroda (Fujitsu)
Subject RE: suppressing useless wakeups in logical/worker.c
Date
Msg-id TYAPR01MB58669549D0137CC76A9BB6A0F5189@TYAPR01MB5866.jpnprd01.prod.outlook.com
Whole thread Raw
In response to suppressing useless wakeups in logical/worker.c  (Nathan Bossart <nathandbossart@gmail.com>)
Responses Re: suppressing useless wakeups in logical/worker.c  (Nathan Bossart <nathandbossart@gmail.com>)
List pgsql-hackers
Dear Nathan,

Thank you for making the patch! I tested your patch, and it basically worked well.
About following part:

```
            ConfigReloadPending = false;
             ProcessConfigFile(PGC_SIGHUP);
+            now = GetCurrentTimestamp();
+            for (int i = 0; i < NUM_LRW_WAKEUPS; i++)
+                LogRepWorkerComputeNextWakeup(i, now);
+
+            /*
+             * If a wakeup time for starting sync workers was set, just set it
+             * to right now.  It will be recalculated as needed.
+             */
+            if (next_sync_start != PG_INT64_MAX)
+                next_sync_start = now;
         }
```

Do we have to recalculate the NextWakeup when subscriber receives SIGHUP signal?
I think this may cause the unexpected change like following.

Assuming that wal_receiver_timeout is 60s, and wal_sender_timeout on publisher is
0s (or the network between nodes is disconnected).
And we send SIGHUP signal per 20s to subscriber's postmaster.

Currently the last_recv_time is calcurated when the worker accepts messages,
and the value is used for deciding to send a ping. The worker will exit if the
walsender does not reply.

But in your patch, the apply worker calcurates wakeup[LRW_WAKEUP_PING] and
wakeup[LRW_WAKEUP_TERMINATE] again when it gets SIGHUP, so the worker never sends
ping with requestReply = true, and never exits due to the timeout.

My case seems to be crazy, but there may be another issues if it remains.


Best Regards,
Hayato Kuroda
FUJITSU LIMITED




pgsql-hackers by date:

Previous
From: Melih Mutlu
Date:
Subject: Re: [PATCH] Reuse Workers and Replication Slots during Logical Replication
Next
From: Himanshu Upadhyaya
Date:
Subject: Re: HOT chain validation in verify_heapam()