Track cluster-wide Citus version - method 1 - via on-demand fan-out#8691
Draft
alperkocatas wants to merge 1 commit into
Draft
Track cluster-wide Citus version - method 1 - via on-demand fan-out#8691alperkocatas wants to merge 1 commit into
alperkocatas wants to merge 1 commit into
Conversation
Add citus_version_num() returning the loaded CITUS_VERSION_NUM, and citus_minimum_cluster_version() which fans out to every active primary node, collects each node's version, and returns the oldest as a human-readable major.minor.patch string. No catalog or shared-memory changes.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds new SQL-callable functions to expose the local Citus version as an integer and to compute the minimum Citus version across the cluster by fanning out to all active primary nodes and returning the oldest version as major.minor.patch.
Changes:
- Add
pg_catalog.citus_version_num()returningCITUS_VERSION_NUMas an integer for easy comparison. - Add
pg_catalog.citus_minimum_cluster_version()which queries all active primary nodes forcitus_version_num()and returns the minimum as a human-readable version string. - Wire the new UDFs into the 14.0-1 → 15.0-1 upgrade and the corresponding downgrade.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/backend/distributed/utils/citus_version.c | Adds the new C UDF entry point citus_version_num() returning CITUS_VERSION_NUM. |
| src/backend/distributed/sql/udfs/citus_version_num/latest.sql | Defines SQL wrapper for pg_catalog.citus_version_num(). |
| src/backend/distributed/sql/udfs/citus_version_num/15.0-1.sql | Defines SQL wrapper for pg_catalog.citus_version_num() for the 15.0-1 upgrade path. |
| src/backend/distributed/sql/udfs/citus_minimum_cluster_version/latest.sql | Defines SQL wrapper for pg_catalog.citus_minimum_cluster_version(). |
| src/backend/distributed/sql/udfs/citus_minimum_cluster_version/15.0-1.sql | Defines SQL wrapper for pg_catalog.citus_minimum_cluster_version() for the 15.0-1 upgrade path. |
| src/backend/distributed/sql/downgrades/citus--15.0-1--14.0-1.sql | Drops the new UDFs on downgrade. |
| src/backend/distributed/sql/citus--14.0-1--15.0-1.sql | Includes the new UDF SQL definitions during upgrade to 15.0-1. |
| src/backend/distributed/operations/cluster_version.c | Implements citus_minimum_cluster_version() with on-demand fan-out to active primary nodes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+4
| CREATE OR REPLACE FUNCTION pg_catalog.citus_minimum_cluster_version() | ||
| RETURNS text | ||
| LANGUAGE C STRICT | ||
| AS 'MODULE_PATHNAME', $$citus_minimum_cluster_version$$; |
Comment on lines
+1
to
+4
| CREATE OR REPLACE FUNCTION pg_catalog.citus_minimum_cluster_version() | ||
| RETURNS text | ||
| LANGUAGE C STRICT | ||
| AS 'MODULE_PATHNAME', $$citus_minimum_cluster_version$$; |
Comment on lines
+39
to
+54
| /* | ||
| * citus_minimum_cluster_version returns the oldest (smallest) Citus version | ||
| * that is running on any active primary node in the cluster, formatted as a | ||
| * human-readable "major.minor.patch" string (e.g. "15.0.0"). The comparison is | ||
| * performed on the integer encoding used by citus_version_num(); only the final | ||
| * result is decoded to text for presentation. | ||
| */ | ||
| Datum | ||
| citus_minimum_cluster_version(PG_FUNCTION_ARGS) | ||
| { | ||
| CheckCitusVersion(ERROR); | ||
|
|
||
| int32 minimumVersion = MinimumClusterCitusVersion(); | ||
|
|
||
| PG_RETURN_TEXT_P(CitusVersionNumToText(minimumVersion)); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add citus_version_num() returning the loaded CITUS_VERSION_NUM, and citus_minimum_cluster_version() which fans out to every active primary node, collects each node's version, and returns the oldest as a human-readable major.minor.patch string. No catalog or shared-memory changes.
DESCRIPTION: PR description that will go into the change log, up to 78 characters