Skip to content

Commit 44a9f90

Browse files
committed
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".
1 parent 6a754f7 commit 44a9f90

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/backend/access/transam/parallel.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,10 @@ InitializeParallelDSM(ParallelContext *pcxt)
379379
/* CDB: should sync some global states to workes */
380380
fps->cdb_aux_state.session_id = gp_session_id;
381381
fps->cdb_aux_state.num_segments = numsegmentsFromQD;
382-
strcpy(fps->cdb_aux_state.interconnect_address, interconnect_address);
382+
if (interconnect_address)
383+
strcpy(fps->cdb_aux_state.interconnect_address, interconnect_address);
384+
else
385+
fps->cdb_aux_state.interconnect_address[0] = '\0';
383386
fps->cdb_aux_state.ic_htab_size = ic_htab_size;
384387

385388
/* We can skip the rest of this if we're not budgeting for any workers. */

src/backend/catalog/index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,7 @@ index_create_internal(Relation heapRelation,
13881388
*
13891389
* We should bring it back in the future.
13901390
*/
1391-
index_build(heapRelation, indexRelation, indexInfo, false, indexInfo->ii_ParallelWorkers != -1);
1391+
index_build(heapRelation, indexRelation, indexInfo, false, indexInfo->ii_ParallelWorkers > 0);
13921392
}
13931393

13941394
/*

0 commit comments

Comments
 (0)