@@ -88,8 +88,8 @@ typedef struct
88
88
Latch * caller ;
89
89
} RemoteUserIdResult ;
90
90
91
- static void SendCurrentUserId (void );
92
- static void SendBgWorkerPids (void );
91
+ static void SendCurrentUserId (ProcSignalReason );
92
+ static void SendBgWorkerPids (ProcSignalReason );
93
93
static Oid GetRemoteBackendUserId (PGPROC * proc );
94
94
static List * GetRemoteBackendWorkers (PGPROC * proc );
95
95
static List * GetRemoteBackendQueryStates (PGPROC * leader ,
@@ -261,7 +261,6 @@ _PG_fini(void)
261
261
262
262
/* clear global state */
263
263
list_free (QueryDescStack );
264
- AssignCustomProcSignalHandler (QueryStatePollReason , NULL );
265
264
266
265
/* Uninstall hooks. */
267
266
ExecutorStart_hook = prev_ExecutorStart ;
@@ -605,7 +604,11 @@ pg_query_state(PG_FUNCTION_ARGS)
605
604
funcctx -> max_calls = max_calls ;
606
605
607
606
/* Make tuple descriptor */
607
+ #if PG_VERSION_NUM < 120000
608
608
tupdesc = CreateTemplateTupleDesc (N_ATTRS , false);
609
+ #else
610
+ tupdesc = CreateTemplateTupleDesc (N_ATTRS );
611
+ #endif
609
612
TupleDescInitEntry (tupdesc , (AttrNumber ) 1 , "pid" , INT4OID , -1 , 0 );
610
613
TupleDescInitEntry (tupdesc , (AttrNumber ) 2 , "frame_number" , INT4OID , -1 , 0 );
611
614
TupleDescInitEntry (tupdesc , (AttrNumber ) 3 , "query_text" , TEXTOID , -1 , 0 );
@@ -659,7 +662,7 @@ pg_query_state(PG_FUNCTION_ARGS)
659
662
}
660
663
661
664
static void
662
- SendCurrentUserId (void )
665
+ SendCurrentUserId (ProcSignalReason reason )
663
666
{
664
667
SpinLockAcquire (& counterpart_userid -> mutex );
665
668
counterpart_userid -> userid = GetUserId ();
@@ -702,7 +705,8 @@ GetRemoteBackendUserId(PGPROC *proc)
702
705
#if PG_VERSION_NUM < 100000
703
706
WaitLatch (MyLatch , WL_LATCH_SET , 0 );
704
707
#else
705
- WaitLatch (MyLatch , WL_LATCH_SET , 0 , PG_WAIT_EXTENSION );
708
+ WaitLatch (MyLatch , WL_LATCH_SET | WL_EXIT_ON_PM_DEATH , 0 ,
709
+ PG_WAIT_EXTENSION );
706
710
#endif
707
711
CHECK_FOR_INTERRUPTS ();
708
712
ResetLatch (MyLatch );
@@ -743,8 +747,9 @@ shm_mq_receive_with_timeout(shm_mq_handle *mqh,
743
747
#if PG_VERSION_NUM < 100000
744
748
rc = WaitLatch (MyLatch , WL_LATCH_SET | WL_TIMEOUT , delay );
745
749
#else
746
- rc = WaitLatch (MyLatch , WL_LATCH_SET | WL_TIMEOUT , delay ,
747
- PG_WAIT_EXTENSION );
750
+ rc = WaitLatch (MyLatch ,
751
+ WL_LATCH_SET | WL_EXIT_ON_PM_DEATH | WL_TIMEOUT ,
752
+ delay , PG_WAIT_EXTENSION );
748
753
#endif
749
754
750
755
INSTR_TIME_SET_CURRENT (cur_time );
@@ -800,7 +805,7 @@ typedef struct
800
805
} BgWorkerPids ;
801
806
802
807
static void
803
- SendBgWorkerPids (void )
808
+ SendBgWorkerPids (ProcSignalReason reason )
804
809
{
805
810
ListCell * iter ;
806
811
List * all_workers = NIL ;
0 commit comments