diff --git a/contrib/ltree/ltxtquery_io.c b/contrib/ltree/ltxtquery_io.c
index 3a2aa223c3e..91a2222eaa9 100644
--- a/contrib/ltree/ltxtquery_io.c
+++ b/contrib/ltree/ltxtquery_io.c
@@ -338,11 +338,6 @@ queryin(char *buf, struct Node *escontext)
 	NODE	   *tmp;
 	int32		pos = 0;
 
-#ifdef BS_DEBUG
-	char		pbuf[16384],
-			   *cur;
-#endif
-
 	/* init state */
 	state.buf = buf;
 	state.state = WAITOPERAND;
diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml
index 197be0c6f6b..b7dd361294b 100644
--- a/doc/src/sgml/ref/create_subscription.sgml
+++ b/doc/src/sgml/ref/create_subscription.sgml
@@ -562,7 +562,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
          </para>
          <para>
           This option is effective only when
-          <literal>retain_conflict_info</literal> is enabled and the apply
+          <literal>retain_dead_tuples</literal> is enabled and the apply
           worker associated with the subscription is active.
          </para>
          <warning>
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 469397e7344..9cdfc06aee7 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -87,7 +87,7 @@ static void compute_new_xmax_infomask(TransactionId xmax, uint16 old_infomask,
 									  uint16 *result_infomask2);
 static TM_Result heap_lock_updated_tuple(Relation rel,
 										 uint16 prior_infomask,
-										 TransactionId prior_rawxmax,
+										 TransactionId prior_raw_xmax,
 										 const ItemPointerData *prior_ctid,
 										 TransactionId xid,
 										 LockTupleMode mode);
diff --git a/src/backend/access/heap/heapam_xlog.c b/src/backend/access/heap/heapam_xlog.c
index 1823feff298..65e6fac065a 100644
--- a/src/backend/access/heap/heapam_xlog.c
+++ b/src/backend/access/heap/heapam_xlog.c
@@ -191,7 +191,7 @@ heap_xlog_prune_freeze(XLogReaderState *record)
 	 * unlogged and maintained heuristically, it often becomes stale on
 	 * standbys. If such a standby is later promoted and runs VACUUM, it will
 	 * skip recalculating free space for pages that were marked
-	 * all-visible/all-forzen. FreeSpaceMapVacuum() can then propagate overly
+	 * all-visible/all-frozen. FreeSpaceMapVacuum() can then propagate overly
 	 * optimistic free space values upward, causing future insertions to
 	 * select pages that turn out to be unusable. In bulk, this can lead to
 	 * long stalls.
diff --git a/src/backend/access/rmgrdesc/gindesc.c b/src/backend/access/rmgrdesc/gindesc.c
index 62e21f8c935..52442e4a7eb 100644
--- a/src/backend/access/rmgrdesc/gindesc.c
+++ b/src/backend/access/rmgrdesc/gindesc.c
@@ -161,7 +161,7 @@ gin_desc(StringInfo buf, XLogReaderState *record)
 					appendStringInfo(buf, " prevTail: %u",
 									 xlrec->prevTail);
 				if (xlrec->newRightlink != InvalidBlockNumber)
