Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions patches/15/pg15-000-spock-patchset-version.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Spock core-patchset: export patchset version via miscadmin.h and globals.c.

Adds SPOCK_CORE_PATCHSET_VERSION (compile-time constant) and
SpockCorePatchsetVersion (runtime global) to the standard places
PostgreSQL already uses for server-wide state. No new files.

--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -498,4 +498,11 @@
/* in executor/nodeHash.c */
extern size_t get_hash_memory_limit(void);

+/*
+ * Spock core-patchset identity. Bump the version when the patchset
+ * changes in a way visible to the extension binary.
+ */
+#define SPOCK_CORE_PATCHSET_VERSION 1
+extern PGDLLIMPORT int SpockCorePatchsetVersion;
+
#endif /* MISCADMIN_H */
--- a/src/backend/utils/init/globals.c
+++ b/src/backend/utils/init/globals.c
@@ -114,6 +114,9 @@
bool IsBinaryUpgrade = false;
bool IsBackgroundWorker = false;

+/* Spock core-patchset identity. */
+int SpockCorePatchsetVersion = SPOCK_CORE_PATCHSET_VERSION;
+
bool ExitOnAnyError = false;

int DateStyle = USE_ISO_DATES;
32 changes: 32 additions & 0 deletions patches/16/pg16-000-spock-patchset-version.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Spock core-patchset: export patchset version via miscadmin.h and globals.c.

Adds SPOCK_CORE_PATCHSET_VERSION (compile-time constant) and
SpockCorePatchsetVersion (runtime global) to the standard places
PostgreSQL already uses for server-wide state. No new files.

--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -510,4 +510,11 @@
/* in executor/nodeHash.c */
extern size_t get_hash_memory_limit(void);

+/*
+ * Spock core-patchset identity. Bump the version when the patchset
+ * changes in a way visible to the extension binary.
+ */
+#define SPOCK_CORE_PATCHSET_VERSION 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is smart idea in general. It does replace one patch with another though (but smaller). I am thinking one day we could have a spock-lite with reduced functionality that would work with plain Postgres. I will think about this some more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mason-sharp ,
It is trivial to guard our patches and the corresponding Spock machinery. That enables Spock to be used with upstream Postgres. But for production use, at least one patch (logical clock) is a requirement. So, for the safety and predictability, we should have a mechanism to detect patched postgres.

+extern PGDLLIMPORT int SpockCorePatchsetVersion;
+
#endif /* MISCADMIN_H */
--- a/src/backend/utils/init/globals.c
+++ b/src/backend/utils/init/globals.c
@@ -114,6 +114,9 @@
bool IsBinaryUpgrade = false;
bool IsBackgroundWorker = false;

+/* Spock core-patchset identity. */
+int SpockCorePatchsetVersion = SPOCK_CORE_PATCHSET_VERSION;
+
bool ExitOnAnyError = false;

int DateStyle = USE_ISO_DATES;
32 changes: 32 additions & 0 deletions patches/17/pg17-000-spock-patchset-version.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Spock core-patchset: export patchset version via miscadmin.h and globals.c.

Adds SPOCK_CORE_PATCHSET_VERSION (compile-time constant) and
SpockCorePatchsetVersion (runtime global) to the standard places
PostgreSQL already uses for server-wide state. No new files.

--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -525,4 +525,11 @@
/* in executor/nodeHash.c */
extern size_t get_hash_memory_limit(void);

+/*
+ * Spock core-patchset identity. Bump the version when the patchset
+ * changes in a way visible to the extension binary.
+ */
+#define SPOCK_CORE_PATCHSET_VERSION 1
+extern PGDLLIMPORT int SpockCorePatchsetVersion;
+
#endif /* MISCADMIN_H */
--- a/src/backend/utils/init/globals.c
+++ b/src/backend/utils/init/globals.c
@@ -117,6 +117,9 @@
bool IsUnderPostmaster = false;
bool IsBinaryUpgrade = false;

+/* Spock core-patchset identity. */
+int SpockCorePatchsetVersion = SPOCK_CORE_PATCHSET_VERSION;
+
bool ExitOnAnyError = false;

int DateStyle = USE_ISO_DATES;
32 changes: 32 additions & 0 deletions patches/18/pg18-000-spock-patchset-version.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Spock core-patchset: export patchset version via miscadmin.h and globals.c.

Adds SPOCK_CORE_PATCHSET_VERSION (compile-time constant) and
SpockCorePatchsetVersion (runtime global) to the standard places
PostgreSQL already uses for server-wide state. No new files.

--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -540,4 +540,11 @@
/* in executor/nodeHash.c */
extern size_t get_hash_memory_limit(void);

+/*
+ * Spock core-patchset identity. Bump the version when the patchset
+ * changes in a way visible to the extension binary.
+ */
+#define SPOCK_CORE_PATCHSET_VERSION 1
+extern PGDLLIMPORT int SpockCorePatchsetVersion;
+
#endif /* MISCADMIN_H */
--- a/src/backend/utils/init/globals.c
+++ b/src/backend/utils/init/globals.c
@@ -120,6 +120,9 @@
bool IsUnderPostmaster = false;
bool IsBinaryUpgrade = false;

+/* Spock core-patchset identity. */
+int SpockCorePatchsetVersion = SPOCK_CORE_PATCHSET_VERSION;
+
bool ExitOnAnyError = false;

int DateStyle = USE_ISO_DATES;
Loading
Loading