Skip to content

Commit 768c1a3

Browse files
lss602726449oppenheimer01
authored andcommitted
Fix: Adapt system view after cherry-pick
1 parent 92dd7c4 commit 768c1a3

25 files changed

Lines changed: 503 additions & 391 deletions

contrib/auto_explain/expected/auto_explain_optimizer.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ LOG: duration: 0.026 ms plan:
3838
Query Text: SELECT relname FROM pg_class WHERE relname='pg_class';
3939
Index Only Scan using pg_class_relname_nsp_index on pg_class (cost=0.15..4.17 rows=1 width=64) (actual rows=1 loops=1)
4040
Index Cond: (relname = 'pg_class'::name)
41-
Heap Fetches: 1
41+
Heap Fetches: 0
4242
(slice0) Executor memory: 105K bytes.
4343
Memory used: 128000kB
4444
relname

contrib/pax_storage/src/test/isolation2/input/autovacuum-analyze.source

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ SELECT count(*) FROM pg_statistic where starelid = 'autostatstbl'::regclass;
178178
select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
179179
-- expect analyze_count = 1, autoanalyze_count = 0, and n_mod_since_analyze = 1000 since ANALYZE executed
180180
-- in same transaction for the insert statement.
181-
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
181+
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
182182

183183
-- Wait until autovacuum is triggered
184184
SELECT gp_wait_until_triggered_fault('auto_vac_worker_after_report_activity', 1, 1);
@@ -192,7 +192,7 @@ SELECT gp_inject_fault('analyze_finished_one_relation', 'reset', 1);
192192
-- we can see the auto-ANALYZE finished
193193
select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
194194
-- expect analyze_count = 1, autoanalyze_count = 1, and n_mod_since_analyze = 0
195-
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
195+
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
196196

