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 76b2ad511484745af282e1903df52e87abdf3576
Author: Huansong Fu <[email protected]>
AuthorDate: Fri May 10 11:52:57 2024 -0700

    Prepare GUC option string only once during gang creation
    
    The function makeOptions() is called for every segment which is not really
    necessary since the option string stays the same. Now prepare it just once.
---
 src/backend/cdb/dispatcher/cdbgang_async.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/backend/cdb/dispatcher/cdbgang_async.c 
b/src/backend/cdb/dispatcher/cdbgang_async.c
index 0b26f67b73..4bae04eda0 100644
--- a/src/backend/cdb/dispatcher/cdbgang_async.c
+++ b/src/backend/cdb/dispatcher/cdbgang_async.c
@@ -51,6 +51,8 @@ cdbgang_createGang_async(List *segments, SegmentType 
segmentType)
        PostgresPollingStatusType       *pollingStatus = NULL;
        SegmentDatabaseDescriptor       *segdbDesc = NULL;
        struct timeval  startTS;
+       char            *options = NULL;
+       char            *diff_options = NULL;
        Gang    *newGangDefinition;
        int             create_gang_retry_counter = 0;
        int             in_recovery_mode_count = 0;
@@ -74,6 +76,8 @@ cdbgang_createGang_async(List *segments, SegmentType 
segmentType)
 
        Assert(CurrentGangCreating == NULL);
 
+       makeOptions(&options, &diff_options);
+
        /* If we're in a retry, we may need to reset our initial state, a bit */
        newGangDefinition = NULL;
        /* allocate and initialize a gang structure */
@@ -135,8 +139,6 @@ create_gang_retry:
                {
                        bool            ret;
                        char            gpqeid[100];
-                       char       *options = NULL;
-                       char       *diff_options = NULL;
 
                        /*
                         * Create the connection requests.      If we find a 
segment without a
@@ -171,8 +173,6 @@ create_gang_retry:
                                                
(errcode(ERRCODE_GP_INTERCONNECTION_ERROR),
                                                 errmsg("failed to construct 
connectionstring")));
 
-                       makeOptions(&options, &diff_options);
-
                        /* start connection in asynchronous way */
                        cdbconn_doConnectStart(segdbDesc, gpqeid, options, 
diff_options);
 


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

Reply via email to