Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add xmin, xmax in test cases for troubleshooting flakiness. #808

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 37 additions & 33 deletions src/test/regress/expected/bfv_meta_track.out
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,63 @@
--CBDB GITHUB ISSUE:
--https://github.com/cloudberrydb/cloudberrydb/issues/504
--
-- start_ignore
drop schema if exists bfv_meta_track;
-- end_ignore
create schema bfv_meta_track;
set search_path to bfv_meta_track;
select count(*) from pg_stat_last_operation join
select staactionname, stasubtype, nspname from pg_stat_last_operation join
pg_namespace on pg_namespace.oid = pg_stat_last_operation.objid
where pg_namespace.nspname = 'bfv_meta_track';
count
-------
1
staactionname | stasubtype | nspname
---------------+------------+----------------
CREATE | SCHEMA | bfv_meta_track
(1 row)

-- test drop popicy
create table t1(a int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Cloudberry Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
create policy p1 on t1 using (a % 2 = 0);
select count(*) from pg_stat_last_operation a join pg_policy b on b.oid = a.objid where b.polname = 'p1' and b.polrelid ='t1'::regclass::oid;
count
-------
1
select staactionname, stasubtype from pg_stat_last_operation a join pg_policy b on b.oid = a.objid where b.polname = 'p1' and b.polrelid ='t1'::regclass::oid;
staactionname | stasubtype
---------------+------------
CREATE | POLICY
(1 row)

-- start_ignore
select a.xmin as pg_stat_last_operation_xmin, a.xmax as pg_stat_last_operation_xmax,
b.xmin as pg_policy_xmin, b.xmax as pg_policy_xmax,
staactionname, stasubtype from pg_stat_last_operation a join pg_policy b on b.oid = a.objid
where b.polname = 'p1' and b.polrelid ='t1'::regclass::oid;

select xmin, xmax, relname from pg_class where oid in (select objid from (select objid, staactionname, stasubtype from pg_stat_last_operation a join pg_policy b on b.oid = a.objid where b.polname = 'p1' and b.polrelid ='t1'::regclass::oid ) a) ;

-- end_ignore
select relname from pg_class where oid in (select objid from (select objid, staactionname, stasubtype from pg_stat_last_operation a join pg_policy b on b.oid = a.objid where b.polname = 'p1' and b.polrelid ='t1'::regclass::oid ) a) ;
relname
---------
(0 rows)

drop policy p1 on t1;
select count(*) from pg_stat_last_operation a join pg_policy b on b.oid = a.objid where b.polname = 'p1' and b.polrelid ='t1'::regclass::oid;
count
-------
0
(1 row)
select staactionname, stasubtype from pg_stat_last_operation a join pg_policy b on b.oid = a.objid where b.polname = 'p1' and b.polrelid ='t1'::regclass::oid;
staactionname | stasubtype
---------------+------------
(0 rows)

--test drop publication
-- start_ignore
create publication pub1;
-- end_ignore
select count(*) from pg_stat_last_operation a join pg_publication b on b.oid = a.objid where b.pubname = 'pub1';
count
-------
1
select staactionname, stasubtype from pg_stat_last_operation a join pg_publication b on b.oid = a.objid where b.pubname = 'pub1';
staactionname | stasubtype
---------------+-------------
CREATE | PUBLICATION
(1 row)

drop publication pub1;
select count(*) from pg_stat_last_operation a join pg_publication b on b.oid = a.objid where b.pubname = 'pub1';
count
-------
0
(1 row)

drop schema bfv_meta_track cascade;
NOTICE: drop cascades to table t1
-- test drop schema
select count(*) from pg_stat_last_operation join
pg_namespace on pg_namespace.oid = pg_stat_last_operation.objid
where pg_namespace.nspname = 'bfv_meta_track';
count
-------
0
(1 row)
select staactionname, stasubtype from pg_stat_last_operation a join pg_publication b on b.oid = a.objid where b.pubname = 'pub1';
staactionname | stasubtype
---------------+------------
(0 rows)

28 changes: 17 additions & 11 deletions src/test/regress/sql/bfv_meta_track.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,35 @@
--https://github.com/cloudberrydb/cloudberrydb/issues/504
--

-- start_ignore
drop schema if exists bfv_meta_track;
-- end_ignore
create schema bfv_meta_track;
set search_path to bfv_meta_track;
select count(*) from pg_stat_last_operation join
select staactionname, stasubtype, nspname from pg_stat_last_operation join
pg_namespace on pg_namespace.oid = pg_stat_last_operation.objid
where pg_namespace.nspname = 'bfv_meta_track';

-- test drop popicy
create table t1(a int);
create policy p1 on t1 using (a % 2 = 0);
select count(*) from pg_stat_last_operation a join pg_policy b on b.oid = a.objid where b.polname = 'p1' and b.polrelid ='t1'::regclass::oid;
select staactionname, stasubtype from pg_stat_last_operation a join pg_policy b on b.oid = a.objid where b.polname = 'p1' and b.polrelid ='t1'::regclass::oid;
-- start_ignore
select a.xmin as pg_stat_last_operation_xmin, a.xmax as pg_stat_last_operation_xmax,
b.xmin as pg_policy_xmin, b.xmax as pg_policy_xmax,
staactionname, stasubtype from pg_stat_last_operation a join pg_policy b on b.oid = a.objid
where b.polname = 'p1' and b.polrelid ='t1'::regclass::oid;
select xmin, xmax, relname from pg_class where oid in (select objid from (select objid, staactionname, stasubtype from pg_stat_last_operation a join pg_policy b on b.oid = a.objid where b.polname = 'p1' and b.polrelid ='t1'::regclass::oid ) a) ;
-- end_ignore
select relname from pg_class where oid in (select objid from (select objid, staactionname, stasubtype from pg_stat_last_operation a join pg_policy b on b.oid = a.objid where b.polname = 'p1' and b.polrelid ='t1'::regclass::oid ) a) ;

drop policy p1 on t1;
select count(*) from pg_stat_last_operation a join pg_policy b on b.oid = a.objid where b.polname = 'p1' and b.polrelid ='t1'::regclass::oid;
select staactionname, stasubtype from pg_stat_last_operation a join pg_policy b on b.oid = a.objid where b.polname = 'p1' and b.polrelid ='t1'::regclass::oid;

--test drop publication
-- start_ignore
create publication pub1;
-- end_ignore
select count(*) from pg_stat_last_operation a join pg_publication b on b.oid = a.objid where b.pubname = 'pub1';
select staactionname, stasubtype from pg_stat_last_operation a join pg_publication b on b.oid = a.objid where b.pubname = 'pub1';
drop publication pub1;
select count(*) from pg_stat_last_operation a join pg_publication b on b.oid = a.objid where b.pubname = 'pub1';

drop schema bfv_meta_track cascade;
-- test drop schema
select count(*) from pg_stat_last_operation join
pg_namespace on pg_namespace.oid = pg_stat_last_operation.objid
where pg_namespace.nspname = 'bfv_meta_track';
select staactionname, stasubtype from pg_stat_last_operation a join pg_publication b on b.oid = a.objid where b.pubname = 'pub1';
Loading