197197
-- Case 2 --
198198
-- with auto_stats 'on_change' mode, the auto-ANALYZE still trigger
@@ -211,7 +211,7 @@ SELECT gp_inject_fault('auto_vac_worker_after_report_activity', 'suspend', '', '
211211
select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
212212
-- expect analyze_count = 2, autoanalyze_count = 1, and n_mod_since_analyze = 1000 since ANALYZE executed
213213
-- in same transaction for the insert statement.
214-
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
214+
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
215215

216216
-- Wait until autovacuum is triggered
217217
SELECT gp_wait_until_triggered_fault('auto_vac_worker_after_report_activity', 1, 1);
@@ -225,7 +225,7 @@ SELECT gp_inject_fault('analyze_finished_one_relation', 'reset', 1);
225225
-- we can see the auto-ANALYZE finished, check statistic and analyze count
226226
select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
227227
-- expect analyze_count = 2, autoanalyze_count = 2, and n_mod_since_analyze = 0
228-
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
228+
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
229229

230230

231231
-- Case 3 --
@@ -244,7 +244,7 @@ SELECT gp_inject_fault('auto_vac_worker_after_report_activity', 'suspend', '', '
244244
select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
245245
-- expect analyze_count = 2, autoanalyze_count = 2, and n_mod_since_analyze = 1000 since ANALYZE executed
246246
-- in same transaction for the insert statement.
247-
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
247+
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
248248

249249
-- Wait until autovacuum is triggered
250250
SELECT gp_wait_until_triggered_fault('auto_vac_worker_after_report_activity', 1, 1);
@@ -258,7 +258,7 @@ SELECT gp_inject_fault('analyze_finished_one_relation', 'reset', 1);
258258
-- we can see the auto-ANALYZE finished, check statistic and analyze count
259259
select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
260260
-- expect analyze_count = 2, autoanalyze_count = 3, and n_mod_since_analyze = 0 since ANALYZE executed
261-
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
261+
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
262262

263263
-- Reset GUCs.
264264
ALTER SYSTEM RESET autovacuum_naptime;

contrib/pax_storage/src/test/isolation2/output/autovacuum-analyze.source

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
422422
(1 row)
423423
-- expect analyze_count = 1, autoanalyze_count = 0, and n_mod_since_analyze = 1000 since ANALYZE executed
424424
-- in same transaction for the insert statement.
425-
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
425+
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
426426
analyze_count | autoanalyze_count | n_mod_since_analyze
427427
---------------+-------------------+---------------------
428428
1 | 0 | 1000
@@ -465,7 +465,7 @@ select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
465465
1 | 1000
466466
(1 row)
467467
-- expect analyze_count = 1, autoanalyze_count = 1, and n_mod_since_analyze = 0
468-
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
468+
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
469469
analyze_count | autoanalyze_count | n_mod_since_analyze
470470
---------------+-------------------+---------------------
471471
1 | 1 | 0
@@ -502,7 +502,7 @@ select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
502502
(1 row)
503503
-- expect analyze_count = 2, autoanalyze_count = 1, and n_mod_since_analyze = 1000 since ANALYZE executed
504504
-- in same transaction for the insert statement.
505-
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
505+
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
506506
analyze_count | autoanalyze_count | n_mod_since_analyze
507507
---------------+-------------------+---------------------
508508
2 | 1 | 1000
@@ -545,7 +545,7 @@ select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
545545
1 | 2000
546546
(1 row)
547547
-- expect analyze_count = 2, autoanalyze_count = 2, and n_mod_since_analyze = 0
548-
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
548+
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
549549
analyze_count | autoanalyze_count | n_mod_since_analyze
550550
---------------+-------------------+---------------------
551551
2 | 2 | 0
@@ -581,7 +581,7 @@ select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
581581
(1 row)
582582
-- expect analyze_count = 2, autoanalyze_count = 2, and n_mod_since_analyze = 1000 since ANALYZE executed
583583
-- in same transaction for the insert statement.
584-
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
584+
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
585585
analyze_count | autoanalyze_count | n_mod_since_analyze
586586
---------------+-------------------+---------------------
587587
2 | 2 | 1000
@@ -624,7 +624,7 @@ select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
624624
1 | 3000
625625
(1 row)
626626
-- expect analyze_count = 2, autoanalyze_count = 3, and n_mod_since_analyze = 0 since ANALYZE executed
627-
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
627+
select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
628628
analyze_count | autoanalyze_count | n_mod_since_analyze
629629
---------------+-------------------+---------------------
630630
2 | 3 | 0

contrib/pax_storage/src/test/regress/expected/pg_stat.out

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ create table pg_stat_test(a int);
55
select
66
schemaname, relname, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch, n_tup_ins, n_tup_upd,
77
n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup
8-
from pg_stat_all_tables where relname = 'pg_stat_test';
8+
from gp_stat_all_tables_summary where relname = 'pg_stat_test';
99
schemaname | relname | seq_scan | seq_tup_read | idx_scan | idx_tup_fetch | n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup
1010
------------+--------------+----------+--------------+----------+---------------+-----------+-----------+-----------+---------------+------------+------------
1111
public | pg_stat_test | 0 | 0 | | | 0 | 0 | 0 | 0 | 0 | 0
@@ -14,22 +14,22 @@ from pg_stat_all_tables where relname = 'pg_stat_test';
1414
select
1515
schemaname, relname, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch, n_tup_ins, n_tup_upd,
1616
n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup
17-
from pg_stat_user_tables where relname = 'pg_stat_test';
17+
from gp_stat_user_tables_summary where relname = 'pg_stat_test';
1818
schemaname | relname | seq_scan | seq_tup_read | idx_scan | idx_tup_fetch | n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup
1919
------------+--------------+----------+--------------+----------+---------------+-----------+-----------+-----------+---------------+------------+------------
2020
public | pg_stat_test | 0 | 0 | | | 0 | 0 | 0 | 0 | 0 | 0
2121
(1 row)
2222

2323
select
2424
schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
25-
from pg_stat_all_indexes where relname = 'pg_stat_test';
25+
from gp_stat_all_indexes_summary where relname = 'pg_stat_test';
2626
schemaname | relname | indexrelname | idx_scan | idx_tup_read | idx_tup_fetch
2727
------------+---------+--------------+----------+--------------+---------------
2828
(0 rows)
2929

3030
select
3131
schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
32-
from pg_stat_user_indexes where relname = 'pg_stat_test';
32+
from gp_stat_user_indexes_summary where relname = 'pg_stat_test';
3333
schemaname | relname | indexrelname | idx_scan | idx_tup_read | idx_tup_fetch
3434
------------+---------+--------------+----------+--------------+---------------
3535
(0 rows)
@@ -63,7 +63,7 @@ reset enable_seqscan;
6363
select
6464
schemaname, relname, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch, n_tup_ins, n_tup_upd,
6565
n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze
66-
from pg_stat_all_tables where relname = 'pg_stat_test';
66+
from gp_stat_all_tables_summary where relname = 'pg_stat_test';
6767
schemaname | relname | seq_scan | seq_tup_read | idx_scan | idx_tup_fetch | n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
6868
------------+--------------+----------+--------------+----------+---------------+-----------+-----------+-----------+---------------+------------+------------+---------------------
6969
public | pg_stat_test | 15 | 391 | 1 | 0 | 110 | 0 | 19 | 0 | 91 | 19 | 129
@@ -72,23 +72,23 @@ from pg_stat_all_tables where relname = 'pg_stat_test';
7272
select
7373
schemaname, relname, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch, n_tup_ins, n_tup_upd,
7474
n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze
75-
from pg_stat_user_tables where relname = 'pg_stat_test';
75+
from gp_stat_user_tables_summary where relname = 'pg_stat_test';
7676
schemaname | relname | seq_scan | seq_tup_read | idx_scan | idx_tup_fetch | n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
7777
------------+--------------+----------+--------------+----------+---------------+-----------+-----------+-----------+---------------+------------+------------+---------------------
7878
public | pg_stat_test | 15 | 391 | 1 | 0 | 110 | 0 | 19 | 0 | 91 | 19 | 129
7979
(1 row)
8080

8181
select
8282
schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
83-
from pg_stat_all_indexes where relname = 'pg_stat_test';
83+
from gp_stat_all_indexes_summary where relname = 'pg_stat_test';
8484
schemaname | relname | indexrelname | idx_scan | idx_tup_read | idx_tup_fetch
8585
------------+--------------+--------------------------+----------+--------------+---------------
8686
public | pg_stat_test | pg_stat_user_table_index | 1 | 1 | 0
8787
(1 row)
8888

8989
select
9090
schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
91-
from pg_stat_user_indexes where relname = 'pg_stat_test';
91+
from gp_stat_user_indexes_summary where relname = 'pg_stat_test';
9292
schemaname | relname | indexrelname | idx_scan | idx_tup_read | idx_tup_fetch
9393
------------+--------------+--------------------------+----------+--------------+---------------
9494
public | pg_stat_test | pg_stat_user_table_index | 1 | 1 | 0

contrib/pax_storage/src/test/regress/expected/stats.out

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ SELECT t.seq_scan, t.seq_tup_read, t.idx_scan, t.idx_tup_fetch,
2222
(b.heap_blks_read + b.heap_blks_hit) AS heap_blks,
2323
(b.idx_blks_read + b.idx_blks_hit) AS idx_blks,
2424
pg_stat_get_snapshot_timestamp() as snap_ts
25-
FROM pg_catalog.pg_stat_user_tables AS t,
25+
FROM pg_catalog.gp_stat_user_tables_summary AS t,
2626
pg_catalog.pg_statio_user_tables AS b
2727
WHERE t.relname='tenk2' AND b.relname='tenk2';
2828
-- function to wait for counters to advance
@@ -45,17 +45,17 @@ begin
4545

4646
-- check to see if seqscan has been sensed
4747
SELECT (st.seq_scan >= pr.seq_scan + 1) INTO updated1
48-
FROM pg_stat_user_tables AS st, pg_class AS cl, prevstats AS pr
48+
FROM gp_stat_user_tables_summary AS st, pg_class AS cl, prevstats AS pr
4949
WHERE st.relname='tenk2' AND cl.relname='tenk2';
5050

5151
-- check to see if indexscan has been sensed
5252
SELECT (st.idx_scan >= pr.idx_scan + 1) INTO updated2
53-
FROM pg_stat_user_tables AS st, pg_class AS cl, prevstats AS pr
53+
FROM gp_stat_user_tables_summary AS st, pg_class AS cl, prevstats AS pr
5454
WHERE st.relname='tenk2' AND cl.relname='tenk2';
5555

5656
-- check to see if all updates have been sensed
5757
SELECT (n_tup_ins > 0) INTO updated3
58-
FROM pg_stat_user_tables WHERE relname='trunc_stats_test4';
58+
FROM gp_stat_user_tables_summary WHERE relname='trunc_stats_test4';
5959

6060
-- We must also check explicitly that pg_stat_get_snapshot_timestamp has
6161
-- advanced, because that comes from the global stats file which might
@@ -65,7 +65,7 @@ begin
6565

6666
-- check to see if idx_tup_fetch has been sensed
6767
SELECT (st.idx_tup_fetch >= pr.idx_tup_fetch + 1) INTO updated5
68-
FROM pg_stat_user_tables AS st, pg_class AS cl, prevstats AS pr
68+
FROM gp_stat_user_tables_summary AS st, pg_class AS cl, prevstats AS pr
6969
WHERE st.relname='tenk2' AND cl.relname='tenk2';
7070

7171
exit when updated1 and updated2 and updated3 and updated4 and updated5;
@@ -177,7 +177,7 @@ SELECT wait_for_stats();
177177

178178
-- check effects
179179
SELECT relname, n_tup_ins, n_tup_upd, n_tup_del, n_live_tup, n_dead_tup
180-
FROM pg_stat_user_tables
180+
FROM gp_stat_user_tables_summary
181181
WHERE relname like 'trunc_stats_test%' order by relname;
182182
relname | n_tup_ins | n_tup_upd | n_tup_del | n_live_tup | n_dead_tup
183183
-------------------+-----------+-----------+-----------+------------+------------
@@ -192,7 +192,7 @@ SELECT st.seq_scan >= pr.seq_scan + 1,
192192
st.seq_tup_read >= pr.seq_tup_read + cl.reltuples,
193193
st.idx_scan >= pr.idx_scan + 1,
194194
st.idx_tup_fetch >= pr.idx_tup_fetch + 1
195-
FROM pg_stat_user_tables AS st, pg_class AS cl, prevstats AS pr
195+
FROM gp_stat_user_tables_summary AS st, pg_class AS cl, prevstats AS pr
196196
WHERE st.relname='tenk2' AND cl.relname='tenk2';
197197
?column? | ?column? | ?column? | ?column?
198198
----------+----------+----------+----------

0 commit comments

Comments
 (0)