From 511c10fcc11d13ddb9d25462c570be14225d33c9 Mon Sep 17 00:00:00 2001 From: naisila Date: Sun, 7 Dec 2025 21:30:39 +0300 Subject: [PATCH] Remove PG_VERSION_NUM >= 16 and PG_VERSION_NUM < 16 --- src/backend/columnar/columnar_compression.c | 2 - src/backend/columnar/columnar_customscan.c | 15 ---- src/backend/columnar/columnar_metadata.c | 15 +--- src/backend/columnar/columnar_storage.c | 4 - src/backend/columnar/columnar_tableam.c | 40 --------- src/backend/columnar/columnar_writer.c | 4 - .../citus_add_local_table_to_metadata.c | 10 --- src/backend/distributed/commands/collation.c | 2 - .../commands/create_distributed_table.c | 7 -- src/backend/distributed/commands/database.c | 7 -- src/backend/distributed/commands/index.c | 3 - src/backend/distributed/commands/multi_copy.c | 19 ----- src/backend/distributed/commands/role.c | 9 -- src/backend/distributed/commands/vacuum.c | 20 ----- .../distributed/deparser/deparse_role_stmts.c | 14 ---- .../distributed/metadata/metadata_cache.c | 4 - .../distributed/metadata/metadata_utility.c | 5 +- .../distributed/planner/deparse_shard_query.c | 3 +- .../distributed/planner/distributed_planner.c | 7 +- .../planner/fast_path_router_planner.c | 11 --- .../planner/insert_select_planner.c | 6 -- .../planner/local_distributed_join_planner.c | 14 ---- .../distributed/planner/merge_planner.c | 7 -- .../distributed/planner/multi_explain.c | 2 - .../planner/multi_router_planner.c | 15 ---- .../planner/query_colocation_checker.c | 6 -- .../planner/query_pushdown_planning.c | 4 - .../distributed/planner/recursive_planning.c | 19 ----- .../relation_restriction_equivalence.c | 2 - .../replication/multi_logical_replication.c | 5 -- .../shardsplit/shardsplit_decoder.c | 42 ---------- src/backend/distributed/test/fake_am.c | 4 - .../distributed/transaction/lock_graph.c | 82 ------------------- .../transaction/transaction_management.c | 4 - .../distributed/utils/relation_utils.c | 7 -- src/include/columnar/columnar.h | 4 - src/include/columnar/columnar_metadata.h | 4 - src/include/distributed/relation_utils.h | 4 - src/include/distributed/resource_lock.h | 2 - 39 files changed, 4 insertions(+), 430 deletions(-) diff --git a/src/backend/columnar/columnar_compression.c b/src/backend/columnar/columnar_compression.c index 2ff35da98..3af6bb031 100644 --- a/src/backend/columnar/columnar_compression.c +++ b/src/backend/columnar/columnar_compression.c @@ -25,9 +25,7 @@ #include #endif -#if PG_VERSION_NUM >= PG_VERSION_16 #include "varatt.h" -#endif #if HAVE_LIBZSTD #include diff --git a/src/backend/columnar/columnar_customscan.c b/src/backend/columnar/columnar_customscan.c index d97f4cdeb..1359a25ee 100644 --- a/src/backend/columnar/columnar_customscan.c +++ b/src/backend/columnar/columnar_customscan.c @@ -39,10 +39,8 @@ #include "optimizer/paths.h" #include "optimizer/plancat.h" #include "optimizer/restrictinfo.h" -#if PG_VERSION_NUM >= PG_VERSION_16 #include "parser/parse_relation.h" #include "parser/parsetree.h" -#endif #include "utils/builtins.h" #include "utils/lsyscache.h" #include "utils/relcache.h" @@ -140,9 +138,7 @@ static List * set_deparse_context_planstate(List *dpcontext, Node *node, /* other helpers */ static List * ColumnarVarNeeded(ColumnarScanState *columnarScanState); static Bitmapset * ColumnarAttrNeeded(ScanState *ss); -#if PG_VERSION_NUM >= PG_VERSION_16 static Bitmapset * fixup_inherited_columns(Oid parentId, Oid childId, Bitmapset *columns); -#endif /* saved hook value in case of unload */ static set_rel_pathlist_hook_type PreviousSetRelPathlistHook = NULL; @@ -1063,9 +1059,7 @@ FindCandidateRelids(PlannerInfo *root, RelOptInfo *rel, List *joinClauses) * For the relevant PG16 commit requiring this addition: * postgres/postgres@2489d76 */ -#if PG_VERSION_NUM >= PG_VERSION_16 candidateRelids = bms_del_members(candidateRelids, root->outer_join_rels); -#endif return candidateRelids; } @@ -1394,7 +1388,6 @@ AddColumnarScanPath(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte, } int numberOfColumnsRead = 0; -#if PG_VERSION_NUM >= PG_VERSION_16 if (rte->perminfoindex > 0) { /* @@ -1426,9 +1419,6 @@ AddColumnarScanPath(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte, perminfo-> selectedCols)); } -#else - numberOfColumnsRead = bms_num_members(rte->selectedCols); -#endif int numberOfClausesPushed = list_length(allClauses); @@ -1449,8 +1439,6 @@ AddColumnarScanPath(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte, } -#if PG_VERSION_NUM >= PG_VERSION_16 - /* * fixup_inherited_columns * @@ -1509,9 +1497,6 @@ fixup_inherited_columns(Oid parentId, Oid childId, Bitmapset *columns) } -#endif - - /* * CostColumnarScan calculates the cost of scanning the columnar table. The * cost is estimated by using all stripe metadata to estimate based on the diff --git a/src/backend/columnar/columnar_metadata.c b/src/backend/columnar/columnar_metadata.c index cd62c8b0c..76714a382 100644 --- a/src/backend/columnar/columnar_metadata.c +++ b/src/backend/columnar/columnar_metadata.c @@ -62,13 +62,9 @@ #include "distributed/listutils.h" -#if PG_VERSION_NUM >= PG_VERSION_16 #include "parser/parse_relation.h" #include "storage/relfilelocator.h" #include "utils/relfilenumbermap.h" -#else -#include "utils/relfilenodemap.h" -#endif #define COLUMNAR_RELOPTION_NAMESPACE "columnar" #define SLOW_METADATA_ACCESS_WARNING \ @@ -1789,10 +1785,8 @@ create_estate_for_relation(Relation rel) rte->rellockmode = AccessShareLock; /* Prepare permission info on PG 16+ */ -#if PG_VERSION_NUM >= PG_VERSION_16 List *perminfos = NIL; addRTEPermissionInfo(&perminfos, rte); -#endif /* Initialize the range table, with the right signature for each PG version */ #if PG_VERSION_NUM >= PG_VERSION_18 @@ -1804,7 +1798,7 @@ create_estate_for_relation(Relation rel) perminfos, NULL /* unpruned_relids: not used by columnar */ ); -#elif PG_VERSION_NUM >= PG_VERSION_16 +#else /* PG 16–17: three-arg signature (permInfos) */ ExecInitRangeTable( @@ -1812,13 +1806,6 @@ create_estate_for_relation(Relation rel) list_make1(rte), perminfos ); -#else - - /* PG 15: two-arg signature */ - ExecInitRangeTable( - estate, - list_make1(rte) - ); #endif estate->es_output_cid = GetCurrentCommandId(true); diff --git a/src/backend/columnar/columnar_storage.c b/src/backend/columnar/columnar_storage.c index 0ae6ccca3..56d4df798 100644 --- a/src/backend/columnar/columnar_storage.c +++ b/src/backend/columnar/columnar_storage.c @@ -169,11 +169,7 @@ ColumnarStorageInit(SMgrRelation srel, uint64 storageId) } /* create two pages */ -#if PG_VERSION_NUM >= PG_VERSION_16 PGIOAlignedBlock block; -#else - PGAlignedBlock block; -#endif Page page = block.data; /* write metapage */ diff --git a/src/backend/columnar/columnar_tableam.c b/src/backend/columnar/columnar_tableam.c index 33e58b528..53b3e9069 100644 --- a/src/backend/columnar/columnar_tableam.c +++ b/src/backend/columnar/columnar_tableam.c @@ -1098,7 +1098,6 @@ columnar_vacuum_rel(Relation rel, VacuumParams *params, List *indexList = RelationGetIndexList(rel); int nindexes = list_length(indexList); -#if PG_VERSION_NUM >= PG_VERSION_16 struct VacuumCutoffs cutoffs; vacuum_get_cutoffs(rel, params, &cutoffs); @@ -1140,41 +1139,6 @@ columnar_vacuum_rel(Relation rel, VacuumParams *params, false); #endif -#else - TransactionId oldestXmin; - TransactionId freezeLimit; - MultiXactId multiXactCutoff; - - /* initialize xids */ - TransactionId xidFullScanLimit; - MultiXactId mxactFullScanLimit; - vacuum_set_xid_limits(rel, - params->freeze_min_age, - params->freeze_table_age, - params->multixact_freeze_min_age, - params->multixact_freeze_table_age, - &oldestXmin, &freezeLimit, &xidFullScanLimit, - &multiXactCutoff, &mxactFullScanLimit); - - Assert(TransactionIdPrecedesOrEquals(freezeLimit, oldestXmin)); - - /* - * Columnar storage doesn't hold any transaction IDs, so we can always - * just advance to the most aggressive value. - */ - TransactionId newRelFrozenXid = oldestXmin; - MultiXactId newRelminMxid = multiXactCutoff; - - double new_live_tuples = ColumnarTableTupleCount(rel); - - /* all visible pages are always 0 */ - BlockNumber new_rel_allvisible = 0; - - vac_update_relstats(rel, new_rel_pages, new_live_tuples, - new_rel_allvisible, nindexes > 0, - newRelFrozenXid, newRelminMxid, false); -#endif - #if PG_VERSION_NUM >= PG_VERSION_18 pgstat_report_vacuum(RelationGetRelid(rel), rel->rd_rel->relisshared, @@ -2544,11 +2508,7 @@ static const TableAmRoutine columnar_am_methods = { .tuple_lock = columnar_tuple_lock, .finish_bulk_insert = columnar_finish_bulk_insert, -#if PG_VERSION_NUM >= PG_VERSION_16 .relation_set_new_filelocator = columnar_relation_set_new_filelocator, -#else - .relation_set_new_filenode = columnar_relation_set_new_filelocator, -#endif .relation_nontransactional_truncate = columnar_relation_nontransactional_truncate, .relation_copy_data = columnar_relation_copy_data, .relation_copy_for_cluster = columnar_relation_copy_for_cluster, diff --git a/src/backend/columnar/columnar_writer.c b/src/backend/columnar/columnar_writer.c index e698d1a41..a48b1e02e 100644 --- a/src/backend/columnar/columnar_writer.c +++ b/src/backend/columnar/columnar_writer.c @@ -35,12 +35,8 @@ #include "columnar/columnar_storage.h" #include "columnar/columnar_version_compat.h" -#if PG_VERSION_NUM >= PG_VERSION_16 #include "storage/relfilelocator.h" #include "utils/relfilenumbermap.h" -#else -#include "utils/relfilenodemap.h" -#endif struct ColumnarWriteState { diff --git a/src/backend/distributed/commands/citus_add_local_table_to_metadata.c b/src/backend/distributed/commands/citus_add_local_table_to_metadata.c index dfc57f096..64a83fa06 100644 --- a/src/backend/distributed/commands/citus_add_local_table_to_metadata.c +++ b/src/backend/distributed/commands/citus_add_local_table_to_metadata.c @@ -1476,20 +1476,10 @@ InsertMetadataForCitusLocalTable(Oid citusLocalTableId, uint64 shardId, static void FinalizeCitusLocalTableCreation(Oid relationId) { -#if PG_VERSION_NUM >= PG_VERSION_16 - /* * PG16+ supports truncate triggers on foreign tables */ if (RegularTable(relationId) || IsForeignTable(relationId)) -#else - - /* - * If it is a foreign table, then skip creating citus truncate trigger - * as foreign tables do not support truncate triggers. - */ - if (RegularTable(relationId)) -#endif { CreateTruncateTrigger(relationId); } diff --git a/src/backend/distributed/commands/collation.c b/src/backend/distributed/commands/collation.c index 268694034..61e597c51 100644 --- a/src/backend/distributed/commands/collation.c +++ b/src/backend/distributed/commands/collation.c @@ -161,7 +161,6 @@ CreateCollationDDLInternal(Oid collationId, Oid *collowner, char **quotedCollati pfree(collctype); } -#if PG_VERSION_NUM >= PG_VERSION_16 char *collicurules = NULL; datum = SysCacheGetAttr(COLLOID, heapTuple, Anum_pg_collation_collicurules, &isnull); if (!isnull) @@ -170,7 +169,6 @@ CreateCollationDDLInternal(Oid collationId, Oid *collowner, char **quotedCollati appendStringInfo(&collationNameDef, ", rules = %s", quote_literal_cstr(collicurules)); } -#endif if (!collisdeterministic) { appendStringInfoString(&collationNameDef, ", deterministic = false"); diff --git a/src/backend/distributed/commands/create_distributed_table.c b/src/backend/distributed/commands/create_distributed_table.c index e7eaab9af..34d57d592 100644 --- a/src/backend/distributed/commands/create_distributed_table.c +++ b/src/backend/distributed/commands/create_distributed_table.c @@ -1271,17 +1271,10 @@ CreateCitusTable(Oid relationId, CitusTableType tableType, colocationId, citusTableParams.replicationModel, autoConverted); -#if PG_VERSION_NUM >= PG_VERSION_16 - /* * PG16+ supports truncate triggers on foreign tables */ if (RegularTable(relationId) || IsForeignTable(relationId)) -#else - - /* foreign tables do not support TRUNCATE trigger */ - if (RegularTable(relationId)) -#endif { CreateTruncateTrigger(relationId); } diff --git a/src/backend/distributed/commands/database.c b/src/backend/distributed/commands/database.c index 3586fa2cd..91ea2c437 100644 --- a/src/backend/distributed/commands/database.c +++ b/src/backend/distributed/commands/database.c @@ -81,10 +81,7 @@ typedef struct DatabaseCollationInfo char *datctype; char *daticulocale; char *datcollversion; - -#if PG_VERSION_NUM >= PG_VERSION_16 char *daticurules; -#endif } DatabaseCollationInfo; static char * GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database @@ -853,14 +850,12 @@ GetDatabaseCollation(Oid dbOid) info.datcollversion = TextDatumGetCString(collverDatum); } -#if PG_VERSION_NUM >= PG_VERSION_16 Datum icurulesDatum = heap_getattr(tup, Anum_pg_database_daticurules, tupdesc, &isNull); if (!isNull) { info.daticurules = TextDatumGetCString(icurulesDatum); } -#endif table_close(rel, AccessShareLock); heap_freetuple(tup); @@ -954,13 +949,11 @@ GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database databaseForm) quote_identifier(GetLocaleProviderString( databaseForm->datlocprovider))); -#if PG_VERSION_NUM >= PG_VERSION_16 if (collInfo.daticurules != NULL) { appendStringInfo(&str, " ICU_RULES = %s", quote_identifier( collInfo.daticurules)); } -#endif return str.data; } diff --git a/src/backend/distributed/commands/index.c b/src/backend/distributed/commands/index.c index d95c53fb5..b5cf4f7c8 100644 --- a/src/backend/distributed/commands/index.c +++ b/src/backend/distributed/commands/index.c @@ -52,10 +52,7 @@ #include "distributed/resource_lock.h" #include "distributed/version_compat.h" #include "distributed/worker_manager.h" - -#if PG_VERSION_NUM >= PG_VERSION_16 #include "catalog/pg_namespace.h" -#endif /* Local functions forward declarations for helper functions */ diff --git a/src/backend/distributed/commands/multi_copy.c b/src/backend/distributed/commands/multi_copy.c index c7abe80de..8bf2947a9 100644 --- a/src/backend/distributed/commands/multi_copy.c +++ b/src/backend/distributed/commands/multi_copy.c @@ -110,10 +110,7 @@ #include "distributed/transmit.h" #include "distributed/version_compat.h" #include "distributed/worker_protocol.h" - -#if PG_VERSION_NUM >= PG_VERSION_16 #include "distributed/relation_utils.h" -#endif /* constant used in binary protocol */ @@ -3251,12 +3248,8 @@ CheckCopyPermissions(CopyStmt *copyStatement) RangeTblEntry *rte = (RangeTblEntry*) linitial(range_table); tupDesc = RelationGetDescr(rel); -#if PG_VERSION_NUM >= PG_VERSION_16 /* create permission info for rte */ RTEPermissionInfo *perminfo = GetFilledPermissionInfo(rel->rd_id, rte->inh, required_access); -#else - rte->requiredPerms = required_access; -#endif attnums = CopyGetAttnums(tupDesc, rel, copyStatement->attlist); foreach(cur, attnums) @@ -3265,29 +3258,17 @@ CheckCopyPermissions(CopyStmt *copyStatement) if (is_from) { -#if PG_VERSION_NUM >= PG_VERSION_16 perminfo->insertedCols = bms_add_member(perminfo->insertedCols, attno); -#else - rte->insertedCols = bms_add_member(rte->insertedCols, attno); -#endif } else { -#if PG_VERSION_NUM >= PG_VERSION_16 perminfo->selectedCols = bms_add_member(perminfo->selectedCols, attno); -#else - rte->selectedCols = bms_add_member(rte->selectedCols, attno); -#endif } } -#if PG_VERSION_NUM >= PG_VERSION_16 /* link rte to its permission info then check permissions */ rte->perminfoindex = 1; ExecCheckPermissions(list_make1(rte), list_make1(perminfo), true); -#else - ExecCheckRTPerms(range_table, true); -#endif /* TODO: Perform RLS checks once supported */ diff --git a/src/backend/distributed/commands/role.c b/src/backend/distributed/commands/role.c index 24020e171..98f6ce141 100644 --- a/src/backend/distributed/commands/role.c +++ b/src/backend/distributed/commands/role.c @@ -851,12 +851,8 @@ GenerateGrantRoleStmtsFromOptions(RoleSpec *roleSpec, List *options) if (strcmp(option->defname, "adminmembers") == 0) { -#if PG_VERSION_NUM >= PG_VERSION_16 DefElem *opt = makeDefElem("admin", (Node *) makeBoolean(true), -1); grantRoleStmt->opt = list_make1(opt); -#else - grantRoleStmt->admin_opt = true; -#endif } stmts = lappend(stmts, grantRoleStmt); @@ -916,8 +912,6 @@ GenerateGrantRoleStmtsOfRole(Oid roleid) grantorRole->rolename = GetUserNameFromId(membership->grantor, false); grantRoleStmt->grantor = grantorRole; -#if PG_VERSION_NUM >= PG_VERSION_16 - /* inherit option is always included */ DefElem *inherit_opt; if (membership->inherit_option) @@ -943,9 +937,6 @@ GenerateGrantRoleStmtsOfRole(Oid roleid) DefElem *set_opt = makeDefElem("set", (Node *) makeBoolean(false), -1); grantRoleStmt->opt = lappend(grantRoleStmt->opt, set_opt); } -#else - grantRoleStmt->admin_opt = membership->admin_option; -#endif stmts = lappend(stmts, grantRoleStmt); } diff --git a/src/backend/distributed/commands/vacuum.c b/src/backend/distributed/commands/vacuum.c index 08064b4b0..c8256b8da 100644 --- a/src/backend/distributed/commands/vacuum.c +++ b/src/backend/distributed/commands/vacuum.c @@ -43,9 +43,7 @@ typedef struct CitusVacuumParams VacOptValue truncate; VacOptValue index_cleanup; int nworkers; -#if PG_VERSION_NUM >= PG_VERSION_16 int ring_size; -#endif } CitusVacuumParams; /* @@ -353,19 +351,12 @@ DeparseVacuumStmtPrefix(CitusVacuumParams vacuumParams) } /* if no flags remain, exit early */ -#if PG_VERSION_NUM >= PG_VERSION_16 if (vacuumFlags & VACOPT_PROCESS_TOAST && vacuumFlags & VACOPT_PROCESS_MAIN) { /* process toast and process main are true by default */ if (((vacuumFlags & ~VACOPT_PROCESS_TOAST) & ~VACOPT_PROCESS_MAIN) == 0 && vacuumParams.ring_size == -1 && -#else - if (vacuumFlags & VACOPT_PROCESS_TOAST) - { - /* process toast is true by default */ - if ((vacuumFlags & ~VACOPT_PROCESS_TOAST) == 0 && -#endif vacuumParams.truncate == VACOPTVALUE_UNSPECIFIED && vacuumParams.index_cleanup == VACOPTVALUE_UNSPECIFIED && vacuumParams.nworkers == VACUUM_PARALLEL_NOTSET @@ -413,7 +404,6 @@ DeparseVacuumStmtPrefix(CitusVacuumParams vacuumParams) appendStringInfoString(vacuumPrefix, "PROCESS_TOAST FALSE,"); } -#if PG_VERSION_NUM >= PG_VERSION_16 if (!(vacuumFlags & VACOPT_PROCESS_MAIN)) { appendStringInfoString(vacuumPrefix, "PROCESS_MAIN FALSE,"); @@ -433,7 +423,6 @@ DeparseVacuumStmtPrefix(CitusVacuumParams vacuumParams) { appendStringInfo(vacuumPrefix, "BUFFER_USAGE_LIMIT %d,", vacuumParams.ring_size); } -#endif if (vacuumParams.truncate != VACOPTVALUE_UNSPECIFIED) { @@ -537,13 +526,10 @@ VacuumStmtParams(VacuumStmt *vacstmt) bool full = false; bool disable_page_skipping = false; bool process_toast = true; - -#if PG_VERSION_NUM >= PG_VERSION_16 bool process_main = true; bool skip_database_stats = false; bool only_database_stats = false; params.ring_size = -1; -#endif /* Set default value */ params.index_cleanup = VACOPTVALUE_UNSPECIFIED; @@ -563,13 +549,11 @@ VacuumStmtParams(VacuumStmt *vacstmt) { skip_locked = defGetBoolean(opt); } -#if PG_VERSION_NUM >= PG_VERSION_16 else if (strcmp(opt->defname, "buffer_usage_limit") == 0) { char *vac_buffer_size = defGetString(opt); parse_int(vac_buffer_size, ¶ms.ring_size, GUC_UNIT_KB, NULL); } -#endif else if (!vacstmt->is_vacuumcmd) { ereport(ERROR, @@ -594,7 +578,6 @@ VacuumStmtParams(VacuumStmt *vacstmt) { disable_page_skipping = defGetBoolean(opt); } -#if PG_VERSION_NUM >= PG_VERSION_16 else if (strcmp(opt->defname, "process_main") == 0) { process_main = defGetBoolean(opt); @@ -607,7 +590,6 @@ VacuumStmtParams(VacuumStmt *vacstmt) { only_database_stats = defGetBoolean(opt); } -#endif else if (strcmp(opt->defname, "process_toast") == 0) { process_toast = defGetBoolean(opt); @@ -678,11 +660,9 @@ VacuumStmtParams(VacuumStmt *vacstmt) (analyze ? VACOPT_ANALYZE : 0) | (freeze ? VACOPT_FREEZE : 0) | (full ? VACOPT_FULL : 0) | -#if PG_VERSION_NUM >= PG_VERSION_16 (process_main ? VACOPT_PROCESS_MAIN : 0) | (skip_database_stats ? VACOPT_SKIP_DATABASE_STATS : 0) | (only_database_stats ? VACOPT_ONLY_DATABASE_STATS : 0) | -#endif (process_toast ? VACOPT_PROCESS_TOAST : 0) | (disable_page_skipping ? VACOPT_DISABLE_PAGE_SKIPPING : 0); return params; diff --git a/src/backend/distributed/deparser/deparse_role_stmts.c b/src/backend/distributed/deparser/deparse_role_stmts.c index 61c0be246..1f1032672 100644 --- a/src/backend/distributed/deparser/deparse_role_stmts.c +++ b/src/backend/distributed/deparser/deparse_role_stmts.c @@ -400,7 +400,6 @@ DeparseGrantRoleStmt(Node *node) static void AppendRevokeAdminOptionFor(StringInfo buf, GrantRoleStmt *stmt) { -#if PG_VERSION_NUM >= PG_VERSION_16 if (!stmt->is_grant) { DefElem *opt = NULL; @@ -423,12 +422,6 @@ AppendRevokeAdminOptionFor(StringInfo buf, GrantRoleStmt *stmt) } } } -#else - if (!stmt->is_grant && stmt->admin_opt) - { - appendStringInfo(buf, "ADMIN OPTION FOR "); - } -#endif } @@ -437,7 +430,6 @@ AppendGrantWithAdminOption(StringInfo buf, GrantRoleStmt *stmt) { if (stmt->is_grant) { -#if PG_VERSION_NUM >= PG_VERSION_16 int opt_count = 0; DefElem *opt = NULL; foreach_declared_ptr(opt, stmt->opt) @@ -463,12 +455,6 @@ AppendGrantWithAdminOption(StringInfo buf, GrantRoleStmt *stmt) } } } -#else - if (stmt->admin_opt) - { - appendStringInfo(buf, " WITH ADMIN OPTION"); - } -#endif } } diff --git a/src/backend/distributed/metadata/metadata_cache.c b/src/backend/distributed/metadata/metadata_cache.c index 9694b85bf..87463788f 100644 --- a/src/backend/distributed/metadata/metadata_cache.c +++ b/src/backend/distributed/metadata/metadata_cache.c @@ -88,10 +88,6 @@ #include "distributed/worker_manager.h" #include "distributed/worker_protocol.h" -#if PG_VERSION_NUM < PG_VERSION_16 -#include "utils/relfilenodemap.h" -#endif - /* user configuration */ int ReadFromSecondaries = USE_SECONDARY_NODES_NEVER; diff --git a/src/backend/distributed/metadata/metadata_utility.c b/src/backend/distributed/metadata/metadata_utility.c index 1fb3d6fd0..6c819b142 100644 --- a/src/backend/distributed/metadata/metadata_utility.c +++ b/src/backend/distributed/metadata/metadata_utility.c @@ -29,6 +29,7 @@ #include "catalog/pg_constraint.h" #include "catalog/pg_extension.h" #include "catalog/pg_namespace.h" +#include "catalog/pg_proc_d.h" #include "catalog/pg_type.h" #include "commands/extension.h" #include "commands/sequence.h" @@ -81,10 +82,6 @@ #include "distributed/worker_manager.h" #include "distributed/worker_protocol.h" -#if PG_VERSION_NUM >= PG_VERSION_16 -#include "catalog/pg_proc_d.h" -#endif - #define DISK_SPACE_FIELDS 2 /* Local functions forward declarations */ diff --git a/src/backend/distributed/planner/deparse_shard_query.c b/src/backend/distributed/planner/deparse_shard_query.c index b22bb8028..4b3d3664e 100644 --- a/src/backend/distributed/planner/deparse_shard_query.c +++ b/src/backend/distributed/planner/deparse_shard_query.c @@ -610,11 +610,10 @@ ConvertRteToSubqueryWithEmptyResult(RangeTblEntry *rte) subquery->jointree = joinTree; rte->rtekind = RTE_SUBQUERY; -#if PG_VERSION_NUM >= PG_VERSION_16 /* no permission checking for this RTE */ rte->perminfoindex = 0; -#endif + rte->subquery = subquery; rte->alias = copyObject(rte->eref); } diff --git a/src/backend/distributed/planner/distributed_planner.c b/src/backend/distributed/planner/distributed_planner.c index dcd6ad6cd..c754e2bc0 100644 --- a/src/backend/distributed/planner/distributed_planner.c +++ b/src/backend/distributed/planner/distributed_planner.c @@ -29,6 +29,7 @@ #include "optimizer/plancat.h" #include "optimizer/planmain.h" #include "optimizer/planner.h" +#include "parser/parse_relation.h" #include "parser/parse_type.h" #include "parser/parsetree.h" #include "utils/builtins.h" @@ -71,10 +72,6 @@ #include "distributed/version_compat.h" #include "distributed/worker_shard_visibility.h" -#if PG_VERSION_NUM >= PG_VERSION_16 -#include "parser/parse_relation.h" -#endif - static List *plannerRestrictionContextList = NIL; int MultiTaskQueryLogLevel = CITUS_LOG_LEVEL_OFF; /* multi-task query log level */ @@ -1510,7 +1507,6 @@ static void ConcatenateRTablesAndPerminfos(PlannedStmt *mainPlan, PlannedStmt *concatPlan) { mainPlan->rtable = list_concat(mainPlan->rtable, concatPlan->rtable); -#if PG_VERSION_NUM >= PG_VERSION_16 /* * concatPlan's range table list is concatenated to mainPlan's range table list @@ -1532,7 +1528,6 @@ ConcatenateRTablesAndPerminfos(PlannedStmt *mainPlan, PlannedStmt *concatPlan) /* finally, concatenate perminfos as well */ mainPlan->permInfos = list_concat(mainPlan->permInfos, concatPlan->permInfos); -#endif } diff --git a/src/backend/distributed/planner/fast_path_router_planner.c b/src/backend/distributed/planner/fast_path_router_planner.c index 80afc7afa..63c68f03a 100644 --- a/src/backend/distributed/planner/fast_path_router_planner.c +++ b/src/backend/distributed/planner/fast_path_router_planner.c @@ -116,24 +116,15 @@ PlannedStmt * GeneratePlaceHolderPlannedStmt(Query *parse) { PlannedStmt *result = makeNode(PlannedStmt); -#if PG_VERSION_NUM >= PG_VERSION_16 SeqScan *scanNode = makeNode(SeqScan); Plan *plan = &(scanNode->scan.plan); -#else - Scan *scanNode = makeNode(Scan); - Plan *plan = &scanNode->plan; -#endif FastPathRestrictionContext fprCtxt PG_USED_FOR_ASSERTS_ONLY = { 0 }; Assert(FastPathRouterQuery(parse, &fprCtxt)); /* there is only a single relation rte */ -#if PG_VERSION_NUM >= PG_VERSION_16 scanNode->scan.scanrelid = 1; -#else - scanNode->scanrelid = 1; -#endif plan->targetlist = copyObject(FetchStatementTargetList((Node *) parse)); @@ -149,9 +140,7 @@ GeneratePlaceHolderPlannedStmt(Query *parse) result->stmt_len = parse->stmt_len; result->rtable = copyObject(parse->rtable); -#if PG_VERSION_NUM >= PG_VERSION_16 result->permInfos = copyObject(parse->rteperminfos); -#endif result->planTree = (Plan *) plan; result->hasReturning = (parse->returningList != NIL); diff --git a/src/backend/distributed/planner/insert_select_planner.c b/src/backend/distributed/planner/insert_select_planner.c index 554ac631e..e123d649a 100644 --- a/src/backend/distributed/planner/insert_select_planner.c +++ b/src/backend/distributed/planner/insert_select_planner.c @@ -623,8 +623,6 @@ CreateCombineQueryForRouterPlan(DistributedPlan *distPlan) combineQuery->canSetTag = true; combineQuery->rtable = list_make1(rangeTableEntry); -#if PG_VERSION_NUM >= PG_VERSION_16 - /* * This part of the code is more of a sanity check for readability, * it doesn't really do anything. @@ -636,7 +634,6 @@ CreateCombineQueryForRouterPlan(DistributedPlan *distPlan) Assert(rangeTableEntry->rtekind == RTE_FUNCTION && rangeTableEntry->perminfoindex == 0); combineQuery->rteperminfos = NIL; -#endif combineQuery->targetList = targetList; combineQuery->jointree = joinTree; @@ -1599,13 +1596,10 @@ WrapSubquery(Query *subquery) outerQuery->rtable = list_make1(rte_subq); -#if PG_VERSION_NUM >= PG_VERSION_16 - /* Ensure RTE_SUBQUERY has proper permission handling */ Assert(rte_subq->rtekind == RTE_SUBQUERY && rte_subq->perminfoindex == 0); outerQuery->rteperminfos = NIL; -#endif RangeTblRef *rtref = makeNode(RangeTblRef); rtref->rtindex = 1; /* Only one RTE, so index is 1 */ diff --git a/src/backend/distributed/planner/local_distributed_join_planner.c b/src/backend/distributed/planner/local_distributed_join_planner.c index 2760377bb..7b44a9c21 100644 --- a/src/backend/distributed/planner/local_distributed_join_planner.c +++ b/src/backend/distributed/planner/local_distributed_join_planner.c @@ -135,9 +135,7 @@ typedef struct RangeTableEntryDetails RangeTblEntry *rangeTableEntry; List *requiredAttributeNumbers; bool hasConstantFilterOnUniqueColumn; -#if PG_VERSION_NUM >= PG_VERSION_16 RTEPermissionInfo *perminfo; -#endif } RangeTableEntryDetails; /* @@ -208,17 +206,11 @@ RecursivelyPlanLocalTableJoins(Query *query, GetPlannerRestrictionContext(context); List *rangeTableList = query->rtable; -#if PG_VERSION_NUM >= PG_VERSION_16 List *rteperminfos = query->rteperminfos; -#endif int resultRTEIdentity = ResultRTEIdentity(query); ConversionCandidates *conversionCandidates = CreateConversionCandidates(plannerRestrictionContext, -#if PG_VERSION_NUM >= PG_VERSION_16 rangeTableList, resultRTEIdentity, rteperminfos); -#else - rangeTableList, resultRTEIdentity, NIL); -#endif ConversionChoice conversionChoise = GetConversionChoice(conversionCandidates, plannerRestrictionContext); @@ -333,12 +325,8 @@ ConvertRTEsToSubquery(List *rangeTableEntryDetailsList, RecursivePlanningContext RangeTblEntry *rangeTableEntry = rangeTableEntryDetails->rangeTableEntry; List *requiredAttributeNumbers = rangeTableEntryDetails->requiredAttributeNumbers; ReplaceRTERelationWithRteSubquery(rangeTableEntry, -#if PG_VERSION_NUM >= PG_VERSION_16 requiredAttributeNumbers, context, rangeTableEntryDetails->perminfo); -#else - requiredAttributeNumbers, context, NULL); -#endif } } @@ -581,14 +569,12 @@ CreateConversionCandidates(PlannerRestrictionContext *plannerRestrictionContext, RequiredAttrNumbersForRelation(rangeTableEntry, plannerRestrictionContext); rangeTableEntryDetails->hasConstantFilterOnUniqueColumn = HasConstantFilterOnUniqueColumn(rangeTableEntry, relationRestriction); -#if PG_VERSION_NUM >= PG_VERSION_16 rangeTableEntryDetails->perminfo = NULL; if (rangeTableEntry->perminfoindex) { rangeTableEntryDetails->perminfo = getRTEPermissionInfo(rteperminfos, rangeTableEntry); } -#endif bool referenceOrDistributedTable = IsCitusTableType(rangeTableEntry->relid, REFERENCE_TABLE) || diff --git a/src/backend/distributed/planner/merge_planner.c b/src/backend/distributed/planner/merge_planner.c index c456fa341..52c726c87 100644 --- a/src/backend/distributed/planner/merge_planner.c +++ b/src/backend/distributed/planner/merge_planner.c @@ -835,11 +835,9 @@ ConvertCteRTEIntoSubquery(Query *mergeQuery, RangeTblEntry *sourceRte) Query *cteQuery = (Query *) copyObject(sourceCte->ctequery); sourceRte->rtekind = RTE_SUBQUERY; -#if PG_VERSION_NUM >= PG_VERSION_16 /* sanity check - sourceRte was RTE_CTE previously so it should have no perminfo */ Assert(sourceRte->perminfoindex == 0); -#endif /* * As we are delinking the CTE from main query, we have to walk through the @@ -889,8 +887,6 @@ ConvertRelationRTEIntoSubquery(Query *mergeQuery, RangeTblEntry *sourceRte, /* we copy the input rteRelation to preserve the rteIdentity */ RangeTblEntry *newRangeTableEntry = copyObject(sourceRte); sourceResultsQuery->rtable = list_make1(newRangeTableEntry); - -#if PG_VERSION_NUM >= PG_VERSION_16 sourceResultsQuery->rteperminfos = NIL; if (sourceRte->perminfoindex) { @@ -902,7 +898,6 @@ ConvertRelationRTEIntoSubquery(Query *mergeQuery, RangeTblEntry *sourceRte, newRangeTableEntry->perminfoindex = 1; sourceResultsQuery->rteperminfos = list_make1(perminfo); } -#endif /* set the FROM expression to the subquery */ newRangeTableRef->rtindex = SINGLE_RTE_INDEX; @@ -929,9 +924,7 @@ ConvertRelationRTEIntoSubquery(Query *mergeQuery, RangeTblEntry *sourceRte, /* replace the function with the constructed subquery */ sourceRte->rtekind = RTE_SUBQUERY; -#if PG_VERSION_NUM >= PG_VERSION_16 sourceRte->perminfoindex = 0; -#endif sourceRte->subquery = sourceResultsQuery; sourceRte->inh = false; } diff --git a/src/backend/distributed/planner/multi_explain.c b/src/backend/distributed/planner/multi_explain.c index d11aae02f..52e56030e 100644 --- a/src/backend/distributed/planner/multi_explain.c +++ b/src/backend/distributed/planner/multi_explain.c @@ -287,13 +287,11 @@ PG_FUNCTION_INFO_V1(worker_save_query_explain_analyze); void CitusExplainScan(CustomScanState *node, List *ancestors, struct ExplainState *es) { -#if PG_VERSION_NUM >= PG_VERSION_16 if (es->generic) { ereport(ERROR, (errmsg( "EXPLAIN GENERIC_PLAN is currently not supported for Citus tables"))); } -#endif CitusScanState *scanState = (CitusScanState *) node; DistributedPlan *distributedPlan = scanState->distributedPlan; diff --git a/src/backend/distributed/planner/multi_router_planner.c b/src/backend/distributed/planner/multi_router_planner.c index 14ce199c8..8197a7047 100644 --- a/src/backend/distributed/planner/multi_router_planner.c +++ b/src/backend/distributed/planner/multi_router_planner.c @@ -2259,13 +2259,10 @@ ConvertToQueryOnShard(Query *query, Oid citusTableOid, Oid shardId) Assert(shardRelationId != InvalidOid); citusTableRte->relid = shardRelationId; -#if PG_VERSION_NUM >= PG_VERSION_16 - /* Change the range table permission oid to that of the shard's (PG16+) */ Assert(list_length(query->rteperminfos) == 1); RTEPermissionInfo *rtePermInfo = (RTEPermissionInfo *) linitial(query->rteperminfos); rtePermInfo->relid = shardRelationId; -#endif return true; } @@ -2573,18 +2570,6 @@ SelectsFromDistributedTable(List *rangeTableList, Query *query) continue; } -#if PG_VERSION_NUM >= 150013 && PG_VERSION_NUM < PG_VERSION_16 - if (rangeTableEntry->rtekind == RTE_SUBQUERY && rangeTableEntry->relkind == 0) - { - /* - * In PG15.13 commit https://github.com/postgres/postgres/commit/317aba70e - * relid is retained when converting views to subqueries, - * so we need an extra check identifying those views - */ - continue; - } -#endif - if (rangeTableEntry->relkind == RELKIND_VIEW || rangeTableEntry->relkind == RELKIND_MATVIEW) { diff --git a/src/backend/distributed/planner/query_colocation_checker.c b/src/backend/distributed/planner/query_colocation_checker.c index d298b0f46..4dcb0362c 100644 --- a/src/backend/distributed/planner/query_colocation_checker.c +++ b/src/backend/distributed/planner/query_colocation_checker.c @@ -81,16 +81,12 @@ CreateColocatedJoinChecker(Query *subquery, PlannerRestrictionContext *restricti * functions (i.e., FilterPlannerRestrictionForQuery()) rely on queries * not relations. */ -#if PG_VERSION_NUM >= PG_VERSION_16 RTEPermissionInfo *perminfo = NULL; if (anchorRangeTblEntry->perminfoindex) { perminfo = getRTEPermissionInfo(subquery->rteperminfos, anchorRangeTblEntry); } anchorSubquery = WrapRteRelationIntoSubquery(anchorRangeTblEntry, NIL, perminfo); -#else - anchorSubquery = WrapRteRelationIntoSubquery(anchorRangeTblEntry, NIL, NULL); -#endif } else if (anchorRangeTblEntry->rtekind == RTE_SUBQUERY) { @@ -286,13 +282,11 @@ WrapRteRelationIntoSubquery(RangeTblEntry *rteRelation, RangeTblEntry *newRangeTableEntry = copyObject(rteRelation); subquery->rtable = list_make1(newRangeTableEntry); -#if PG_VERSION_NUM >= PG_VERSION_16 if (perminfo) { newRangeTableEntry->perminfoindex = 1; subquery->rteperminfos = list_make1(perminfo); } -#endif /* set the FROM expression to the subquery */ newRangeTableRef = makeNode(RangeTblRef); diff --git a/src/backend/distributed/planner/query_pushdown_planning.c b/src/backend/distributed/planner/query_pushdown_planning.c index b94412f2b..1d6a87543 100644 --- a/src/backend/distributed/planner/query_pushdown_planning.c +++ b/src/backend/distributed/planner/query_pushdown_planning.c @@ -2054,9 +2054,7 @@ SubqueryPushdownMultiNodeTree(Query *originalQuery) pushedDownQuery->targetList = subqueryTargetEntryList; pushedDownQuery->jointree = copyObject(queryTree->jointree); pushedDownQuery->rtable = copyObject(queryTree->rtable); -#if PG_VERSION_NUM >= PG_VERSION_16 pushedDownQuery->rteperminfos = copyObject(queryTree->rteperminfos); -#endif pushedDownQuery->setOperations = copyObject(queryTree->setOperations); pushedDownQuery->querySource = queryTree->querySource; pushedDownQuery->hasSubLinks = queryTree->hasSubLinks; @@ -2190,9 +2188,7 @@ CreateSubqueryTargetListAndAdjustVars(List *columnList) * the var - is empty. Otherwise, when given the query, the Postgres planner * may attempt to access a non-existent range table and segfault, as in #7787. */ -#if PG_VERSION_NUM >= PG_VERSION_16 column->varnullingrels = NULL; -#endif } return subqueryTargetEntryList; diff --git a/src/backend/distributed/planner/recursive_planning.c b/src/backend/distributed/planner/recursive_planning.c index 139b30231..2df9038c6 100644 --- a/src/backend/distributed/planner/recursive_planning.c +++ b/src/backend/distributed/planner/recursive_planning.c @@ -973,7 +973,6 @@ RecursivelyPlanDistributedJoinNode(Node *node, Query *query, List *requiredAttributes = RequiredAttrNumbersForRelation(distributedRte, restrictionContext); -#if PG_VERSION_NUM >= PG_VERSION_16 RTEPermissionInfo *perminfo = NULL; if (distributedRte->perminfoindex) { @@ -982,10 +981,6 @@ RecursivelyPlanDistributedJoinNode(Node *node, Query *query, ReplaceRTERelationWithRteSubquery(distributedRte, requiredAttributes, recursivePlanningContext, perminfo); -#else - ReplaceRTERelationWithRteSubquery(distributedRte, requiredAttributes, - recursivePlanningContext, NULL); -#endif } else if (distributedRte->rtekind == RTE_SUBQUERY) { @@ -1874,9 +1869,7 @@ ReplaceRTERelationWithRteSubquery(RangeTblEntry *rangeTableEntry, /* replace the function with the constructed subquery */ rangeTableEntry->rtekind = RTE_SUBQUERY; -#if PG_VERSION_NUM >= PG_VERSION_16 rangeTableEntry->perminfoindex = 0; -#endif rangeTableEntry->subquery = subquery; /* @@ -1949,13 +1942,10 @@ CreateOuterSubquery(RangeTblEntry *rangeTableEntry, List *outerSubqueryTargetLis innerSubqueryRTE->eref->colnames = innerSubqueryColNames; outerSubquery->rtable = list_make1(innerSubqueryRTE); -#if PG_VERSION_NUM >= PG_VERSION_16 - /* sanity check */ Assert(innerSubqueryRTE->rtekind == RTE_SUBQUERY && innerSubqueryRTE->perminfoindex == 0); outerSubquery->rteperminfos = NIL; -#endif /* set the FROM expression to the subquery */ @@ -2131,13 +2121,10 @@ TransformFunctionRTE(RangeTblEntry *rangeTblEntry) /* set the FROM expression to the subquery */ subquery->rtable = list_make1(newRangeTableEntry); -#if PG_VERSION_NUM >= PG_VERSION_16 - /* sanity check */ Assert(newRangeTableEntry->rtekind == RTE_FUNCTION && newRangeTableEntry->perminfoindex == 0); subquery->rteperminfos = NIL; -#endif newRangeTableRef->rtindex = 1; subquery->jointree = makeFromExpr(list_make1(newRangeTableRef), NULL); @@ -2459,9 +2446,7 @@ BuildEmptyResultQuery(List *targetEntryList, char *resultId) valuesQuery->canSetTag = true; valuesQuery->commandType = CMD_SELECT; valuesQuery->rtable = list_make1(valuesRangeTable); - #if PG_VERSION_NUM >= PG_VERSION_16 valuesQuery->rteperminfos = NIL; - #endif valuesQuery->jointree = valuesJoinTree; valuesQuery->targetList = valueTargetList; @@ -2478,9 +2463,7 @@ BuildEmptyResultQuery(List *targetEntryList, char *resultId) resultQuery->commandType = CMD_SELECT; resultQuery->canSetTag = true; resultQuery->rtable = list_make1(emptyRangeTable); -#if PG_VERSION_NUM >= PG_VERSION_16 resultQuery->rteperminfos = NIL; -#endif RangeTblRef *rangeTableRef = makeNode(RangeTblRef); rangeTableRef->rtindex = 1; @@ -2630,9 +2613,7 @@ BuildReadIntermediateResultsQuery(List *targetEntryList, List *columnAliasList, Query *resultQuery = makeNode(Query); resultQuery->commandType = CMD_SELECT; resultQuery->rtable = list_make1(rangeTableEntry); -#if PG_VERSION_NUM >= PG_VERSION_16 resultQuery->rteperminfos = NIL; -#endif resultQuery->jointree = joinTree; resultQuery->targetList = targetList; diff --git a/src/backend/distributed/planner/relation_restriction_equivalence.c b/src/backend/distributed/planner/relation_restriction_equivalence.c index 5a63503f0..f38b9f26b 100644 --- a/src/backend/distributed/planner/relation_restriction_equivalence.c +++ b/src/backend/distributed/planner/relation_restriction_equivalence.c @@ -1508,7 +1508,6 @@ GetTargetSubquery(PlannerInfo *root, RangeTblEntry *rangeTableEntry, Var *varToB bool IsRelOptOuterJoin(PlannerInfo *root, int varNo) { -#if PG_VERSION_NUM >= PG_VERSION_16 if (root->simple_rel_array_size <= varNo) { return true; @@ -1520,7 +1519,6 @@ IsRelOptOuterJoin(PlannerInfo *root, int varNo) /* must be an outer join */ return true; } -#endif return false; } diff --git a/src/backend/distributed/replication/multi_logical_replication.c b/src/backend/distributed/replication/multi_logical_replication.c index 4c43d3513..9868fefd3 100644 --- a/src/backend/distributed/replication/multi_logical_replication.c +++ b/src/backend/distributed/replication/multi_logical_replication.c @@ -1515,8 +1515,6 @@ CreateSubscriptions(MultiConnection *sourceConnection, appendStringInfo(createSubscriptionCommand, "CREATE SUBSCRIPTION %s CONNECTION %s PUBLICATION %s " "WITH (citus_use_authinfo=true, create_slot=false, " -#if PG_VERSION_NUM >= PG_VERSION_16 - /* * password_required specifies whether connections to the publisher * made as a result of this subscription must use password authentication. @@ -1529,9 +1527,6 @@ CreateSubscriptions(MultiConnection *sourceConnection, * it will be ignored anyway */ "copy_data=false, enabled=false, slot_name=%s, password_required=false", -#else - "copy_data=false, enabled=false, slot_name=%s", -#endif quote_identifier(target->subscriptionName), quote_literal_cstr(conninfo->data), quote_identifier(target->publication->name), diff --git a/src/backend/distributed/shardsplit/shardsplit_decoder.c b/src/backend/distributed/shardsplit/shardsplit_decoder.c index 837009530..bcd25ce2e 100644 --- a/src/backend/distributed/shardsplit/shardsplit_decoder.c +++ b/src/backend/distributed/shardsplit/shardsplit_decoder.c @@ -94,42 +94,6 @@ replication_origin_filter_cb(LogicalDecodingContext *ctx, RepOriginId origin_id) } -/* - * update_replication_progress is copied from Postgres 15. We use it to send keepalive - * messages when we are filtering out the wal changes resulting from the initial copy. - * If we do not send out messages long enough, wal reciever will time out. - * Postgres 16 has refactored this code such that keepalive messages are sent during - * reordering phase which is above change_cb. So we do not need to send keepalive in - * change_cb. - */ -#if (PG_VERSION_NUM < PG_VERSION_16) -static void -update_replication_progress(LogicalDecodingContext *ctx, bool skipped_xact) -{ - static int changes_count = 0; - - /* - * We don't want to try sending a keepalive message after processing each - * change as that can have overhead. Tests revealed that there is no - * noticeable overhead in doing it after continuously processing 100 or so - * changes. - */ -#define CHANGES_THRESHOLD 100 - - /* - * After continuously processing CHANGES_THRESHOLD changes, we - * try to send a keepalive message if required. - */ - if (ctx->end_xact || ++changes_count >= CHANGES_THRESHOLD) - { - OutputPluginUpdateProgress(ctx, skipped_xact); - changes_count = 0; - } -} - - -#endif - /* * shard_split_change_cb function emits the incoming tuple change * to the appropriate destination shard. @@ -148,12 +112,6 @@ shard_split_change_cb(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, return; } -#if (PG_VERSION_NUM < PG_VERSION_16) - - /* Send replication keepalive. */ - update_replication_progress(ctx, false); -#endif - /* check if the relation is publishable.*/ if (!is_publishable_relation(relation)) { diff --git a/src/backend/distributed/test/fake_am.c b/src/backend/distributed/test/fake_am.c index 75b7a9fb2..bd954053f 100644 --- a/src/backend/distributed/test/fake_am.c +++ b/src/backend/distributed/test/fake_am.c @@ -562,11 +562,7 @@ static const TableAmRoutine fake_methods = { .tuple_satisfies_snapshot = fake_tuple_satisfies_snapshot, .index_delete_tuples = fake_index_delete_tuples, -#if PG_VERSION_NUM >= PG_VERSION_16 .relation_set_new_filelocator = fake_relation_set_new_filenode, -#else - .relation_set_new_filenode = fake_relation_set_new_filenode, -#endif .relation_nontransactional_truncate = fake_relation_nontransactional_truncate, .relation_copy_data = fake_copy_data, .relation_copy_for_cluster = fake_copy_for_cluster, diff --git a/src/backend/distributed/transaction/lock_graph.c b/src/backend/distributed/transaction/lock_graph.c index 11982ec5a..18422847f 100644 --- a/src/backend/distributed/transaction/lock_graph.c +++ b/src/backend/distributed/transaction/lock_graph.c @@ -740,8 +740,6 @@ UnlockLockData(void) * We have separate blocks for PG16 and = PG_VERSION_16 static void AddEdgesForLockWaits(WaitGraph *waitGraph, PGPROC *waitingProc, PROCStack *remaining) { @@ -820,86 +818,6 @@ AddEdgesForWaitQueue(WaitGraph *waitGraph, PGPROC *waitingProc, PROCStack *remai } -#else - -static void -AddEdgesForLockWaits(WaitGraph *waitGraph, PGPROC *waitingProc, PROCStack *remaining) -{ - /* the lock for which this process is waiting */ - LOCK *waitLock = waitingProc->waitLock; - - /* determine the conflict mask for the lock level used by the process */ - LockMethod lockMethodTable = GetLocksMethodTable(waitLock); - int conflictMask = lockMethodTable->conflictTab[waitingProc->waitLockMode]; - - /* iterate through the queue of processes holding the lock */ - SHM_QUEUE *procLocks = &waitLock->procLocks; - PROCLOCK *procLock = (PROCLOCK *) SHMQueueNext(procLocks, procLocks, - offsetof(PROCLOCK, lockLink)); - - while (procLock != NULL) - { - PGPROC *currentProc = procLock->tag.myProc; - - /* - * Skip processes from the same lock group, processes that don't conflict, - * and processes that are waiting on safe operations. - */ - if (!IsSameLockGroup(waitingProc, currentProc) && - IsConflictingLockMask(procLock->holdMask, conflictMask) && - !IsProcessWaitingForSafeOperations(currentProc)) - { - AddWaitEdge(waitGraph, waitingProc, currentProc, remaining); - } - - procLock = (PROCLOCK *) SHMQueueNext(procLocks, &procLock->lockLink, - offsetof(PROCLOCK, lockLink)); - } -} - - -static void -AddEdgesForWaitQueue(WaitGraph *waitGraph, PGPROC *waitingProc, PROCStack *remaining) -{ - /* the lock for which this process is waiting */ - LOCK *waitLock = waitingProc->waitLock; - - /* determine the conflict mask for the lock level used by the process */ - LockMethod lockMethodTable = GetLocksMethodTable(waitLock); - int conflictMask = lockMethodTable->conflictTab[waitingProc->waitLockMode]; - - /* iterate through the wait queue */ - PROC_QUEUE *waitQueue = &(waitLock->waitProcs); - int queueSize = waitQueue->size; - PGPROC *currentProc = (PGPROC *) waitQueue->links.next; - - /* - * Iterate through the queue from the start until we encounter waitingProc, - * since we only care about processes in front of waitingProc in the queue. - */ - while (queueSize-- > 0 && currentProc != waitingProc) - { - int awaitMask = LOCKBIT_ON(currentProc->waitLockMode); - - /* - * Skip processes from the same lock group, processes that don't conflict, - * and processes that are waiting on safe operations. - */ - if (!IsSameLockGroup(waitingProc, currentProc) && - IsConflictingLockMask(awaitMask, conflictMask) && - !IsProcessWaitingForSafeOperations(currentProc)) - { - AddWaitEdge(waitGraph, waitingProc, currentProc, remaining); - } - - currentProc = (PGPROC *) currentProc->links.next; - } -} - - -#endif - - /* * AddWaitEdge adds a new wait edge to a wait graph. The nodes in the graph are * transactions and an edge indicates the "waiting" process is blocked on a lock diff --git a/src/backend/distributed/transaction/transaction_management.c b/src/backend/distributed/transaction/transaction_management.c index 16c5c56fa..3d1157815 100644 --- a/src/backend/distributed/transaction/transaction_management.c +++ b/src/backend/distributed/transaction/transaction_management.c @@ -807,13 +807,9 @@ AdjustMaxPreparedTransactions(void) * really check if max_prepared_xacts is configured by the user explicitly, * so check if it's value is default. */ -#if PG_VERSION_NUM >= PG_VERSION_16 struct config_generic *gconf = find_option("max_prepared_transactions", false, false, ERROR); if (gconf->source == PGC_S_DEFAULT) -#else - if (max_prepared_xacts == 0) -#endif { char newvalue[12]; diff --git a/src/backend/distributed/utils/relation_utils.c b/src/backend/distributed/utils/relation_utils.c index d39c1f071..f5e2c629a 100644 --- a/src/backend/distributed/utils/relation_utils.c +++ b/src/backend/distributed/utils/relation_utils.c @@ -14,9 +14,7 @@ #include "distributed/relation_utils.h" -#if PG_VERSION_NUM >= PG_VERSION_16 #include "miscadmin.h" -#endif #include "utils/lsyscache.h" #include "utils/rel.h" @@ -33,8 +31,6 @@ RelationGetNamespaceName(Relation relation) } -#if PG_VERSION_NUM >= PG_VERSION_16 - /* * GetFilledPermissionInfo creates RTEPermissionInfo for a given RTE * and fills it with given data and returns this RTEPermissionInfo object. @@ -56,6 +52,3 @@ GetFilledPermissionInfo(Oid relid, bool inh, AclMode requiredPerms) perminfo->checkAsUser = GetUserId(); return perminfo; } - - -#endif diff --git a/src/include/columnar/columnar.h b/src/include/columnar/columnar.h index 1883be38b..095ce8b45 100644 --- a/src/include/columnar/columnar.h +++ b/src/include/columnar/columnar.h @@ -27,11 +27,7 @@ #include "columnar/columnar_compression.h" #include "columnar/columnar_metadata.h" -#if PG_VERSION_NUM >= PG_VERSION_16 #include "storage/relfilelocator.h" -#else -#include "storage/relfilenode.h" -#endif #define COLUMNAR_AM_NAME "columnar" #define COLUMNAR_MODULE_NAME "citus_columnar" diff --git a/src/include/columnar/columnar_metadata.h b/src/include/columnar/columnar_metadata.h index 81817f733..021c9bea4 100644 --- a/src/include/columnar/columnar_metadata.h +++ b/src/include/columnar/columnar_metadata.h @@ -17,11 +17,7 @@ #include "pg_version_compat.h" #include "pg_version_constants.h" -#if PG_VERSION_NUM >= PG_VERSION_16 #include "storage/relfilelocator.h" -#else -#include "storage/relfilenode.h" -#endif /* diff --git a/src/include/distributed/relation_utils.h b/src/include/distributed/relation_utils.h index d3a5ab105..f57f33be9 100644 --- a/src/include/distributed/relation_utils.h +++ b/src/include/distributed/relation_utils.h @@ -14,15 +14,11 @@ #include "postgres.h" #include "pg_version_constants.h" -#if PG_VERSION_NUM >= PG_VERSION_16 #include "parser/parse_relation.h" -#endif #include "utils/relcache.h" extern char * RelationGetNamespaceName(Relation relation); -#if PG_VERSION_NUM >= PG_VERSION_16 extern RTEPermissionInfo * GetFilledPermissionInfo(Oid relid, bool inh, AclMode requiredPerms); -#endif #endif /* RELATION_UTILS_H */ diff --git a/src/include/distributed/resource_lock.h b/src/include/distributed/resource_lock.h index 0696ef6e8..0e6116593 100644 --- a/src/include/distributed/resource_lock.h +++ b/src/include/distributed/resource_lock.h @@ -179,9 +179,7 @@ IsNodeWideObjectClass(ObjectClass objectClass) case OCLASS_DATABASE: case OCLASS_TBLSPACE: case OCLASS_PARAMETER_ACL: -#if PG_VERSION_NUM >= PG_VERSION_16 case OCLASS_ROLE_MEMBERSHIP: -#endif { return true; }