From a00c2ca4f52b9c43b1cefb8e78f5524f23240816 Mon Sep 17 00:00:00 2001
From: Aleksander Alekseev <aleksander@timescale.com>
Date: Tue, 25 Jul 2023 16:09:38 +0300
Subject: [PATCH v1] Refactor inval.c and inval.h

The "public functions" separator comment doesn't reflect reality anymore.
We could rearrange the order of the functions. However, this would complicate
back-porting of the patches, thus removing the comment instead.

InvalidateSystemCachesExtended() is an internal function of inval.c. Make it
static.

Aleksander Alekseev, reviewed by TODO FIXME
Discussion: TODO FIXME
---
 src/backend/utils/cache/inval.c | 38 ++++++++++++++-------------------
 src/include/utils/inval.h       |  1 -
 2 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c
index 0008826f67..854a18445e 100644
--- a/src/backend/utils/cache/inval.c
+++ b/src/backend/utils/cache/inval.c
@@ -687,24 +687,7 @@ LocalExecuteInvalidationMessage(SharedInvalidationMessage *msg)
 		elog(FATAL, "unrecognized SI message ID: %d", msg->id);
 }
 
-/*
- *		InvalidateSystemCaches
- *
- *		This blows away all tuples in the system catalog caches and
- *		all the cached relation descriptors and smgr cache entries.
- *		Relation descriptors that have positive refcounts are then rebuilt.
- *
- *		We call this when we see a shared-inval-queue overflow signal,
- *		since that tells us we've lost some shared-inval messages and hence
- *		don't know what needs to be invalidated.
- */
-void
-InvalidateSystemCaches(void)
-{
-	InvalidateSystemCachesExtended(false);
-}
-
-void
+static void
 InvalidateSystemCachesExtended(bool debug_discard)
 {
 	int			i;
@@ -728,11 +711,22 @@ InvalidateSystemCachesExtended(bool debug_discard)
 	}
 }
 
-
-/* ----------------------------------------------------------------
- *					  public functions
- * ----------------------------------------------------------------
+/*
+ *		InvalidateSystemCaches
+ *
+ *		This blows away all tuples in the system catalog caches and
+ *		all the cached relation descriptors and smgr cache entries.
+ *		Relation descriptors that have positive refcounts are then rebuilt.
+ *
+ *		We call this when we see a shared-inval-queue overflow signal,
+ *		since that tells us we've lost some shared-inval messages and hence
+ *		don't know what needs to be invalidated.
  */
+void
+InvalidateSystemCaches(void)
+{
+	InvalidateSystemCachesExtended(false);
+}
 
 /*
  * AcceptInvalidationMessages
diff --git a/src/include/utils/inval.h b/src/include/utils/inval.h
index 14b4eac063..afdc150ead 100644
--- a/src/include/utils/inval.h
+++ b/src/include/utils/inval.h
@@ -62,7 +62,6 @@ extern void CacheRegisterRelcacheCallback(RelcacheCallbackFunction func,
 extern void CallSyscacheCallbacks(int cacheid, uint32 hashvalue);
 
 extern void InvalidateSystemCaches(void);
-extern void InvalidateSystemCachesExtended(bool debug_discard);
 
 extern void LogLogicalInvalidations(void);
 #endif							/* INVAL_H */
-- 
2.41.0

