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

maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit caabc899b5af023b23825eee745eee008d25b054
Author: Dennis Kovalenko <[email protected]>
AuthorDate: Mon Aug 1 05:48:42 2022 +0300

    Gang loss with gp_dist_wait_status during running transaction.
    
    gp_dist_wait_status used to destroy a gang after
    execution, which led to a transaction failing.
    This fix deletes related code lines, so that the
    transaction won't fail.
---
 src/backend/utils/gdd/gddfuncs.c       | 2 --
 src/test/regress/expected/deadlock.out | 9 +++++++++
 src/test/regress/sql/deadlock.sql      | 7 +++++++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/backend/utils/gdd/gddfuncs.c b/src/backend/utils/gdd/gddfuncs.c
index 6e729bfc7c..661f9de7d4 100644
--- a/src/backend/utils/gdd/gddfuncs.c
+++ b/src/backend/utils/gdd/gddfuncs.c
@@ -322,8 +322,6 @@ gp_dist_wait_status(PG_FUNCTION_ARGS)
        }
 
        cdbdisp_clearCdbPgResults(&ctx->cdb_pgresults);
-       if (Gp_role == GP_ROLE_DISPATCH)
-               DisconnectAndDestroyAllGangs(false);
 
        SRF_RETURN_DONE(funcctx);
 }
diff --git a/src/test/regress/expected/deadlock.out 
b/src/test/regress/expected/deadlock.out
index dfdc3c0ed4..6eaf873e7f 100644
--- a/src/test/regress/expected/deadlock.out
+++ b/src/test/regress/expected/deadlock.out
@@ -56,3 +56,12 @@ NOTICE:  drop cascades to 3 other objects
 DETAIL:  drop cascades to table l
 drop cascades to table r
 drop cascades to table sanity_check_distribution
+-- Check gp_dist_wait_status not failing within a transaction
+-- Github issue: https://github.com/greenplum-db/gpdb/issues/13795
+BEGIN;
+       select * from gp_dist_wait_status();
+ segid | waiter_dxid | holder_dxid | holdTillEndXact | waiter_lpid | 
holder_lpid | waiter_lockmode | waiter_locktype | waiter_sessionid | 
holder_sessionid 
+-------+-------------+-------------+-----------------+-------------+-------------+-----------------+-----------------+------------------+------------------
+(0 rows)
+
+COMMIT;
diff --git a/src/test/regress/sql/deadlock.sql 
b/src/test/regress/sql/deadlock.sql
index fc202e8461..37b767e0e2 100644
--- a/src/test/regress/sql/deadlock.sql
+++ b/src/test/regress/sql/deadlock.sql
@@ -47,3 +47,10 @@ select count(*) from gp_dist_random('l') left outer join 
gp_dist_random('r') on
 
 
 drop schema if exists deadlock cascade;
+
+-- Check gp_dist_wait_status not failing within a transaction
+-- Github issue: https://github.com/greenplum-db/gpdb/issues/13795
+
+BEGIN;
+       select * from gp_dist_wait_status();
+COMMIT;


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

Reply via email to