Skip to content

Commit 679a1e2

Browse files
authored
Fix flake test bfv_meta_track (apache#817)
One suppose is that oid_wraparound test is before bfv_meta_track test. Add stasubtype limit , make test stable.
1 parent 1efdb2b commit 679a1e2

File tree

2 files changed

+56
-52
lines changed

2 files changed

+56
-52
lines changed

src/test/regress/expected/bfv_meta_track.out

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,58 +7,61 @@ drop schema if exists bfv_meta_track;
77
-- end_ignore
88
create schema bfv_meta_track;
99
set search_path to bfv_meta_track;
10-
select staactionname, stasubtype, nspname from pg_stat_last_operation join
11-
pg_namespace on pg_namespace.oid = pg_stat_last_operation.objid
12-
where pg_namespace.nspname = 'bfv_meta_track';
13-
staactionname | stasubtype | nspname
14-
---------------+------------+----------------
15-
CREATE | SCHEMA | bfv_meta_track
10+
select count(*) from pg_stat_last_operation p join
11+
pg_namespace on pg_namespace.oid = p.objid
12+
where pg_namespace.nspname = 'bfv_meta_track' and p.stasubtype = 'SCHEMA';
13+
count
14+
-------
15+
1
1616
(1 row)
1717

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

29-
-- start_ignore
30-
select a.xmin as pg_stat_last_operation_xmin, a.xmax as pg_stat_last_operation_xmax,
31-
b.xmin as pg_policy_xmin, b.xmax as pg_policy_xmax,
32-
staactionname, stasubtype from pg_stat_last_operation a join pg_policy b on b.oid = a.objid
33-
where b.polname = 'p1' and b.polrelid ='t1'::regclass::oid;
34-
35-
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) ;
36-
37-
-- end_ignore
38-
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) ;
39-
relname
40-
---------
41-
(0 rows)
42-
4330
drop policy p1 on t1;
44-
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;
45-
staactionname | stasubtype
46-
---------------+------------
47-
(0 rows)
31+
select count(*) from pg_stat_last_operation a join pg_policy b on b.oid = a.objid
32+
where b.polname = 'p1' and b.polrelid ='t1'::regclass::oid and a.stasubtype = 'POLICY';
33+
count
34+
-------
35+
0
36+
(1 row)
4837

4938
--test drop publication
5039
-- start_ignore
5140
create publication pub1;
5241
-- end_ignore
53-
select staactionname, stasubtype from pg_stat_last_operation a join pg_publication b on b.oid = a.objid where b.pubname = 'pub1';
54-
staactionname | stasubtype
55-
---------------+-------------
56-
CREATE | PUBLICATION
42+
select count(*) from pg_stat_last_operation a join pg_publication b on b.oid = a.objid
43+
where b.pubname = 'pub1' and a.stasubtype = 'PUBLICATION';
44+
count
45+
-------
46+
1
5747
(1 row)
5848

5949
drop publication pub1;
60-
select staactionname, stasubtype from pg_stat_last_operation a join pg_publication b on b.oid = a.objid where b.pubname = 'pub1';
61-
staactionname | stasubtype
62-
---------------+------------
63-
(0 rows)
50+
select count(*) from pg_stat_last_operation a join pg_publication b on b.oid = a.objid
51+
where b.pubname = 'pub1' and a.stasubtype = 'PUBLICATION';
52+
count
53+
-------
54+
0
55+
(1 row)
56+
57+
drop schema bfv_meta_track cascade;
58+
NOTICE: drop cascades to table t1
59+
-- test drop schema
60+
select count(*) from pg_stat_last_operation join
61+
pg_namespace on pg_namespace.oid = pg_stat_last_operation.objid
62+
where pg_namespace.nspname = 'bfv_meta_track';
63+
count
64+
-------
65+
0
66+
(1 row)
6467

src/test/regress/sql/bfv_meta_track.sql

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,31 @@ drop schema if exists bfv_meta_track;
88
-- end_ignore
99
create schema bfv_meta_track;
1010
set search_path to bfv_meta_track;
11-
select staactionname, stasubtype, nspname from pg_stat_last_operation join
12-
pg_namespace on pg_namespace.oid = pg_stat_last_operation.objid
13-
where pg_namespace.nspname = 'bfv_meta_track';
11+
select count(*) from pg_stat_last_operation p join
12+
pg_namespace on pg_namespace.oid = p.objid
13+
where pg_namespace.nspname = 'bfv_meta_track' and p.stasubtype = 'SCHEMA';
1414

1515
-- test drop popicy
1616
create table t1(a int);
1717
create policy p1 on t1 using (a % 2 = 0);
18-
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;
19-
-- start_ignore
20-
select a.xmin as pg_stat_last_operation_xmin, a.xmax as pg_stat_last_operation_xmax,
21-
b.xmin as pg_policy_xmin, b.xmax as pg_policy_xmax,
22-
staactionname, stasubtype from pg_stat_last_operation a join pg_policy b on b.oid = a.objid
23-
where b.polname = 'p1' and b.polrelid ='t1'::regclass::oid;
24-
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) ;
25-
-- end_ignore
26-
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) ;
27-
18+
select count(*) from pg_stat_last_operation a join pg_policy b on b.oid = a.objid
19+
where b.polname = 'p1' and b.polrelid ='t1'::regclass::oid and a.stasubtype = 'POLICY';
2820
drop policy p1 on t1;
29-
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;
21+
select count(*) from pg_stat_last_operation a join pg_policy b on b.oid = a.objid
22+
where b.polname = 'p1' and b.polrelid ='t1'::regclass::oid and a.stasubtype = 'POLICY';
3023

3124
--test drop publication
3225
-- start_ignore
3326
create publication pub1;
3427
-- end_ignore
35-
select staactionname, stasubtype from pg_stat_last_operation a join pg_publication b on b.oid = a.objid where b.pubname = 'pub1';
28+
select count(*) from pg_stat_last_operation a join pg_publication b on b.oid = a.objid
29+
where b.pubname = 'pub1' and a.stasubtype = 'PUBLICATION';
3630
drop publication pub1;
37-
select staactionname, stasubtype from pg_stat_last_operation a join pg_publication b on b.oid = a.objid where b.pubname = 'pub1';
31+
select count(*) from pg_stat_last_operation a join pg_publication b on b.oid = a.objid
32+
where b.pubname = 'pub1' and a.stasubtype = 'PUBLICATION';
33+
34+
drop schema bfv_meta_track cascade;
35+
-- test drop schema
36+
select count(*) from pg_stat_last_operation join
37+
pg_namespace on pg_namespace.oid = pg_stat_last_operation.objid
38+
where pg_namespace.nspname = 'bfv_meta_track';

0 commit comments

Comments
 (0)