-					appendStringInfo(buf, " newRightLink: %u",
+					appendStringInfo(buf, " newRightlink: %u",
 									 xlrec->newRightlink);
 			}
 			break;
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index 4efd4685abc..4acc70c2d6f 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -1287,7 +1287,7 @@ CheckAlterSubOption(Subscription *sub, const char *option,
 	 * retreat in the calculated xmin, necessitating additional handling.
 	 *
 	 * XXX To address the above race conditions, we can define
-	 * oldest_nonremovable_xid as FullTransactionID and adds the check to
+	 * oldest_nonremovable_xid as FullTransactionId and adds the check to
 	 * disallow retreating the conflict slot's xmin. For now, we kept the
 	 * implementation simple by disallowing change to the retain_dead_tuples,
 	 * but in the future we can change this after some more analysis.
diff --git a/src/backend/nodes/queryjumblefuncs.c b/src/backend/nodes/queryjumblefuncs.c
index ffc230af427..75c8e1dd89e 100644
--- a/src/backend/nodes/queryjumblefuncs.c
+++ b/src/backend/nodes/queryjumblefuncs.c
@@ -684,7 +684,7 @@ _jumbleParam(JumbleState *jstate, Node *node)
 	JUMBLE_FIELD(paramkind);
 	JUMBLE_FIELD(paramid);
 	JUMBLE_FIELD(paramtype);
-	/* paramtypmode and paramcollid are ignored */
+	/* paramtypmod and paramcollid are ignored */
 
 	if (expr->paramkind == PARAM_EXTERN)
 	{
diff --git a/src/backend/optimizer/plan/analyzejoins.c b/src/backend/optimizer/plan/analyzejoins.c
index e2784c01549..7328e1e2140 100644
--- a/src/backend/optimizer/plan/analyzejoins.c
+++ b/src/backend/optimizer/plan/analyzejoins.c
@@ -2285,7 +2285,7 @@ remove_self_joins_one_group(PlannerInfo *root, Relids relids)
 				continue;
 
 			/*
-			 * Remove rrel ReloptInfo from the planner structures and the
+			 * Remove rrel RelOptInfo from the planner structures and the
 			 * corresponding row mark.
 			 */
 			remove_self_join_rel(root, kmark, rmark, krel, rrel, restrictlist);
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index 1268ea92b6f..693ce171b1e 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -7922,7 +7922,7 @@ apply_scanjoin_target_to_paths(PlannerInfo *root,
 	 * However, there are several cases when this optimization is not safe. If
 	 * the rel isn't partitioned, then none of the paths will be Append or
 	 * MergeAppend paths, so we should definitely not do this. If it is
-	 * parititoned but is a joinrel, it may have Append and MergeAppend paths,
+	 * partititoned but is a joinrel, it may have Append and MergeAppend paths,
 	 * but it can also have join paths that we can't afford to discard.
 	 *
 	 * Some care is needed, because we have to allow
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c
index 43ca5fd0213..c2b85244c07 100644
--- a/src/backend/optimizer/util/plancat.c
+++ b/src/backend/optimizer/util/plancat.c
@@ -937,7 +937,7 @@ infer_arbiter_indexes(PlannerInfo *root)
 				Assert(idxForm->indisready);
 
 				/*
-				 * Set up inferElems and inferPredExprs to match the
+				 * Set up inferElems and inferIndexExprs to match the
 				 * constraint index, so that we can match them in the loop
 				 * below.
 				 */
diff --git a/src/backend/partitioning/partbounds.c b/src/backend/partitioning/partbounds.c
index 16b0adc172c..c293603a204 100644
--- a/src/backend/partitioning/partbounds.c
+++ b/src/backend/partitioning/partbounds.c
@@ -4989,7 +4989,7 @@ satisfies_hash_partition(PG_FUNCTION_ARGS)
  * second_name:		name of the second partition
  * second_bound:	bound of the second partition
  * defaultPart:		true if one of the new partitions is DEFAULT
- * is_merge:		true ndicates the operation is MERGE PARTITIONS;
+ * is_merge:		true indicates the operation is MERGE PARTITIONS;
  * 					false indicates the operation is SPLIT PARTITION.
  * pstate:			pointer to ParseState struct for determining error position
  */
diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c
index 0feebffd431..7d616689120 100644
--- a/src/backend/replication/logical/slotsync.c
+++ b/src/backend/replication/logical/slotsync.c
@@ -173,7 +173,7 @@ update_slotsync_skip_stats(SlotSyncSkipReason skip_reason)
 	slot = MyReplicationSlot;
 
 	/*
-	 * Update the slot sync related stats in pg_stat_replication_slot when a
+	 * Update the slot sync related stats in pg_stat_replication_slots when a
 	 * slot sync is skipped
 	 */
 	if (skip_reason != SS_SKIP_NONE)
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index eb55102b0d7..4b459163e49 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -4280,7 +4280,7 @@ DebugPrintBufferRefcount(Buffer buffer)
 		backend = INVALID_PROC_NUMBER;
 	}
 
-	/* theoretically we should lock the bufhdr here */
+	/* theoretically we should lock the bufHdr here */
 	buf_state = pg_atomic_read_u32(&buf->state);
 
 	result = psprintf("[%03d] (rel=%s, blockNum=%u, flags=0x%x, refcount=%u %d)",
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c
index 149c69a1873..361dbdb1070 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -190,7 +190,7 @@
  * two-phase commit support
  *		AtPrepare_PredicateLocks(void);
  *		PostPrepare_PredicateLocks(TransactionId xid);
- *		PredicateLockTwoPhaseFinish(TransactionId xid, bool isCommit);
+ *		PredicateLockTwoPhaseFinish(FullTransactionId fxid, bool isCommit);
  *		predicatelock_twophase_recover(FullTransactionId fxid, uint16 info,
  *									   void *recdata, uint32 len);
  */
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index b7e94ca45bd..4393eb1eac7 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -418,7 +418,7 @@ CheckMyDatabase(const char *name, bool am_superuser, bool override_allow_connect
 	ctype = TextDatumGetCString(datum);
 
 	/*
-	 * Historcally, we set LC_COLLATE from datcollate, as well. That's no
+	 * Historically, we set LC_COLLATE from datcollate, as well. That's no
 	 * longer necessary because all collation behavior is handled through
 	 * pg_locale_t.
 	 */
diff --git a/src/backend/utils/misc/guc_parameters.dat b/src/backend/utils/misc/guc_parameters.dat
index ac0c7c36c56..f77b230aaca 100644
--- a/src/backend/utils/misc/guc_parameters.dat
+++ b/src/backend/utils/misc/guc_parameters.dat
@@ -694,7 +694,7 @@
   short_desc => 'Set this to force all parse and plan trees to be passed through outfuncs.c/readfuncs.c, to facilitate catching errors and omissions in those modules.',
   flags => 'GUC_NOT_IN_SAMPLE',
   variable => 'Debug_write_read_parse_plan_trees',
-  boot_val => 'DEFAULT_DEBUG_READ_WRITE_PARSE_PLAN_TREES',
+  boot_val => 'DEFAULT_DEBUG_WRITE_READ_PARSE_PLAN_TREES',
   ifdef => 'DEBUG_NODE_TESTS_ENABLED',
 },
 
diff --git a/src/bin/pg_upgrade/t/007_multixact_conversion.pl b/src/bin/pg_upgrade/t/007_multixact_conversion.pl
index 14db40e45ed..362a7517cc2 100644
--- a/src/bin/pg_upgrade/t/007_multixact_conversion.pl
+++ b/src/bin/pg_upgrade/t/007_multixact_conversion.pl
@@ -228,7 +228,7 @@ sub read_multixid_fields
 
 # Reset a cluster's next multixid and mxoffset to given values.
 #
-# Note: This is used on the old insallation, so the command arguments
+# Note: This is used on the old installation, so the command arguments
 # and the output parsing used here must work with all pre-v19
 # PostgreSQL versions supported by the test.
 sub reset_mxid_mxoffset_pre_v19
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h
index f7e4ae3843c..0067894e2ee 100644
--- a/src/include/access/heapam.h
+++ b/src/include/access/heapam.h
@@ -293,7 +293,7 @@ typedef struct PruneFreezeResult
 	 * is only valid if we froze some tuples (nfrozen > 0), and all_frozen is
 	 * true.
 	 *
-	 * These are only set if the HEAP_PRUNE_FREEZE option is set.
+	 * These are only set if the HEAP_PAGE_PRUNE_FREEZE option is set.
 	 */
 	bool		all_visible;
 	bool		all_frozen;
diff --git a/src/include/c.h b/src/include/c.h
index 811d6d0110c..175daed0ef0 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -1262,7 +1262,7 @@ typedef struct PGAlignedXLogBlock
  */
 
 #if !HAVE_DECL_FDATASYNC
-extern int	fdatasync(int fildes);
+extern int	fdatasync(int fd);
 #endif
 
 /*
diff --git a/src/include/commands/sequence.h b/src/include/commands/sequence.h
index 3f8d353c49e..8826bcbf535 100644
--- a/src/include/commands/sequence.h
+++ b/src/include/commands/sequence.h
@@ -47,7 +47,7 @@ extern ObjectAddress AlterSequence(ParseState *pstate, AlterSeqStmt *stmt);
 extern void SequenceChangePersistence(Oid relid, char newrelpersistence);
 extern void DeleteSequenceTuple(Oid relid);
 extern void ResetSequence(Oid seq_relid);
-extern void SetSequence(Oid relid, int64 next, bool is_called);
+extern void SetSequence(Oid relid, int64 next, bool iscalled);
 extern void ResetSequenceCaches(void);
 
 #endif							/* SEQUENCE_H */
diff --git a/src/include/common/int128.h b/src/include/common/int128.h
index 62aae1bc6a7..913c33c4607 100644
--- a/src/include/common/int128.h
+++ b/src/include/common/int128.h
@@ -346,7 +346,7 @@ int128_div_mod_int32(INT128 *i128, int32 v, int32 *remainder)
 		n_lo = i128->lo;
 	}
 
-	/* denomimator: absolute value of v */
+	/* denominator: absolute value of v */
 	d = abs(v);
 
 	/* quotient and remainder of high 64 bits */
diff --git a/src/include/jit/llvmjit.h b/src/include/jit/llvmjit.h
index b3c75022f55..c756372898f 100644
--- a/src/include/jit/llvmjit.h
+++ b/src/include/jit/llvmjit.h
@@ -114,7 +114,7 @@ extern void llvm_split_symbol_name(const char *name, char **modname, char **func
 extern LLVMTypeRef llvm_pg_var_type(const char *varname);
 extern LLVMTypeRef llvm_pg_var_func_type(const char *varname);
 extern LLVMValueRef llvm_pg_func(LLVMModuleRef mod, const char *funcname);
-extern void llvm_copy_attributes(LLVMValueRef from, LLVMValueRef to);
+extern void llvm_copy_attributes(LLVMValueRef v_from, LLVMValueRef v_to);
 extern LLVMValueRef llvm_function_reference(LLVMJitContext *context,
 						LLVMBuilderRef builder,
 						LLVMModuleRef mod,
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
index b5ff456ef7f..0d5ec4f0d6d 100644
--- a/src/include/nodes/pathnodes.h
+++ b/src/include/nodes/pathnodes.h
@@ -404,7 +404,7 @@ struct PlannerInfo
 	/* list of AggClauseInfos */
 	List	   *agg_clause_list;
 
-	/* list of GroupExprInfos */
+	/* list of GroupingExprInfos */
 	List	   *group_expr_list;
 
 	/* list of plain Vars contained in targetlist and havingQual */
diff --git a/src/include/optimizer/geqo_recombination.h b/src/include/optimizer/geqo_recombination.h
index af394a22460..28ffa108352 100644
--- a/src/include/optimizer/geqo_recombination.h
+++ b/src/include/optimizer/geqo_recombination.h
@@ -79,11 +79,11 @@ extern void px(PlannerInfo *root, Gene *tour1, Gene *tour2, Gene *offspring,
 			   int num_gene, City * city_table);
 
 /* order crossover [OX1] according to Davis */
-extern void ox1(PlannerInfo *root, Gene *mom, Gene *dad, Gene *offspring,
+extern void ox1(PlannerInfo *root, Gene *tour1, Gene *tour2, Gene *offspring,
 				int num_gene, City * city_table);
 
 /* order crossover [OX2] according to Syswerda */
-extern void ox2(PlannerInfo *root, Gene *mom, Gene *dad, Gene *offspring,
+extern void ox2(PlannerInfo *root, Gene *tour1, Gene *tour2, Gene *offspring,
 				int num_gene, City * city_table);
 
 #endif							/* GEQO_RECOMBINATION_H */
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index f0091b09cbe..2dd8f6b9a38 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -54,9 +54,6 @@
 /* Define to 1 if you have the `append_history' function. */
 #undef HAVE_APPEND_HISTORY
 
-/* Define to 1 if you have the <atomic.h> header file. */
-#undef HAVE_ATOMIC_H
-
 /* Define to 1 if you have the `backtrace_symbols' function. */
 #undef HAVE_BACKTRACE_SYMBOLS
 
@@ -281,9 +278,6 @@
 /* Define to 1 if you have the `localeconv_l' function. */
 #undef HAVE_LOCALECONV_L
 
-/* Define to 1 if you have the <mbarrier.h> header file. */
-#undef HAVE_MBARRIER_H
-
 /* Define to 1 if you have the `mbstowcs_l' function. */
 #undef HAVE_MBSTOWCS_L
 
diff --git a/src/include/port.h b/src/include/port.h
index af604fddbe7..9dbcf959bfd 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -485,7 +485,7 @@ extern char *strsep(char **stringp, const char *delim);
 #endif
 
 #if !HAVE_DECL_TIMINGSAFE_BCMP
-extern int	timingsafe_bcmp(const void *b1, const void *b2, size_t len);
+extern int	timingsafe_bcmp(const void *b1, const void *b2, size_t n);
 #endif
 
 /*
diff --git a/src/include/port/win32/sys/socket.h b/src/include/port/win32/sys/socket.h
index f2b475df5e5..4fe7693ad14 100644
--- a/src/include/port/win32/sys/socket.h
+++ b/src/include/port/win32/sys/socket.h
@@ -29,6 +29,6 @@
  */
 #undef gai_strerror
 
-extern const char *gai_strerror(int ecode);
+extern const char *gai_strerror(int errcode);
 
 #endif							/* WIN32_SYS_SOCKET_H */
diff --git a/src/include/port/win32_port.h b/src/include/port/win32_port.h
index 0f4b645f9af..1a29ada5898 100644
--- a/src/include/port/win32_port.h
+++ b/src/include/port/win32_port.h
@@ -505,7 +505,7 @@ extern SOCKET pgwin32_socket(int af, int type, int protocol);
 extern int	pgwin32_bind(SOCKET s, struct sockaddr *addr, int addrlen);
 extern int	pgwin32_listen(SOCKET s, int backlog);
 extern SOCKET pgwin32_accept(SOCKET s, struct sockaddr *addr, int *addrlen);
-extern int	pgwin32_connect(SOCKET s, const struct sockaddr *name, int namelen);
+extern int	pgwin32_connect(SOCKET s, const struct sockaddr *addr, int addrlen);
 extern int	pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout);
 extern int	pgwin32_recv(SOCKET s, char *buf, int len, int flags);
 extern int	pgwin32_send(SOCKET s, const void *buf, int len, int flags);
@@ -581,9 +581,9 @@ typedef unsigned short mode_t;
 #endif
 
 /* in port/win32pread.c */
-extern ssize_t pg_pread(int fd, void *buf, size_t nbyte, pgoff_t offset);
+extern ssize_t pg_pread(int fd, void *buf, size_t size, pgoff_t offset);
 
 /* in port/win32pwrite.c */
-extern ssize_t pg_pwrite(int fd, const void *buf, size_t nbyte, pgoff_t offset);
+extern ssize_t pg_pwrite(int fd, const void *buf, size_t size, pgoff_t offset);
 
 #endif							/* PG_WIN32_PORT_H */
diff --git a/src/include/replication/logicalctl.h b/src/include/replication/logicalctl.h
index fbe4fa54976..fdac5242be5 100644
--- a/src/include/replication/logicalctl.h
+++ b/src/include/replication/logicalctl.h
@@ -16,12 +16,11 @@
 
 extern Size LogicalDecodingCtlShmemSize(void);
 extern void LogicalDecodingCtlShmemInit(void);
-extern void StartupLogicalDecodingStatus(bool status_in_control_file);
+extern void StartupLogicalDecodingStatus(bool last_status);
 extern void InitializeProcessXLogLogicalInfo(void);
 extern bool ProcessBarrierUpdateXLogLogicalInfo(void);
 extern bool IsLogicalDecodingEnabled(void);
 extern bool IsXLogLogicalInfoEnabled(void);
-extern bool CheckXLogLogicalInfo(void);
 extern void AtEOXact_LogicalCtl(void);
 extern void EnsureLogicalDecodingEnabled(void);
 extern void EnableLogicalDecoding(void);
diff --git a/src/include/replication/worker_internal.h b/src/include/replication/worker_internal.h
index f081619f151..505aa5099ea 100644
--- a/src/include/replication/worker_internal.h
+++ b/src/include/replication/worker_internal.h
@@ -294,7 +294,7 @@ extern void launch_sync_worker(LogicalRepWorkerType wtype, int nsyncworkers,
 							   Oid relid, TimestampTz *last_start_time);
 extern void ProcessSyncingRelations(XLogRecPtr current_lsn);
 extern void FetchRelationStates(bool *has_pending_subtables,
-								bool *has_pending_sequences, bool *started_tx);
+								bool *has_pending_subsequences, bool *started_tx);
 
 extern void stream_start_internal(TransactionId xid, bool first_segment);
 extern void stream_stop_internal(TransactionId xid);
diff --git a/src/include/snowball/libstemmer/header.h b/src/include/snowball/libstemmer/header.h
index bf172d5b9bd..ef5a5464067 100644
--- a/src/include/snowball/libstemmer/header.h
+++ b/src/include/snowball/libstemmer/header.h
@@ -45,7 +45,7 @@ extern int eq_v_b(struct SN_env * z, const symbol * p);
 extern int find_among(struct SN_env * z, const struct among * v, int v_size);
 extern int find_among_b(struct SN_env * z, const struct among * v, int v_size);
 
-extern int replace_s(struct SN_env * z, int c_bra, int c_ket, int s_size, const symbol * s, int * adjustment);
+extern int replace_s(struct SN_env * z, int c_bra, int c_ket, int s_size, const symbol * s, int * adjptr);
 extern int slice_from_s(struct SN_env * z, int s_size, const symbol * s);
 extern int slice_from_v(struct SN_env * z, const symbol * p);
 extern int slice_del(struct SN_env * z);
diff --git a/src/include/statistics/stat_utils.h b/src/include/statistics/stat_utils.h
index e2bc62a5614..f622be09355 100644
--- a/src/include/statistics/stat_utils.h
+++ b/src/include/statistics/stat_utils.h
@@ -35,7 +35,7 @@ extern bool stats_check_arg_pair(FunctionCallInfo fcinfo,
 								 int argnum1, int argnum2);
 
 extern void RangeVarCallbackForStats(const RangeVar *relation,
-									 Oid relId, Oid oldRelid, void *arg);
+									 Oid relId, Oid oldRelId, void *arg);
 
 extern bool stats_fill_fcinfo_from_arg_pairs(FunctionCallInfo pairs_fcinfo,
 											 FunctionCallInfo positional_fcinfo,
diff --git a/src/include/storage/predicate.h b/src/include/storage/predicate.h
index 8f5f0348a23..040d8cd82d2 100644
--- a/src/include/storage/predicate.h
+++ b/src/include/storage/predicate.h
@@ -73,7 +73,7 @@ extern void PreCommit_CheckForSerializationFailure(void);
 /* two-phase commit support */
 extern void AtPrepare_PredicateLocks(void);
 extern void PostPrepare_PredicateLocks(FullTransactionId fxid);
-extern void PredicateLockTwoPhaseFinish(FullTransactionId xid, bool isCommit);
+extern void PredicateLockTwoPhaseFinish(FullTransactionId fxid, bool isCommit);
 extern void predicatelock_twophase_recover(FullTransactionId fxid, uint16 info,
 										   void *recdata, uint32 len);
 
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index f21ec37da89..2f8146d66f7 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -266,10 +266,10 @@ extern PGDLLIMPORT bool Debug_raw_expression_coverage_test;
 #define DEFAULT_DEBUG_COPY_PARSE_PLAN_TREES false
 #endif
 
-#ifdef READ_WRITE_PARSE_PLAN_TREES
-#define DEFAULT_DEBUG_READ_WRITE_PARSE_PLAN_TREES true
+#ifdef WRITE_READ_PARSE_PLAN_TREES
+#define DEFAULT_DEBUG_WRITE_READ_PARSE_PLAN_TREES true
 #else
-#define DEFAULT_DEBUG_READ_WRITE_PARSE_PLAN_TREES false
+#define DEFAULT_DEBUG_WRITE_READ_PARSE_PLAN_TREES false
 #endif
 
 #ifdef RAW_EXPRESSION_COVERAGE_TEST
diff --git a/src/test/modules/brin/t/01_workitems.pl b/src/test/modules/brin/t/01_workitems.pl
index 0744b8825ef..a19a1d83dc0 100644
--- a/src/test/modules/brin/t/01_workitems.pl
+++ b/src/test/modules/brin/t/01_workitems.pl
@@ -39,7 +39,7 @@ $node->safe_psql(
 my $count = $node->safe_psql('postgres',
 	"select count(*) from brin_page_items(get_raw_page('brin_wi_idx', 2), 'brin_wi_idx'::regclass)"
 );
-is($count, '1', "initial brin_wi_index index state is correct");
+is($count, '1', "initial brin_wi_idx index state is correct");
 $count = $node->safe_psql('postgres',
 	"select count(*) from brin_page_items(get_raw_page('brin_packdate_idx', 2), 'brin_packdate_idx'::regclass)"
 );
diff --git a/src/test/recovery/t/048_vacuum_horizon_floor.pl b/src/test/recovery/t/048_vacuum_horizon_floor.pl
index 9cdf6cee8a7..cdcc2e1661c 100644
--- a/src/test/recovery/t/048_vacuum_horizon_floor.pl
+++ b/src/test/recovery/t/048_vacuum_horizon_floor.pl
@@ -54,7 +54,7 @@ my $psql_primaryB =
 
 # Our test relies on two rounds of index vacuuming for reasons elaborated
 # later. To trigger two rounds of index vacuuming, we must fill up the
-# TIDStore with dead items partway through a vacuum of the table. The number
+# TidStore with dead items partway through a vacuum of the table. The number
 # of rows is just enough to ensure we exceed maintenance_work_mem on all
 # supported platforms, while keeping test runtime as short as we can.
 my $nrows = 2000;
@@ -225,7 +225,7 @@ $node_primary->poll_query_until(
 
 # Move the cursor forward to the next 7. We inserted the 7 much later, so
 # advancing the cursor should allow vacuum to proceed vacuuming most pages of
-# the relation. Because we set maintanence_work_mem sufficiently low, we
+# the relation. Because we set maintenance_work_mem sufficiently low, we
 # expect that a round of index vacuuming has happened and that the vacuum is
 # now waiting for the cursor to release its pin on the last page of the
 # relation.
diff --git a/src/tools/valgrind.supp b/src/tools/valgrind.supp
index 3880007dfb3..d56794b4f7e 100644
--- a/src/tools/valgrind.supp
+++ b/src/tools/valgrind.supp
@@ -182,7 +182,7 @@
 }
 
 # NUMA introspection requires touching memory first, and some of it may
-# be marked as noacess (e.g. unpinned buffers). So just ignore that.
+# be marked as noaccess (e.g. unpinned buffers). So just ignore that.
 {
    pg_numa_touch_mem_if_required
    Memcheck:Addr4
