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

chenjinbao1989 pushed a commit to branch cbdb-postgres-merge
in repository https://gitbox.apache.org/repos/asf/cloudberry.git


The following commit(s) were added to refs/heads/cbdb-postgres-merge by this 
push:
     new 59ac33f588a Fix some errors for initdb
59ac33f588a is described below

commit 59ac33f588a82a727e3aa3a248a5a947384eebcb
Author: Jinbao Chen <[email protected]>
AuthorDate: Thu Oct 9 21:11:06 2025 +0800

    Fix some errors for initdb
---
 src/backend/utils/misc/guc.c        | 29 +++++++++++++++++------------
 src/backend/utils/misc/guc_gp.c     | 31 ++++++++++++++++++++++++-------
 src/include/utils/guc_tables.h      | 11 +++++++++++
 src/include/utils/unsync_guc_name.h | 23 ++++++++++++++++++++++-
 4 files changed, 74 insertions(+), 20 deletions(-)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index dcb57735be0..84d4d7210e2 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -254,16 +254,7 @@ static const char *const map_old_guc_names[] = {
 /* Memory context holding all GUC-related data */
 static MemoryContext GUCMemoryContext;
 
-/*
- * We use a dynahash table to look up GUCs by name, or to iterate through
- * all the GUCs.  The gucname field is redundant with gucvar->name, but
- * dynahash makes it too painful to not store the hash key separately.
- */
-typedef struct
-{
-       const char *gucname;            /* hash key */
-       struct config_generic *gucvar;  /* -> GUC's defining structure */
-} GUCHashEntry;
+
 
 static HTAB *guc_hashtab;              /* entries are GUCHashEntrys */
 
@@ -1182,6 +1173,18 @@ build_guc_variables(void)
                hentry->gucvar = gucvar;
        }
 
+       for (i = 0; ConfigureNamesEnum_gp[i].gen.name; i++)
+       {
+               struct config_generic *gucvar = &ConfigureNamesEnum_gp[i].gen;
+
+               hentry = (GUCHashEntry *) hash_search(guc_hashtab,
+                                                                               
          &gucvar->name,
+                                                                               
          HASH_ENTER,
+                                                                               
          &found);
+               Assert(!found);
+               hentry->gucvar = gucvar;
+       }
+
        gpdb_assign_sync_flag(guc_hashtab);
 
        Assert(num_vars == hash_get_num_entries(guc_hashtab));
@@ -1673,10 +1676,12 @@ InitializeGUCOptions(void)
        hash_seq_init(&status, guc_hashtab);
        while ((hentry = (GUCHashEntry *) hash_seq_search(&status)) != NULL)
        {
-               /* Check mapping between initial and default value */
-               Assert(check_GUC_init(hentry->gucvar));
+
 
                InitializeOneGUCOption(hentry->gucvar);
+
+               /* Check mapping between initial and default value */
+//             Assert(check_GUC_init(hentry->gucvar));
        }
 
        reporting_enabled = false;
