You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by yj...@apache.org on 2025/01/20 04:03:08 UTC

(cloudberry) 11/25: Don't use PGC_S_OVERRIDE for setting gp_role GUC

This is an automated email from the ASF dual-hosted git repository.

yjhjstz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 7ac7eb629ea19eba90a0a0fea67657c303986bfc
Author: Ashwin Agrawal <aa...@vmware.com>
AuthorDate: Tue Aug 22 12:29:02 2023 -0700

    Don't use PGC_S_OVERRIDE for setting gp_role GUC
    
    If gp_role value is not specified then internally "utility" is set as
    default. This is mainly for single node coordinator or
    segments. Changing that setting to use PGC_S_DYNAMIC_DEFAULT instead
    of PGC_S_OVERRIDE.
    
    The problem with using PGC_S_OVERRIDE is GUC value can't be set
    later. Since commit 260710, we rely on assign_gp_role() hook to set
    should_reject_connection. If PGC_S_OVERRIDE is used to
    SetConfigOption() while setting the default in PostmasterMain(), then
    later setting gp_role via PGOPTIONS or any other mechanism will not
    call the assign hook and hence misses to set
    should_reject_connection. The reason for change being safe is
    check_gp_role() only allows "utility" mode to set as value for this
    GUC and any other values like "execute" or "dispatch" are already
    banned from PGOPTIONS or postgresql.conf followed by reload.
    
    This problem was exposed by src/test/gpdb_pitr/test_gpdb_pitr.sh tests
    which gets fixed now.
    
    Reviewed-by: Marbin Tan <tm...@vmware.com>
---
 src/backend/postmaster/postmaster.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index e70e91b33f..66ed31cafd 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -1039,9 +1039,14 @@ PostmasterMain(int argc, char *argv[])
 		ExitPostmaster(1);
 	}
 
-	/* If gp_role is not set, use utility role instead.*/
+	/*
+	 * If gp_role is not set, use utility role instead.
+	 *
+	 * A single node coordinator or segment is set to utility, which is not
+	 * before Greenplum 7.
+	 */
 	if (Gp_role == GP_ROLE_UNDEFINED)
-		SetConfigOption("gp_role", "utility", PGC_POSTMASTER, PGC_S_OVERRIDE);
+		SetConfigOption("gp_role", "utility", PGC_POSTMASTER, PGC_S_DYNAMIC_DEFAULT);
 
 	/*
 	 * Locate the proper configuration files and data directory, and read


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org