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


The following commit(s) were added to refs/heads/main by this push:
     new 44a9f90bd13 Fix handling of interconnect_address and parallel worker 
check in single-node setup
44a9f90bd13 is described below

commit 44a9f90bd13f58274fffecc4571d22ae33c9481a
Author: Jianghua Yang <yjhj...@gmail.com>
AuthorDate: Thu Aug 14 22:27:22 2025 +0000

    Fix handling of interconnect_address and parallel worker check in 
single-node setup
    
    In InitializeParallelDSM(), interconnect_address may be NULL in a 
single-node
    deployment. Avoid passing NULL to strcpy() by checking before use and fall 
back
    to an empty string.
    
    Also, in index_create_internal(), refine the condition for enabling parallel
    index build. Instead of testing "ii_ParallelWorkers != -1", use the clearer 
and
    correct check "ii_ParallelWorkers > 0".
---
 src/backend/access/transam/parallel.c | 5 ++++-
 src/backend/catalog/index.c           | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/backend/access/transam/parallel.c 
b/src/backend/access/transam/parallel.c
index 1b52383f556..6ce60577a2f 100644
--- a/src/backend/access/transam/parallel.c
+++ b/src/backend/access/transam/parallel.c
@@ -379,7 +379,10 @@ InitializeParallelDSM(ParallelContext *pcxt)
        /* CDB: should sync some global states to workes */
        fps->cdb_aux_state.session_id = gp_session_id;
        fps->cdb_aux_state.num_segments = numsegmentsFromQD;
-       strcpy(fps->cdb_aux_state.interconnect_address, interconnect_address);
+       if (interconnect_address)
+               strcpy(fps->cdb_aux_state.interconnect_address, 
interconnect_address);
+       else
+               fps->cdb_aux_state.interconnect_address[0] = '\0';
        fps->cdb_aux_state.ic_htab_size = ic_htab_size;
 
        /* We can skip the rest of this if we're not budgeting for any workers. 
*/
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index d754d97c781..a775f32e2b0 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -1388,7 +1388,7 @@ index_create_internal(Relation heapRelation,
                 *
                 * We should bring it back in the future.
                 */
-               index_build(heapRelation, indexRelation, indexInfo, false, 
indexInfo->ii_ParallelWorkers != -1);
+               index_build(heapRelation, indexRelation, indexInfo, false, 
indexInfo->ii_ParallelWorkers > 0);
        }
 
        /*


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

Reply via email to