18
18
#include "optimizer/planner.h"
19
19
#include "pgstat.h"
20
20
#include "postmaster/autovacuum.h"
21
- #if PG_VERSION_NUM >= 120000
22
21
#include "replication/walsender.h"
23
- #endif
24
22
#include "storage/ipc.h"
25
23
#include "storage/pg_shmem.h"
26
24
#include "storage/procarray.h"
@@ -119,9 +117,7 @@ get_max_procs_count(void)
119
117
* Starting with pg12, wal senders aren't part of MaxConnections anymore
120
118
* and have to be accounted for.
121
119
*/
122
- #if PG_VERSION_NUM >= 120000
123
120
count += max_wal_senders ;
124
- #endif /* pg 12+ */
125
121
#endif /* pg 15- */
126
122
/* End of MaxBackends calculation. */
127
123
@@ -331,16 +327,9 @@ pgws_shmem_startup(void)
331
327
else
332
328
{
333
329
toc = shm_toc_attach (PG_WAIT_SAMPLING_MAGIC , pgws );
334
-
335
- #if PG_VERSION_NUM >= 100000
336
330
pgws_collector_hdr = shm_toc_lookup (toc , 0 , false);
337
331
pgws_collector_mq = shm_toc_lookup (toc , 1 , false);
338
332
pgws_proc_queryids = shm_toc_lookup (toc , 2 , false);
339
- #else
340
- pgws_collector_hdr = shm_toc_lookup (toc , 0 );
341
- pgws_collector_mq = shm_toc_lookup (toc , 1 );
342
- pgws_proc_queryids = shm_toc_lookup (toc , 2 );
343
- #endif
344
333
}
345
334
346
335
shmem_initialized = true;
@@ -366,7 +355,7 @@ static void
366
355
pgws_cleanup_callback (int code , Datum arg )
367
356
{
368
357
elog (DEBUG3 , "pg_wait_sampling cleanup: detaching shm_mq and releasing queue lock" );
369
- shm_mq_detach_compat (recv_mqh , recv_mq );
358
+ shm_mq_detach (recv_mqh );
370
359
LockRelease (& queueTag , ExclusiveLock , false);
371
360
}
372
361
@@ -463,7 +452,7 @@ pg_wait_sampling_get_current(PG_FUNCTION_ARGS)
463
452
params -> ts = GetCurrentTimestamp ();
464
453
465
454
funcctx -> user_fctx = params ;
466
- tupdesc = CreateTemplateTupleDescCompat ( 4 , false );
455
+ tupdesc = CreateTemplateTupleDesc ( 4 );
467
456
TupleDescInitEntry (tupdesc , (AttrNumber ) 1 , "pid" ,
468
457
INT4OID , -1 , 0 );
469
458
TupleDescInitEntry (tupdesc , (AttrNumber ) 2 , "type" ,
@@ -651,7 +640,7 @@ receive_array(SHMRequest request, Size item_size, Size *count)
651
640
PG_END_ENSURE_ERROR_CLEANUP (pgws_cleanup_callback , 0 );
652
641
653
642
/* We still have to detach and release lock during normal operation. */
654
- shm_mq_detach_compat (recv_mqh , recv_mq );
643
+ shm_mq_detach (recv_mqh );
655
644
LockRelease (& queueTag , ExclusiveLock , false);
656
645
657
646
return result ;
@@ -684,7 +673,7 @@ pg_wait_sampling_get_profile(PG_FUNCTION_ARGS)
684
673
funcctx -> max_calls = profile -> count ;
685
674
686
675
/* Make tuple descriptor */
687
- tupdesc = CreateTemplateTupleDescCompat ( 5 , false );
676
+ tupdesc = CreateTemplateTupleDesc ( 5 );
688
677
TupleDescInitEntry (tupdesc , (AttrNumber ) 1 , "pid" ,
689
678
INT4OID , -1 , 0 );
690
679
TupleDescInitEntry (tupdesc , (AttrNumber ) 2 , "type" ,
@@ -801,7 +790,7 @@ pg_wait_sampling_get_history(PG_FUNCTION_ARGS)
801
790
funcctx -> max_calls = history -> count ;
802
791
803
792
/* Make tuple descriptor */
804
- tupdesc = CreateTemplateTupleDescCompat ( 5 , false );
793
+ tupdesc = CreateTemplateTupleDesc ( 5 );
805
794
TupleDescInitEntry (tupdesc , (AttrNumber ) 1 , "pid" ,
806
795
INT4OID , -1 , 0 );
807
796
TupleDescInitEntry (tupdesc , (AttrNumber ) 2 , "sample_ts" ,
@@ -879,17 +868,6 @@ pgws_planner_hook(Query *parse,
879
868
if (MyProc )
880
869
{
881
870
int i = MyProc - ProcGlobal -> allProcs ;
882
- #if PG_VERSION_NUM >= 110000
883
- /*
884
- * since we depend on queryId we need to check that its size
885
- * is uint64 as we coded in pg_wait_sampling
886
- */
887
- StaticAssertExpr (sizeof (parse -> queryId ) == sizeof (uint64 ),
888
- "queryId size is not uint64" );
889
- #else
890
- StaticAssertExpr (sizeof (parse -> queryId ) == sizeof (uint32 ),
891
- "queryId size is not uint32" );
892
- #endif
893
871
if (!pgws_proc_queryids [i ])
894
872
pgws_proc_queryids [i ] = parse -> queryId ;
895
873
@@ -921,17 +899,6 @@ pgws_ExecutorStart(QueryDesc *queryDesc, int eflags)
921
899
if (MyProc )
922
900
{
923
901
i = MyProc - ProcGlobal -> allProcs ;
924
- #if PG_VERSION_NUM >= 110000
925
- /*
926
- * since we depend on queryId we need to check that its size
927
- * is uint64 as we coded in pg_wait_sampling
928
- */
929
- StaticAssertExpr (sizeof (queryDesc -> plannedstmt -> queryId ) == sizeof (uint64 ),
930
- "queryId size is not uint64" );
931
- #else
932
- StaticAssertExpr (sizeof (queryDesc -> plannedstmt -> queryId ) == sizeof (uint32 ),
933
- "queryId size is not uint32" );
934
- #endif
935
902
if (!pgws_proc_queryids [i ])
936
903
pgws_proc_queryids [i ] = queryDesc -> plannedstmt -> queryId ;
937
904
}
0 commit comments