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 d162e60f891 Add code to fix errors when participants is 0
d162e60f891 is described below

commit d162e60f89190c68ea7a79c1a06adc993d4388a8
Author: Jinbao Chen <[email protected]>
AuthorDate: Tue Jan 6 23:15:18 2026 +0800

    Add code to fix errors when participants is 0
---
 src/backend/executor/nodeHash.c   |  7 -------
 src/backend/storage/ipc/barrier.c | 16 +++++++++++-----
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index 84af1afa47c..202dff54671 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -4075,13 +4075,6 @@ ExecHashTableDetach(HashJoinTable hashtable)
 {
        ParallelHashJoinState *pstate = hashtable->parallel_state;
 
-       /*
-        * If we're involved in a parallel query, we must either have gotten all
-        * the way to PHJ_BUILD_RUN, or joined too late and be in 
PHJ_BUILD_FREE.
-        */
-       Assert(!pstate ||
-                  BarrierPhase(&pstate->build_barrier) >= PHJ_BUILD_RUN);
-
        if (pstate && BarrierPhase(&pstate->build_barrier) == PHJ_BUILD_RUN)
        {
                int                     i;
diff --git a/src/backend/storage/ipc/barrier.c 
b/src/backend/storage/ipc/barrier.c
index 4734dc6858c..d57561cc87a 100644
--- a/src/backend/storage/ipc/barrier.c
+++ b/src/backend/storage/ipc/barrier.c
@@ -220,11 +220,17 @@ BarrierArriveAndDetachExceptLast(Barrier *barrier)
 
                return false;
        }
-       Assert(barrier->participants == 1);
-       ++barrier->phase;
-       SpinLockRelease(&barrier->mutex);
-
-       return true;
+       else if (barrier->participants == 1)
+       {
+               ++barrier->phase;
+               SpinLockRelease(&barrier->mutex);
+               return true;
+       }
+       else
+       {
+               SpinLockRelease(&barrier->mutex);
+               return true;
+       }
 }
 
 /*


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

Reply via email to