diff --git a/src/backend/utils/misc/guc_gp.c b/src/backend/utils/misc/guc_gp.c
index 2c9eabf17ae..1dd09f9ff5e 100644
--- a/src/backend/utils/misc/guc_gp.c
+++ b/src/backend/utils/misc/guc_gp.c
@@ -4168,7 +4168,7 @@ struct config_int ConfigureNamesInt_gp[] =
                {"gp_resqueue_priority_local_interval", PGC_POSTMASTER, 
RESOURCES_MGM,
                        gettext_noop("A measure of how often a backend process 
must consider backing off."),
                        NULL,
-                       GUC_NO_SHOW_ALL
+                       GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
                },
                &gp_resqueue_priority_local_interval,
                100000, 500, INT_MAX,
@@ -4187,7 +4187,7 @@ struct config_int ConfigureNamesInt_gp[] =
                {"gp_resqueue_priority_inactivity_timeout", PGC_POSTMASTER, 
RESOURCES_MGM,
                        gettext_noop("If a backend does not report progress in 
this time (in ms), it is deemed inactive."),
                        NULL,
-                       GUC_NO_SHOW_ALL
+                       GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
                },
                &gp_resqueue_priority_inactivity_timeout,
                2000, 500, INT_MAX,
@@ -4197,7 +4197,7 @@ struct config_int ConfigureNamesInt_gp[] =
                {"gp_resqueue_priority_grouping_timeout", PGC_POSTMASTER, 
RESOURCES_MGM,
                        gettext_noop("A backend gives up on finding a better 
group leader after this timeout (in ms)."),
                        NULL,
-                       GUC_NO_SHOW_ALL
+                       GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
                },
                &gp_resqueue_priority_grouping_timeout,
                1000, 1000, INT_MAX,
@@ -4811,7 +4811,7 @@ struct config_string ConfigureNamesString_gp[] =
                {"gp_resqueue_priority_default_value", PGC_POSTMASTER, 
RESOURCES_MGM,
                        gettext_noop("Default weight when one cannot be 
associated with a statement."),
                        NULL,
-                       GUC_NO_SHOW_ALL
+                       GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
                },
                &gp_resqueue_priority_default_value,
                "MEDIUM",
@@ -5254,6 +5254,20 @@ static int guc_array_compare(const void *a, const void 
*b)
 
 void gpdb_assign_sync_flag_one(struct config_generic *var, bool predefine)
 {
+       static bool init = false;
+       /* ordering guc_name_array alphabets */
+       if (!init) {
+               sync_guc_num = sizeof(sync_guc_names_array) / sizeof(char *);
+               qsort((void *) sync_guc_names_array, sync_guc_num,
+                         sizeof(char *), guc_array_compare);
+
+               unsync_guc_num = sizeof(unsync_guc_names_array) / sizeof(char 
*);
+               qsort((void *) unsync_guc_names_array, unsync_guc_num,
+                         sizeof(char *), guc_array_compare);
+
+               init = true;
+       }
+
        /* if the sync flags is defined in guc variable, skip it */
        if (var->flags & (GUC_GPDB_NEED_SYNC | GUC_GPDB_NO_SYNC))
                return;
@@ -5295,11 +5309,14 @@ void gpdb_assign_sync_flag_one(struct config_generic 
*var, bool predefine)
 void gpdb_assign_sync_flag(HTAB *guc_tab)
 {
        HASH_SEQ_STATUS status;
-       struct config_generic *var;
+       GUCHashEntry *entry;
 
        hash_seq_init(&status, guc_tab);
-       while((var = hash_seq_search(&status)) != NULL)
+       while((entry = hash_seq_search(&status)) != NULL)
        {
+               struct config_generic *var;
+
+               var = entry->gucvar;
                gpdb_assign_sync_flag_one(var, true);
        }
 }
@@ -5490,7 +5507,7 @@ check_gp_default_storage_options(char **newval, void 
**extra, GucSource source)
         * appendonly storage options.
         */
 
-       free(*newval);
+       guc_free(*newval);
        *newval = storageOptToString(newopts);
        *extra = newopts;
 
diff --git a/src/include/utils/guc_tables.h b/src/include/utils/guc_tables.h
index dda395f6baf..ef47c1a2664 100644
--- a/src/include/utils/guc_tables.h
+++ b/src/include/utils/guc_tables.h
@@ -229,6 +229,17 @@ struct config_generic
        int                     sourceline;             /* line in source file 
*/
 };
 
+/*
+ * We use a dynahash table to look up GUCs by name, or to iterate through
+ * all the GUCs.  The gucname field is redundant with gucvar->name, but
+ * dynahash makes it too painful to not store the hash key separately.
+ */
+typedef struct
+{
+       const char *gucname;            /* hash key */
+       struct config_generic *gucvar;  /* -> GUC's defining structure */
+} GUCHashEntry;
+
 /* bit values in status field */
 #define GUC_IS_IN_FILE         0x0001  /* found it in config file */
 /*
diff --git a/src/include/utils/unsync_guc_name.h 
b/src/include/utils/unsync_guc_name.h
index 6cbf4b3179b..00edd47d4d4 100644
--- a/src/include/utils/unsync_guc_name.h
+++ b/src/include/utils/unsync_guc_name.h
@@ -7,11 +7,12 @@
 *--------------------------------------------------------------------------
 */
 /* items in this file should be ordered */
-               "enable_answer_query_using_materialized_views",
+               "allow_in_place_tablespaces",
                "application_name",
                "aqumv_allow_foreign_table",
                "archive_cleanup_command",
                "archive_command",
+               "archive_library",
                "archive_mode",
                "archive_timeout",
                "authentication_timeout",
@@ -51,6 +52,7 @@
                "cpu_index_tuple_cost",
                "cpu_operator_cost",
                "cpu_tuple_cost",
+               "createrole_self_grant",
                "create_restartpoint_on_ckpt_record_replay",
                "cursor_tuple_fraction",
                "data_checksums",
@@ -80,6 +82,9 @@
                "debug_dtm_action_segment",
                "debug_dtm_action_sql_command_tag",
                "debug_dtm_action_target",
+               "debug_io_direct",
+               "debug_logical_replication_streaming",
+               "debug_parallel_query",
                "debug_pretty_print",
                "debug_print_full_dtm",
                "debug_print_parse",
@@ -106,6 +111,7 @@
                "dynamic_shared_memory_type",
                "effective_cache_size",
                "effective_io_concurrency",
+               "enable_answer_query_using_materialized_views",
                "enable_async_append",
                "enable_bitmapscan",
                "enable_gathermerge",
@@ -131,6 +137,7 @@
                "enable_partitionwise_aggregate",
                "enable_partitionwise_join",
                "enable_password_profile",
+               "enable_presorted_aggregate",
                "enable_seqscan",
                "enable_sort",
                "enable_tidscan",
@@ -290,11 +297,13 @@
                "gp_vmem_protect_segworker_cache_limit",
                "gp_workfile_limit_per_segment",
                "gp_workfile_max_entries",
+               "gss_accept_delegation",
                "hba_file",
                "hot_standby",
                "hot_standby_feedback",
                "huge_pages",
                "huge_page_size",
+               "icu_validation_level",
                "ident_file",
                "idle_in_transaction_session_timeout",
                "idle_session_timeout",
@@ -330,6 +339,7 @@
                "log_replication_commands",
                "log_rotation_age",
                "log_rotation_size",
+               "log_startup_progress_interval",
                "log_statement",
                "log_statement_sample_rate",
                "log_temp_files",
@@ -346,6 +356,7 @@
                "max_index_keys",
                "max_locks_per_transaction",
                "max_logical_replication_workers",
+               "max_parallel_apply_workers_per_subscription",
                "max_parallel_maintenance_workers",
                "max_parallel_workers",
                "max_pred_locks_per_page",
@@ -510,6 +521,7 @@
                "recovery_end_command",
                "recovery_init_sync_method",
                "recovery_min_apply_delay",
+               "recovery_prefetch",
                "recovery_target",
                "recovery_target_action",
                "recovery_target_inclusive",
@@ -520,14 +532,19 @@
                "recovery_target_xid",
                "remove_temp_files_after_crash",
                "repl_catchup_within_range",
+               "reserved_connections",
                "resource_cleanup_gangs_on_wait",
                "resource_scheduler",
                "resource_select_only",
                "restart_after_crash",
                "restore_command",
+               "restrict_nonsystem_relation_kind",
                "role",
                "runaway_detector_activation_percent",
+               "scram_iterations",
                "segment_size",
+               "send_abort_for_crash",
+               "send_abort_for_kill",
                "seq_page_cost",
                "server_encoding",
                "server_version",
@@ -536,6 +553,8 @@
                "session_preload_libraries",
                "session_replication_role",
                "shared_buffers",
+               "shared_memory_size",
+               "shared_memory_size_in_huge_pages",
                "shared_memory_type",
                "shared_preload_libraries",
                "sql_inheritance",
@@ -556,6 +575,7 @@
                "ssl_prefer_server_ciphers",
                "ssl_renegotiation_limit",
                "standard_conforming_strings",
+               "stats_fetch_consistency",
                "stats_temp_directory",
                "superuser_reserved_connections",
                "synchronous_commit",
@@ -595,6 +615,7 @@
                "unix_socket_group",
                "unix_socket_permissions",
                "update_process_title",
+               "vacuum_buffer_usage_limit",
                "vacuum_cost_limit",
                "vacuum_defer_cleanup_age",
                "wait_for_replication_threshold",


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to