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 79b8ace965ad334f0317238ff25d1446389ed806
Author: Soumyadeep Chakraborty <[email protected]>
AuthorDate: Mon Jun 26 14:05:12 2023 -0700

    resource_queue.sql: Add pg_locks sanity check
    
    This simply ensures that pg_locks does not have any resource queue locks
    upon tramsaction completion, in the test file.
---
 src/test/isolation2/expected/resource_queue.out | 8 +++++++-
 src/test/isolation2/sql/resource_queue.sql      | 5 ++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/test/isolation2/expected/resource_queue.out 
b/src/test/isolation2/expected/resource_queue.out
index 51eaca4a7e..df438a16f2 100644
--- a/src/test/isolation2/expected/resource_queue.out
+++ b/src/test/isolation2/expected/resource_queue.out
@@ -39,7 +39,7 @@ SET
 PREPARE
 3&:EXECUTE fooplan;  <waiting ...>
 
--- Check pg_stat_activity and pg_locks again.
+-- Check pg_stat_activity and pg_locks.
 0:SELECT wait_event_type, wait_event from pg_stat_activity where query = 
'EXECUTE fooplan;';
  wait_event_type | wait_event    
 -----------------+---------------
@@ -73,6 +73,12 @@ END
 3:END;
 END
 
+-- Sanity check: Ensure that all locks were released.
+0:SELECT granted, locktype, mode FROM pg_locks where locktype = 'resource 
queue' and pid != pg_backend_pid();
+ granted | locktype | mode 
+---------+----------+------
+(0 rows)
+
 -- Sanity check: Ensure that the resource queue is now empty.
 0: SELECT rsqcountlimit, rsqcountvalue from pg_resqueue_status WHERE rsqname = 
'rq_concurrency_test';
  rsqcountlimit | rsqcountvalue 
diff --git a/src/test/isolation2/sql/resource_queue.sql 
b/src/test/isolation2/sql/resource_queue.sql
index a49f289cc8..61bdabec08 100644
--- a/src/test/isolation2/sql/resource_queue.sql
+++ b/src/test/isolation2/sql/resource_queue.sql
@@ -22,7 +22,7 @@
 3:PREPARE fooplan AS SELECT 1;
 3&:EXECUTE fooplan;
 
--- Check pg_stat_activity and pg_locks again.
+-- Check pg_stat_activity and pg_locks.
 0:SELECT wait_event_type, wait_event from pg_stat_activity where query = 
'EXECUTE fooplan;';
 0:SELECT granted, locktype, mode FROM pg_locks where locktype = 'resource 
queue' and pid != pg_backend_pid();
 
@@ -34,6 +34,9 @@
 3<:
 3:END;
 
+-- Sanity check: Ensure that all locks were released.
+0:SELECT granted, locktype, mode FROM pg_locks where locktype = 'resource 
queue' and pid != pg_backend_pid();
+
 -- Sanity check: Ensure that the resource queue is now empty.
 0: SELECT rsqcountlimit, rsqcountvalue from pg_resqueue_status WHERE rsqname = 
'rq_concurrency_test';
 


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

Reply via email to