]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Remove redundant SetLatch() calls in interrupt handling functions
authorFujii Masao <fujii@postgresql.org>
Thu, 2 Apr 2026 14:55:30 +0000 (23:55 +0900)
committerFujii Masao <fujii@postgresql.org>
Thu, 2 Apr 2026 14:55:30 +0000 (23:55 +0900)
Interrupt handling functions (e.g., HandleCatchupInterrupt(),
HandleParallelApplyMessageInterrupt()) are called only by
procsignal_sigusr1_handler(), which already calls SetLatch()
for the current process at the end of its processing.
Therefore, these interrupt handling functions do not need to
call SetLatch() themselves.

However, previously, some of these functions redundantly
called SetLatch(). This commit removes those unnecessary
calls.

While duplicate SetLatch() calls are redundant, they are
harmless, so this change is not backpatched.

Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Discussion: https://postgr.es/m/CALj2ACWd5apddj6Cd885WwJ6LquYu_G81C4GoR4xSoDV1x-FEA@mail.gmail.com

src/backend/access/transam/parallel.c
src/backend/commands/async.c
src/backend/replication/logical/applyparallelworker.c
src/backend/replication/walsender.c
src/backend/storage/ipc/sinval.c

index ab1dfb30e7381dc8b6b84a0372f7eaa28de76690..89e9d224eec7d20b85df4e1e520e8b6d8eb3d099 100644 (file)
@@ -1047,7 +1047,7 @@ HandleParallelMessageInterrupt(void)
 {
        InterruptPending = true;
        ParallelMessagePending = true;
-       SetLatch(MyLatch);
+       /* latch will be set by procsignal_sigusr1_handler */
 }
 
 /*
index 5c9a56c3d40782ceaf079c98d3d3acf30f0312cb..e91a62ff42aa2cb5e4e429aa77ef7df8e6fa6dc9 100644 (file)
@@ -2560,8 +2560,7 @@ HandleNotifyInterrupt(void)
        /* signal that work needs to be done */
        notifyInterruptPending = true;
 
-       /* make sure the event is processed in due course */
-       SetLatch(MyLatch);
+       /* latch will be set by procsignal_sigusr1_handler */
 }
 
 /*
index d78693ffa8e80f3a875d93c2b49b6d805bd556b3..798e8d85b3efcf848ae061bb5dd4bc51b6727bfc 100644 (file)
@@ -1000,7 +1000,7 @@ HandleParallelApplyMessageInterrupt(void)
 {
        InterruptPending = true;
        ParallelApplyMessagePending = true;
-       SetLatch(MyLatch);
+       /* latch will be set by procsignal_sigusr1_handler */
 }
 
 /*
index 66507e9c2dddcb1d0c9e72b8440033694d6421b9..2bb3f34dc6d1113ba46cdc2d442a868a4c99ee3a 100644 (file)
@@ -3730,6 +3730,8 @@ HandleWalSndInitStopping(void)
                kill(MyProcPid, SIGTERM);
        else
                got_STOPPING = true;
+
+       /* latch will be set by procsignal_sigusr1_handler */
 }
 
 /*
index 5559f7c1cfab19f155153232a3bc5379d9ef0903..1540c7e06962ec2652bbecf547e1c3b72391935e 100644 (file)
@@ -160,8 +160,7 @@ HandleCatchupInterrupt(void)
 
        catchupInterruptPending = true;
 
-       /* make sure the event is processed in due course */
-       SetLatch(MyLatch);
+       /* latch will be set by procsignal_sigusr1_handler */
 }
 
 /*