@@ -98,6 +98,8 @@ static int on_proc_exit_index,
9898void
9999proc_exit (int code )
100100{
101+ bool noisy = AmCheckpointerProcess () || (getpid () == PostmasterPid );
102+
101103 /* Clean up everything that must be cleaned up */
102104 proc_exit_prepare (code );
103105
@@ -140,6 +142,10 @@ proc_exit(int code)
140142
141143 elog (DEBUG3 , "exit(%d)" , code );
142144
145+ if (noisy )
146+ elog (LOG , "calling exit(%d) at %s" ,
147+ code , current_time_as_str ());
148+
143149 exit (code );
144150}
145151
@@ -151,6 +157,8 @@ proc_exit(int code)
151157static void
152158proc_exit_prepare (int code )
153159{
160+ bool noisy = AmCheckpointerProcess () || (getpid () == PostmasterPid );
161+
154162 /*
155163 * Once we set this flag, we are committed to exit. Any ereport() will
156164 * NOT send control back to the main loop, but right back here.
@@ -197,8 +205,13 @@ proc_exit_prepare(int code)
197205 * possible.
198206 */
199207 while (-- on_proc_exit_index >= 0 )
208+ {
209+ if (noisy )
210+ elog (LOG , "doing on_proc_exit %d at %s" ,
211+ on_proc_exit_index , current_time_as_str ());
200212 (* on_proc_exit_list [on_proc_exit_index ].function ) (code ,
201213 on_proc_exit_list [on_proc_exit_index ].arg );
214+ }
202215
203216 on_proc_exit_index = 0 ;
204217}
@@ -214,6 +227,8 @@ proc_exit_prepare(int code)
214227void
215228shmem_exit (int code )
216229{
230+ bool noisy = AmCheckpointerProcess () || (getpid () == PostmasterPid );
231+
217232 /*
218233 * Call before_shmem_exit callbacks.
219234 *
@@ -225,8 +240,13 @@ shmem_exit(int code)
225240 elog (DEBUG3 , "shmem_exit(%d): %d before_shmem_exit callbacks to make" ,
226241 code , before_shmem_exit_index );
227242 while (-- before_shmem_exit_index >= 0 )
243+ {
244+ if (noisy )
245+ elog (LOG , "doing before_shmem_exit %d at %s" ,
246+ before_shmem_exit_index , current_time_as_str ());
228247 (* before_shmem_exit_list [before_shmem_exit_index ].function ) (code ,
229248 before_shmem_exit_list [before_shmem_exit_index ].arg );
249+ }
230250 before_shmem_exit_index = 0 ;
231251
232252 /*
@@ -258,8 +278,13 @@ shmem_exit(int code)
258278 elog (DEBUG3 , "shmem_exit(%d): %d on_shmem_exit callbacks to make" ,
259279 code , on_shmem_exit_index );
260280 while (-- on_shmem_exit_index >= 0 )
281+ {
282+ if (noisy )
283+ elog (LOG , "doing on_shmem_exit %d at %s" ,
284+ on_shmem_exit_index , current_time_as_str ());
261285 (* on_shmem_exit_list [on_shmem_exit_index ].function ) (code ,
262286 on_shmem_exit_list [on_shmem_exit_index ].arg );
287+ }
263288 on_shmem_exit_index = 0 ;
264289}
265290
0 commit comments