You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by ch...@apache.org on 2026/02/04 02:26:59 UTC
(cloudberry) 04/05: Fix: Adapt system view after cherry-pick
This is an automated email from the ASF dual-hosted git repository.
chenjinbao1989 pushed a commit to branch cbdb-postgres-merge
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 768c1a31dcb602b7965e89d05a6e11dbc80b5029
Author: liushengsong <li...@hashdata.cn>
AuthorDate: Wed Sep 3 11:33:49 2025 +0800
Fix: Adapt system view after cherry-pick
---
.../expected/auto_explain_optimizer.out | 2 +-
.../isolation2/input/autovacuum-analyze.source | 12 +-
.../isolation2/output/autovacuum-analyze.source | 12 +-
.../src/test/regress/expected/pg_stat.out | 16 +-
.../src/test/regress/expected/stats.out | 14 +-
.../test/regress/input/pgstat_qd_tabstat.source | 80 ++---
.../test/regress/output/pgstat_qd_tabstat.source | 84 +++---
.../pax_storage/src/test/regress/sql/pg_stat.sql | 16 +-
contrib/pax_storage/src/test/regress/sql/stats.sql | 14 +-
src/backend/catalog/system_views.sql | 37 +--
src/backend/catalog/system_views_gp_summary.sql | 1 +
src/test/isolation2/expected/analyze_progress.out | 1 -
.../expected/ao_index_build_progress.out | 4 +-
.../isolation2/expected/vacuum_progress_column.out | 83 ++----
.../isolation2/expected/vacuum_progress_row.out | 327 ++++++++++++++-------
.../isolation2/input/autovacuum-analyze.source | 12 +-
.../isolation2/output/autovacuum-analyze.source | 12 +-
.../output/parallel_retrieve_cursor/explain.source | 19 +-
src/test/isolation2/sql/setup.sql | 21 --
src/test/isolation2/sql/vacuum_progress_column.sql | 21 +-
src/test/isolation2/sql/vacuum_progress_row.sql | 82 +++++-
src/test/regress/expected/pgstat_qd_tabstat.out | 8 +-
src/test/regress/expected/stats.out | 6 +-
src/test/regress/sql/pgstat_qd_tabstat.sql | 4 +-
src/test/regress/sql/stats.sql | 6 +-
25 files changed, 503 insertions(+), 391 deletions(-)
diff --git a/contrib/auto_explain/expected/auto_explain_optimizer.out b/contrib/auto_explain/expected/auto_explain_optimizer.out
index e1d3e334d95..1f469cc45fc 100644
--- a/contrib/auto_explain/expected/auto_explain_optimizer.out
+++ b/contrib/auto_explain/expected/auto_explain_optimizer.out
@@ -38,7 +38,7 @@ LOG: duration: 0.026 ms plan:
Query Text: SELECT relname FROM pg_class WHERE relname='pg_class';
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)
Index Cond: (relname = 'pg_class'::name)
- Heap Fetches: 1
+ Heap Fetches: 0
(slice0) Executor memory: 105K bytes.
Memory used: 128000kB
relname
diff --git a/contrib/pax_storage/src/test/isolation2/input/autovacuum-analyze.source b/contrib/pax_storage/src/test/isolation2/input/autovacuum-analyze.source
index 32e79cdd491..19187b107c2 100644
--- a/contrib/pax_storage/src/test/isolation2/input/autovacuum-analyze.source
+++ b/contrib/pax_storage/src/test/isolation2/input/autovacuum-analyze.source
@@ -178,7 +178,7 @@ SELECT count(*) FROM pg_statistic where starelid = 'autostatstbl'::regclass;
select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
-- expect analyze_count = 1, autoanalyze_count = 0, and n_mod_since_analyze = 1000 since ANALYZE executed
-- in same transaction for the insert statement.
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
-- Wait until autovacuum is triggered
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);
-- we can see the auto-ANALYZE finished
select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
-- expect analyze_count = 1, autoanalyze_count = 1, and n_mod_since_analyze = 0
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
-- Case 2 --
-- 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', '', '
select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
-- expect analyze_count = 2, autoanalyze_count = 1, and n_mod_since_analyze = 1000 since ANALYZE executed
-- in same transaction for the insert statement.
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
-- Wait until autovacuum is triggered
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);
-- we can see the auto-ANALYZE finished, check statistic and analyze count
select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
-- expect analyze_count = 2, autoanalyze_count = 2, and n_mod_since_analyze = 0
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
-- Case 3 --
@@ -244,7 +244,7 @@ SELECT gp_inject_fault('auto_vac_worker_after_report_activity', 'suspend', '', '
select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
-- expect analyze_count = 2, autoanalyze_count = 2, and n_mod_since_analyze = 1000 since ANALYZE executed
-- in same transaction for the insert statement.
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
-- Wait until autovacuum is triggered
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);
-- we can see the auto-ANALYZE finished, check statistic and analyze count
select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
-- expect analyze_count = 2, autoanalyze_count = 3, and n_mod_since_analyze = 0 since ANALYZE executed
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
-- Reset GUCs.
ALTER SYSTEM RESET autovacuum_naptime;
diff --git a/contrib/pax_storage/src/test/isolation2/output/autovacuum-analyze.source b/contrib/pax_storage/src/test/isolation2/output/autovacuum-analyze.source
index 0c4b87746e4..dff55111b64 100644
--- a/contrib/pax_storage/src/test/isolation2/output/autovacuum-analyze.source
+++ b/contrib/pax_storage/src/test/isolation2/output/autovacuum-analyze.source
@@ -422,7 +422,7 @@ select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
(1 row)
-- expect analyze_count = 1, autoanalyze_count = 0, and n_mod_since_analyze = 1000 since ANALYZE executed
-- in same transaction for the insert statement.
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
analyze_count | autoanalyze_count | n_mod_since_analyze
---------------+-------------------+---------------------
1 | 0 | 1000
@@ -465,7 +465,7 @@ select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
1 | 1000
(1 row)
-- expect analyze_count = 1, autoanalyze_count = 1, and n_mod_since_analyze = 0
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
analyze_count | autoanalyze_count | n_mod_since_analyze
---------------+-------------------+---------------------
1 | 1 | 0
@@ -502,7 +502,7 @@ select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
(1 row)
-- expect analyze_count = 2, autoanalyze_count = 1, and n_mod_since_analyze = 1000 since ANALYZE executed
-- in same transaction for the insert statement.
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
analyze_count | autoanalyze_count | n_mod_since_analyze
---------------+-------------------+---------------------
2 | 1 | 1000
@@ -545,7 +545,7 @@ select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
1 | 2000
(1 row)
-- expect analyze_count = 2, autoanalyze_count = 2, and n_mod_since_analyze = 0
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
analyze_count | autoanalyze_count | n_mod_since_analyze
---------------+-------------------+---------------------
2 | 2 | 0
@@ -581,7 +581,7 @@ select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
(1 row)
-- expect analyze_count = 2, autoanalyze_count = 2, and n_mod_since_analyze = 1000 since ANALYZE executed
-- in same transaction for the insert statement.
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
analyze_count | autoanalyze_count | n_mod_since_analyze
---------------+-------------------+---------------------
2 | 2 | 1000
@@ -624,7 +624,7 @@ select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
1 | 3000
(1 row)
-- expect analyze_count = 2, autoanalyze_count = 3, and n_mod_since_analyze = 0 since ANALYZE executed
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
analyze_count | autoanalyze_count | n_mod_since_analyze
---------------+-------------------+---------------------
2 | 3 | 0
diff --git a/contrib/pax_storage/src/test/regress/expected/pg_stat.out b/contrib/pax_storage/src/test/regress/expected/pg_stat.out
index 27dc25f957d..761372051ef 100644
--- a/contrib/pax_storage/src/test/regress/expected/pg_stat.out
+++ b/contrib/pax_storage/src/test/regress/expected/pg_stat.out
@@ -5,7 +5,7 @@ create table pg_stat_test(a int);
select
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
-from pg_stat_all_tables where relname = 'pg_stat_test';
+from gp_stat_all_tables_summary where relname = 'pg_stat_test';
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
------------+--------------+----------+--------------+----------+---------------+-----------+-----------+-----------+---------------+------------+------------
public | pg_stat_test | 0 | 0 | | | 0 | 0 | 0 | 0 | 0 | 0
@@ -14,7 +14,7 @@ from pg_stat_all_tables where relname = 'pg_stat_test';
select
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
-from pg_stat_user_tables where relname = 'pg_stat_test';
+from gp_stat_user_tables_summary where relname = 'pg_stat_test';
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
------------+--------------+----------+--------------+----------+---------------+-----------+-----------+-----------+---------------+------------+------------
public | pg_stat_test | 0 | 0 | | | 0 | 0 | 0 | 0 | 0 | 0
@@ -22,14 +22,14 @@ from pg_stat_user_tables where relname = 'pg_stat_test';
select
schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
-from pg_stat_all_indexes where relname = 'pg_stat_test';
+from gp_stat_all_indexes_summary where relname = 'pg_stat_test';
schemaname | relname | indexrelname | idx_scan | idx_tup_read | idx_tup_fetch
------------+---------+--------------+----------+--------------+---------------
(0 rows)
select
schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
-from pg_stat_user_indexes where relname = 'pg_stat_test';
+from gp_stat_user_indexes_summary where relname = 'pg_stat_test';
schemaname | relname | indexrelname | idx_scan | idx_tup_read | idx_tup_fetch
------------+---------+--------------+----------+--------------+---------------
(0 rows)
@@ -63,7 +63,7 @@ reset enable_seqscan;
select
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
-from pg_stat_all_tables where relname = 'pg_stat_test';
+from gp_stat_all_tables_summary where relname = 'pg_stat_test';
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
------------+--------------+----------+--------------+----------+---------------+-----------+-----------+-----------+---------------+------------+------------+---------------------
public | pg_stat_test | 15 | 391 | 1 | 0 | 110 | 0 | 19 | 0 | 91 | 19 | 129
@@ -72,7 +72,7 @@ from pg_stat_all_tables where relname = 'pg_stat_test';
select
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
-from pg_stat_user_tables where relname = 'pg_stat_test';
+from gp_stat_user_tables_summary where relname = 'pg_stat_test';
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
------------+--------------+----------+--------------+----------+---------------+-----------+-----------+-----------+---------------+------------+------------+---------------------
public | pg_stat_test | 15 | 391 | 1 | 0 | 110 | 0 | 19 | 0 | 91 | 19 | 129
@@ -80,7 +80,7 @@ from pg_stat_user_tables where relname = 'pg_stat_test';
select
schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
-from pg_stat_all_indexes where relname = 'pg_stat_test';
+from gp_stat_all_indexes_summary where relname = 'pg_stat_test';
schemaname | relname | indexrelname | idx_scan | idx_tup_read | idx_tup_fetch
------------+--------------+--------------------------+----------+--------------+---------------
public | pg_stat_test | pg_stat_user_table_index | 1 | 1 | 0
@@ -88,7 +88,7 @@ from pg_stat_all_indexes where relname = 'pg_stat_test';
select
schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
-from pg_stat_user_indexes where relname = 'pg_stat_test';
+from gp_stat_user_indexes_summary where relname = 'pg_stat_test';
schemaname | relname | indexrelname | idx_scan | idx_tup_read | idx_tup_fetch
------------+--------------+--------------------------+----------+--------------+---------------
public | pg_stat_test | pg_stat_user_table_index | 1 | 1 | 0
diff --git a/contrib/pax_storage/src/test/regress/expected/stats.out b/contrib/pax_storage/src/test/regress/expected/stats.out
index d3f407656fc..a75f9801a36 100644
--- a/contrib/pax_storage/src/test/regress/expected/stats.out
+++ b/contrib/pax_storage/src/test/regress/expected/stats.out
@@ -22,7 +22,7 @@ SELECT t.seq_scan, t.seq_tup_read, t.idx_scan, t.idx_tup_fetch,
(b.heap_blks_read + b.heap_blks_hit) AS heap_blks,
(b.idx_blks_read + b.idx_blks_hit) AS idx_blks,
pg_stat_get_snapshot_timestamp() as snap_ts
- FROM pg_catalog.pg_stat_user_tables AS t,
+ FROM pg_catalog.gp_stat_user_tables_summary AS t,
pg_catalog.pg_statio_user_tables AS b
WHERE t.relname='tenk2' AND b.relname='tenk2';
-- function to wait for counters to advance
@@ -45,17 +45,17 @@ begin
-- check to see if seqscan has been sensed
SELECT (st.seq_scan >= pr.seq_scan + 1) INTO updated1
- FROM pg_stat_user_tables AS st, pg_class AS cl, prevstats AS pr
+ FROM gp_stat_user_tables_summary AS st, pg_class AS cl, prevstats AS pr
WHERE st.relname='tenk2' AND cl.relname='tenk2';
-- check to see if indexscan has been sensed
SELECT (st.idx_scan >= pr.idx_scan + 1) INTO updated2
- FROM pg_stat_user_tables AS st, pg_class AS cl, prevstats AS pr
+ FROM gp_stat_user_tables_summary AS st, pg_class AS cl, prevstats AS pr
WHERE st.relname='tenk2' AND cl.relname='tenk2';
-- check to see if all updates have been sensed
SELECT (n_tup_ins > 0) INTO updated3
- FROM pg_stat_user_tables WHERE relname='trunc_stats_test4';
+ FROM gp_stat_user_tables_summary WHERE relname='trunc_stats_test4';
-- We must also check explicitly that pg_stat_get_snapshot_timestamp has
-- advanced, because that comes from the global stats file which might
@@ -65,7 +65,7 @@ begin
-- check to see if idx_tup_fetch has been sensed
SELECT (st.idx_tup_fetch >= pr.idx_tup_fetch + 1) INTO updated5
- FROM pg_stat_user_tables AS st, pg_class AS cl, prevstats AS pr
+ FROM gp_stat_user_tables_summary AS st, pg_class AS cl, prevstats AS pr
WHERE st.relname='tenk2' AND cl.relname='tenk2';
exit when updated1 and updated2 and updated3 and updated4 and updated5;
@@ -177,7 +177,7 @@ SELECT wait_for_stats();
-- check effects
SELECT relname, n_tup_ins, n_tup_upd, n_tup_del, n_live_tup, n_dead_tup
- FROM pg_stat_user_tables
+ FROM gp_stat_user_tables_summary
WHERE relname like 'trunc_stats_test%' order by relname;
relname | n_tup_ins | n_tup_upd | n_tup_del | n_live_tup | n_dead_tup
-------------------+-----------+-----------+-----------+------------+------------
@@ -192,7 +192,7 @@ SELECT st.seq_scan >= pr.seq_scan + 1,
st.seq_tup_read >= pr.seq_tup_read + cl.reltuples,
st.idx_scan >= pr.idx_scan + 1,
st.idx_tup_fetch >= pr.idx_tup_fetch + 1
- FROM pg_stat_user_tables AS st, pg_class AS cl, prevstats AS pr
+ FROM gp_stat_user_tables_summary AS st, pg_class AS cl, prevstats AS pr
WHERE st.relname='tenk2' AND cl.relname='tenk2';
?column? | ?column? | ?column? | ?column?
----------+----------+----------+----------
diff --git a/contrib/pax_storage/src/test/regress/input/pgstat_qd_tabstat.source b/contrib/pax_storage/src/test/regress/input/pgstat_qd_tabstat.source
index a3c201de66c..4be0a8c7eb8 100644
--- a/contrib/pax_storage/src/test/regress/input/pgstat_qd_tabstat.source
+++ b/contrib/pax_storage/src/test/regress/input/pgstat_qd_tabstat.source
@@ -10,7 +10,7 @@ copy table_for_docopy (i, j) from stdin;
3 hello3
\.
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_docopy'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_docopy'::regclass;
CREATE TABLE data_tbl (a int,b char) distributed by (a);
INSERT INTO data_tbl values(1,'1');
@@ -21,7 +21,7 @@ COPY data_tbl TO '/tmp/data_tbl<SEGID>.csv' on segment;
create table copy_on_segment (a int,b char);
COPY copy_on_segment from '/tmp/data_tbl<SEGID>.csv' on segment log errors segment reject limit 3 rows;
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'copy_on_segment'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'copy_on_segment'::regclass;
-- Test pgstat table stat in initplan on QD
@@ -34,26 +34,26 @@ copy table_for_initplan (i, j, k) from stdin;
explain (costs off) with updated AS (update table_for_initplan set k = 33 where i = 3 returning k) select table_for_initplan.*, (select sum(k) from updated) from table_for_initplan;
with updated AS (update table_for_initplan set k = 33 where i = 3 returning k) select table_for_initplan.*, (select sum(k) from updated) from table_for_initplan;
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_initplan'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_initplan'::regclass;
-- Test pgstat table stat in CTAS on QD
create table table_for_ctas as select i, 'hello' || i from generate_series(1, 100) f(i);
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_ctas'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_ctas'::regclass;
select i, 'hello' || i into table_for_insert_into from generate_series(1, 100) f(i);
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_insert_into'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_insert_into'::regclass;
-- Test pgstat table stat in ALTER TABLE SET DISTRIBUTED BY on QD
create table table_for_set_distributed_by(i int, j varchar) distributed by (i);
insert into table_for_set_distributed_by select i, 'hello' || i from generate_series(1, 333) f(i);
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_set_distributed_by'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_set_distributed_by'::regclass;
alter table table_for_set_distributed_by set distributed by (j);
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_set_distributed_by'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_set_distributed_by'::regclass;
-- Test pgstat table stat in execution of funciton on QD
@@ -68,7 +68,7 @@ $$
language plpgsql volatile;
select update_table_for_function();
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_function'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_function'::regclass;
-- Test pgstat table stat in ALTER TABLE EXPAND TABLE on QD;
@@ -78,11 +78,11 @@ create table table_for_expand(i int, j varchar) distributed by (i);
insert into table_for_expand select i, 'hello' || i from generate_series(1, 333) f(i);
select count(distinct gp_segment_id) from table_for_expand;
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_expand'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_expand'::regclass;
alter table table_for_expand expand table;
select count(distinct gp_segment_id) from table_for_expand;
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_expand'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_expand'::regclass;
select gp_debug_reset_create_table_default_numsegments();
@@ -103,7 +103,7 @@ update table_for_iud set j = 'heroes never die' where i >= 300;
release savepoint level3;
commit;
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 'table_for_iud'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 'table_for_iud'::regclass;
begin;
savepoint level1;
@@ -120,14 +120,14 @@ rollback to savepoint level3;
delete from table_for_iud where i <= 200;
commit;
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 'table_for_iud'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 'table_for_iud'::regclass;
-- Test pgstat table stat in TRUNCATE on QD
create table table_for_truncate(i int, j varchar) distributed by (i);
insert into table_for_truncate select i, 'hello' || i from generate_series(1, 777) f(i);
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_truncate'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_truncate'::regclass;
begin;
savepoint level1;
savepoint level2;
@@ -141,12 +141,12 @@ delete from table_for_truncate where i >= 700;
update table_for_truncate set j = 'D' where i <= 200;
commit;
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 'table_for_truncate'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 'table_for_truncate'::regclass;
create table table_for_truncate_abort(i int, j varchar) distributed by (i);
insert into table_for_truncate_abort select i, 'hello' || i from generate_series(1, 777) f(i);
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 'table_for_truncate_abort'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 'table_for_truncate_abort'::regclass;
begin;
savepoint level1;
savepoint level2;
@@ -160,7 +160,7 @@ delete from table_for_truncate_abort where i < 700;
update table_for_truncate_abort set j = 'D' where i >= 200;
rollback;
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 'table_for_truncate_abort'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 'table_for_truncate_abort'::regclass;
-- Test pgstat table stat for partition table on QD
@@ -171,17 +171,17 @@ PARTITION BY RANGE (rank)
DEFAULT PARTITION extra );
insert into rankpart select i, i % 10, i from generate_series(1, 1000)i;
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_2'::regclass;
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_3'::regclass;
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_extra'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_extra'::regclass;
begin;
delete from rankpart where id <= 100;
rollback;
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_2'::regclass;
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_3'::regclass;
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_extra'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_extra'::regclass;
copy rankpart (id, rank, product) from stdin;
1001 1 1001
@@ -196,8 +196,8 @@ copy rankpart (id, rank, product) from stdin;
1010 6 1010
\.
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_2'::regclass;
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_3'::regclass;
begin;
update rankpart set rank = 1 where id > 1005;
@@ -209,9 +209,9 @@ release savepoint level2;
rollback to savepoint level1;
commit;
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_2'::regclass;
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_3'::regclass;
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_extra'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_extra'::regclass;
begin;
savepoint level1_1;
@@ -219,9 +219,9 @@ insert into rankpart select i, i % 10, i from generate_series(2001, 3000)i;
insert into rankpart select i, i % 10, i from generate_series(3001, 4000)i;
commit;
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_2'::regclass;
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_3'::regclass;
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_extra'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_extra'::regclass;
-- Test pgstat matview stat with distributed policy.
@@ -229,13 +229,13 @@ create table base_table(i int, j int, z int ) distributed by (i);
insert into base_table select i,i,i from generate_series(1, 100) i;
create materialized view mt as select * from base_table where z>=50;
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'mt'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
insert into base_table select i,i,i from generate_series(1, 100) i;
refresh materialized view mt;
select pg_sleep(0.77) from gp_dist_random('gp_id'); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'mt'::regclass;
--- pg_stat_all_tables collects gpstats across segments
select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
+-- gp_stat_all_tables_summary collects gpstats across segments
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from gp_stat_all_tables_summary where relid = 'mt'::regclass;
drop materialized view mt;
drop table base_table;
@@ -245,13 +245,13 @@ create table base_table(i int, j int, z int ) distributed replicated;
insert into base_table select i,i,i from generate_series(1, 100) i;
create materialized view mt as select * from base_table where z>=50 distributed replicated;
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'mt'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
insert into base_table select i,i,i from generate_series(1, 100) i;
refresh materialized view mt;
select pg_sleep(0.77) from gp_dist_random('gp_id'); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'mt'::regclass;
--- pg_stat_all_tables collects gpstats across segments
select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
+-- gp_stat_all_tables_summary collects gpstats across segments
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from gp_stat_all_tables_summary where relid = 'mt'::regclass;
reset gp_autostats_mode;
@@ -263,15 +263,15 @@ insert into tabstat_ao select 1,1;
delete from tabstat_ao;
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select count(*) from pg_stat_all_tables
+select count(*) from gp_stat_all_tables_summary
where
relid = (select segrelid from pg_appendonly where relid = 'tabstat_ao'::regclass)
OR relid = (select blkdirrelid from pg_appendonly where relid = 'tabstat_ao'::regclass)
OR relid = (select visimaprelid from pg_appendonly where relid = 'tabstat_ao'::regclass);
select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins from pg_stat_all_tables where relid = (select segrelid from pg_appendonly where relid = 'tabstat_ao'::regclass);
-select n_tup_ins from pg_stat_all_tables where relid = (select blkdirrelid from pg_appendonly where relid = 'tabstat_ao'::regclass);
-select n_tup_ins from pg_stat_all_tables where relid = (select visimaprelid from pg_appendonly where relid = 'tabstat_ao'::regclass);
+select n_tup_ins from gp_stat_all_tables_summary where relid = (select segrelid from pg_appendonly where relid = 'tabstat_ao'::regclass);
+select n_tup_ins from gp_stat_all_tables_summary where relid = (select blkdirrelid from pg_appendonly where relid = 'tabstat_ao'::regclass);
+select n_tup_ins from gp_stat_all_tables_summary where relid = (select visimaprelid from pg_appendonly where relid = 'tabstat_ao'::regclass);
drop table tabstat_ao;
diff --git a/contrib/pax_storage/src/test/regress/output/pgstat_qd_tabstat.source b/contrib/pax_storage/src/test/regress/output/pgstat_qd_tabstat.source
index 5118839b171..a0b24ee35dc 100644
--- a/contrib/pax_storage/src/test/regress/output/pgstat_qd_tabstat.source
+++ b/contrib/pax_storage/src/test/regress/output/pgstat_qd_tabstat.source
@@ -10,7 +10,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_docopy'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_docopy'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
3 | 0 | 0 | 0 | 3 | 0 | 3
@@ -32,7 +32,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'copy_on_segment'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'copy_on_segment'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
4 | 0 | 0 | 0 | 4 | 0 | 4
@@ -70,7 +70,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_initplan'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_initplan'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
3 | 1 | 0 | 0 | 3 | 1 | 4
@@ -86,7 +86,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_ctas'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_ctas'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
100 | 0 | 0 | 0 | 100 | 0 | 100
@@ -101,7 +101,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_insert_into'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_insert_into'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
100 | 0 | 0 | 0 | 100 | 0 | 100
@@ -116,7 +116,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_set_distributed_by'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_set_distributed_by'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
333 | 0 | 0 | 0 | 333 | 0 | 333
@@ -129,7 +129,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_set_distributed_by'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_set_distributed_by'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
333 | 0 | 0 | 0 | 333 | 0 | 333
@@ -157,7 +157,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_function'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_function'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
333 | 0 | 200 | 0 | 133 | 200 | 533
@@ -185,7 +185,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_expand'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_expand'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
333 | 0 | 0 | 0 | 333 | 0 | 333
@@ -204,7 +204,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_expand'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_expand'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
333 | 0 | 0 | 0 | 333 | 0 | 333
@@ -238,7 +238,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 'table_for_iud'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 'table_for_iud'::regclass;
n_live_tup | n_dead_tup
------------+------------
333 | 34
@@ -264,7 +264,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 'table_for_iud'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 'table_for_iud'::regclass;
n_live_tup | n_dead_tup
------------+------------
133 | 713
@@ -279,7 +279,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'table_for_truncate'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'table_for_truncate'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
777 | 0 | 0 | 0 | 777 | 0 | 777
@@ -303,7 +303,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 'table_for_truncate'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 'table_for_truncate'::regclass;
n_live_tup | n_dead_tup
------------+------------
699 | 301
@@ -317,7 +317,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 'table_for_truncate_abort'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 'table_for_truncate_abort'::regclass;
n_live_tup | n_dead_tup
------------+------------
777 | 0
@@ -341,7 +341,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_live_tup, n_dead_tup from pg_stat_all_tables_internal where relid = 'table_for_truncate_abort'::regclass;
+select n_live_tup, n_dead_tup from pg_stat_all_tables where relid = 'table_for_truncate_abort'::regclass;
n_live_tup | n_dead_tup
------------+------------
777 | 223
@@ -360,19 +360,19 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_2'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
500 | 0 | 0 | 0 | 500 | 0 | 500
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_3'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
400 | 0 | 0 | 0 | 400 | 0 | 400
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_extra'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_extra'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
100 | 0 | 0 | 0 | 100 | 0 | 100
@@ -387,19 +387,19 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_2'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
500 | 0 | 50 | 0 | 500 | 0 | 500
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_3'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
400 | 0 | 40 | 0 | 400 | 0 | 400
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_extra'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_extra'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
100 | 0 | 10 | 0 | 100 | 0 | 100
@@ -412,13 +412,13 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_2'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
505 | 0 | 50 | 0 | 505 | 0 | 505
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_3'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
405 | 0 | 40 | 0 | 405 | 0 | 405
@@ -439,19 +439,19 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_2'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
510 | 0 | 55 | 0 | 510 | 0 | 510
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_3'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
410 | 0 | 50 | 0 | 400 | 10 | 410
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_extra'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_extra'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
100 | 0 | 10 | 0 | 100 | 0 | 100
@@ -468,19 +468,19 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_2'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_2'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
1510 | 0 | 55 | 0 | 1510 | 0 | 1510
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_3'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_3'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
1210 | 0 | 50 | 0 | 1200 | 10 | 1210
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'rankpart_1_prt_extra'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'rankpart_1_prt_extra'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
300 | 0 | 10 | 0 | 300 | 0 | 300
@@ -498,7 +498,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'mt'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
51 | 0 | 0 | 0 | 51 | 0 | 51
@@ -514,14 +514,14 @@ select pg_sleep(0.77) from gp_dist_random('gp_id'); -- Force pgstat_report_stat(
(3 rows)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'mt'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
153 | 0 | 0 | 0 | 102 | 0 | 153
(1 row)
--- pg_stat_all_tables collects gpstats across segments
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
+-- gp_stat_all_tables_summary collects gpstats across segments
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from gp_stat_all_tables_summary where relid = 'mt'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
153 | 0 | 0 | 0 | 102 | 0 | 153
@@ -539,7 +539,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'mt'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
51 | 0 | 0 | 0 | 51 | 0 | 51
@@ -555,14 +555,14 @@ select pg_sleep(0.77) from gp_dist_random('gp_id'); -- Force pgstat_report_stat(
(3 rows)
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'mt'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
153 | 0 | 0 | 0 | 102 | 0 | 153
(1 row)
--- pg_stat_all_tables collects gpstats across segments
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
+-- gp_stat_all_tables_summary collects gpstats across segments
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from gp_stat_all_tables_summary where relid = 'mt'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
153 | 0 | 0 | 0 | 102 | 0 | 153
@@ -580,7 +580,7 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select count(*) from pg_stat_all_tables
+select count(*) from gp_stat_all_tables_summary
where
relid = (select segrelid from pg_appendonly where relid = 'tabstat_ao'::regclass)
OR relid = (select blkdirrelid from pg_appendonly where relid = 'tabstat_ao'::regclass)
@@ -596,19 +596,19 @@ select pg_sleep(0.77); -- Force pgstat_report_stat() to send tabstat.
(1 row)
-select n_tup_ins from pg_stat_all_tables where relid = (select segrelid from pg_appendonly where relid = 'tabstat_ao'::regclass);
+select n_tup_ins from gp_stat_all_tables_summary where relid = (select segrelid from pg_appendonly where relid = 'tabstat_ao'::regclass);
n_tup_ins
-----------
1
(1 row)
-select n_tup_ins from pg_stat_all_tables where relid = (select blkdirrelid from pg_appendonly where relid = 'tabstat_ao'::regclass);
+select n_tup_ins from gp_stat_all_tables_summary where relid = (select blkdirrelid from pg_appendonly where relid = 'tabstat_ao'::regclass);
n_tup_ins
-----------
1
(1 row)
-select n_tup_ins from pg_stat_all_tables where relid = (select visimaprelid from pg_appendonly where relid = 'tabstat_ao'::regclass);
+select n_tup_ins from gp_stat_all_tables_summary where relid = (select visimaprelid from pg_appendonly where relid = 'tabstat_ao'::regclass);
n_tup_ins
-----------
1
diff --git a/contrib/pax_storage/src/test/regress/sql/pg_stat.sql b/contrib/pax_storage/src/test/regress/sql/pg_stat.sql
index d9fc37850b0..383a9149186 100644
--- a/contrib/pax_storage/src/test/regress/sql/pg_stat.sql
+++ b/contrib/pax_storage/src/test/regress/sql/pg_stat.sql
@@ -6,17 +6,17 @@ create table pg_stat_test(a int);
select
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
-from pg_stat_all_tables where relname = 'pg_stat_test';
+from gp_stat_all_tables_summary where relname = 'pg_stat_test';
select
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
-from pg_stat_user_tables where relname = 'pg_stat_test';
+from gp_stat_user_tables_summary where relname = 'pg_stat_test';
select
schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
-from pg_stat_all_indexes where relname = 'pg_stat_test';
+from gp_stat_all_indexes_summary where relname = 'pg_stat_test';
select
schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
-from pg_stat_user_indexes where relname = 'pg_stat_test';
+from gp_stat_user_indexes_summary where relname = 'pg_stat_test';
begin; -- make analyze same transcation with insert to avoid double the pgstat causes by unorder message read.
insert into pg_stat_test select * from generate_series(1, 100);
@@ -42,17 +42,17 @@ reset enable_seqscan;
select
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
-from pg_stat_all_tables where relname = 'pg_stat_test';
+from gp_stat_all_tables_summary where relname = 'pg_stat_test';
select
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
-from pg_stat_user_tables where relname = 'pg_stat_test';
+from gp_stat_user_tables_summary where relname = 'pg_stat_test';
select
schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
-from pg_stat_all_indexes where relname = 'pg_stat_test';
+from gp_stat_all_indexes_summary where relname = 'pg_stat_test';
select
schemaname, relname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
-from pg_stat_user_indexes where relname = 'pg_stat_test';
+from gp_stat_user_indexes_summary where relname = 'pg_stat_test';
reset optimizer;
reset max_parallel_workers_per_gather;
diff --git a/contrib/pax_storage/src/test/regress/sql/stats.sql b/contrib/pax_storage/src/test/regress/sql/stats.sql
index 36878562f87..94944161be7 100644
--- a/contrib/pax_storage/src/test/regress/sql/stats.sql
+++ b/contrib/pax_storage/src/test/regress/sql/stats.sql
@@ -20,7 +20,7 @@ SELECT t.seq_scan, t.seq_tup_read, t.idx_scan, t.idx_tup_fetch,
(b.heap_blks_read + b.heap_blks_hit) AS heap_blks,
(b.idx_blks_read + b.idx_blks_hit) AS idx_blks,
pg_stat_get_snapshot_timestamp() as snap_ts
- FROM pg_catalog.pg_stat_user_tables AS t,
+ FROM pg_catalog.gp_stat_user_tables_summary AS t,
pg_catalog.pg_statio_user_tables AS b
WHERE t.relname='tenk2' AND b.relname='tenk2';
@@ -44,17 +44,17 @@ begin
-- check to see if seqscan has been sensed
SELECT (st.seq_scan >= pr.seq_scan + 1) INTO updated1
- FROM pg_stat_user_tables AS st, pg_class AS cl, prevstats AS pr
+ FROM gp_stat_user_tables_summary AS st, pg_class AS cl, prevstats AS pr
WHERE st.relname='tenk2' AND cl.relname='tenk2';
-- check to see if indexscan has been sensed
SELECT (st.idx_scan >= pr.idx_scan + 1) INTO updated2
- FROM pg_stat_user_tables AS st, pg_class AS cl, prevstats AS pr
+ FROM gp_stat_user_tables_summary AS st, pg_class AS cl, prevstats AS pr
WHERE st.relname='tenk2' AND cl.relname='tenk2';
-- check to see if all updates have been sensed
SELECT (n_tup_ins > 0) INTO updated3
- FROM pg_stat_user_tables WHERE relname='trunc_stats_test4';
+ FROM gp_stat_user_tables_summary WHERE relname='trunc_stats_test4';
-- We must also check explicitly that pg_stat_get_snapshot_timestamp has
-- advanced, because that comes from the global stats file which might
@@ -64,7 +64,7 @@ begin
-- check to see if idx_tup_fetch has been sensed
SELECT (st.idx_tup_fetch >= pr.idx_tup_fetch + 1) INTO updated5
- FROM pg_stat_user_tables AS st, pg_class AS cl, prevstats AS pr
+ FROM gp_stat_user_tables_summary AS st, pg_class AS cl, prevstats AS pr
WHERE st.relname='tenk2' AND cl.relname='tenk2';
exit when updated1 and updated2 and updated3 and updated4 and updated5;
@@ -167,14 +167,14 @@ SELECT wait_for_stats();
-- check effects
SELECT relname, n_tup_ins, n_tup_upd, n_tup_del, n_live_tup, n_dead_tup
- FROM pg_stat_user_tables
+ FROM gp_stat_user_tables_summary
WHERE relname like 'trunc_stats_test%' order by relname;
SELECT st.seq_scan >= pr.seq_scan + 1,
st.seq_tup_read >= pr.seq_tup_read + cl.reltuples,
st.idx_scan >= pr.idx_scan + 1,
st.idx_tup_fetch >= pr.idx_tup_fetch + 1
- FROM pg_stat_user_tables AS st, pg_class AS cl, prevstats AS pr
+ FROM gp_stat_user_tables_summary AS st, pg_class AS cl, prevstats AS pr
WHERE st.relname='tenk2' AND cl.relname='tenk2';
-- GPDB_13_MERGE_FIXME: Some statistics are handled by stat collector process on each segment but not sent to master.
diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql
index a385d8fca95..d7d5d225f12 100644
--- a/src/backend/catalog/system_views.sql
+++ b/src/backend/catalog/system_views.sql
@@ -432,8 +432,7 @@ CREATE VIEW pg_prepared_xacts AS
LEFT JOIN pg_database D ON P.dbid = D.oid;
CREATE VIEW pg_prepared_statements AS
- SELECT pg_catalog.gp_execution_segment() AS gp_segment_id, *
- FROM pg_prepared_statement() AS P;
+ SELECT * FROM pg_prepared_statement() AS P;
CREATE VIEW pg_seclabels AS
SELECT
@@ -665,8 +664,7 @@ REVOKE EXECUTE ON FUNCTION pg_get_shmem_allocations() FROM PUBLIC;
GRANT EXECUTE ON FUNCTION pg_get_shmem_allocations() TO pg_read_all_stats;
CREATE VIEW pg_backend_memory_contexts AS
- SELECT pg_catalog.gp_execution_segment() AS gp_segment_id, *
- FROM pg_get_backend_memory_contexts();
+ SELECT * FROM pg_get_backend_memory_contexts();
REVOKE ALL ON pg_backend_memory_contexts FROM PUBLIC;
GRANT SELECT ON pg_backend_memory_contexts TO pg_read_all_stats;
@@ -986,15 +984,6 @@ CREATE VIEW pg_stat_replication AS
JOIN pg_stat_get_wal_senders() AS W ON (S.pid = W.pid)
LEFT JOIN pg_authid AS U ON (S.usesysid = U.oid);
--- FIXME: remove it after 0d0fdc75ae5b72d42be549e234a29546efe07ca2
-CREATE VIEW gp_stat_activity AS
- SELECT gp_execution_segment() as gp_segment_id, * FROM gp_dist_random('pg_stat_activity')
- UNION ALL SELECT -1 as gp_segment_id, * from pg_stat_activity;
-
-CREATE VIEW gp_settings AS
- SELECT gp_execution_segment() as gp_segment_id, * FROM gp_dist_random('pg_settings')
- UNION ALL SELECT -1 as gp_segment_id, * from pg_settings;
-
CREATE FUNCTION gp_stat_get_master_replication() RETURNS SETOF RECORD AS
$$
SELECT pg_catalog.gp_execution_segment() AS gp_segment_id, *
@@ -1163,7 +1152,6 @@ CREATE VIEW pg_replication_slots AS
CREATE VIEW pg_stat_replication_slots AS
SELECT
- pg_catalog.gp_execution_segment() AS gp_segment_id,
s.slot_name,
s.spill_txns,
s.spill_count,
@@ -1180,7 +1168,6 @@ CREATE VIEW pg_stat_replication_slots AS
CREATE VIEW pg_stat_database AS
SELECT
- pg_catalog.gp_execution_segment() AS gp_segment_id,
D.oid AS datid,
D.datname AS datname,
CASE
@@ -1219,6 +1206,17 @@ CREATE VIEW pg_stat_database AS
SELECT oid, datname FROM pg_database
) D;
+CREATE VIEW pg_stat_resqueues AS
+ SELECT
+ pg_catalog.gp_execution_segment() AS gp_segment_id,
+ Q.oid AS queueid,
+ Q.rsqname AS queuename,
+ pg_stat_get_queue_num_exec(Q.oid) AS n_queries_exec,
+ pg_stat_get_queue_num_wait(Q.oid) AS n_queries_wait,
+ pg_stat_get_queue_elapsed_exec(Q.oid) AS elapsed_exec,
+ pg_stat_get_queue_elapsed_wait(Q.oid) AS elapsed_wait
+ FROM pg_resqueue AS Q;
+
-- Resource queue views
CREATE VIEW pg_resqueue_status AS
@@ -1529,9 +1527,8 @@ FROM pg_stat_get_io() b;
CREATE VIEW pg_stat_wal AS
SELECT
- pg_catalog.gp_execution_segment() AS gp_segment_id,
w.wal_records,
- w.wal_fpi,
+ w.wal_fpi as wal_fpw,
w.wal_bytes,
w.wal_buffers_full,
w.wal_write,
@@ -1543,7 +1540,6 @@ CREATE VIEW pg_stat_wal AS
CREATE VIEW pg_stat_progress_analyze AS
SELECT
- pg_catalog.gp_execution_segment() AS gp_segment_id,
S.pid AS pid, S.datid AS datid, D.datname AS datname,
CAST(S.relid AS oid) AS relid,
CASE S.param1 WHEN 0 THEN 'initializing'
@@ -1565,7 +1561,6 @@ CREATE VIEW pg_stat_progress_analyze AS
CREATE VIEW pg_stat_progress_vacuum AS
SELECT
- pg_catalog.gp_execution_segment() AS gp_segment_id,
S.pid AS pid, S.datid AS datid, D.datname AS datname,
S.relid AS relid,
CASE S.param1 WHEN 0 THEN 'initializing'
@@ -1587,7 +1582,6 @@ CREATE VIEW pg_stat_progress_vacuum AS
CREATE VIEW pg_stat_progress_cluster AS
SELECT
- pg_catalog.gp_execution_segment() AS gp_segment_id,
S.pid AS pid,
S.datid AS datid,
D.datname AS datname,
@@ -1615,7 +1609,6 @@ CREATE VIEW pg_stat_progress_cluster AS
CREATE VIEW pg_stat_progress_create_index AS
SELECT
- pg_catalog.gp_execution_segment() AS gp_segment_id,
S.pid AS pid, S.datid AS datid, D.datname AS datname,
S.relid AS relid,
CAST(S.param7 AS oid) AS index_relid,
@@ -1651,7 +1644,6 @@ CREATE VIEW pg_stat_progress_create_index AS
CREATE VIEW pg_stat_progress_basebackup AS
SELECT
- pg_catalog.gp_execution_segment() AS gp_segment_id,
S.pid AS pid,
CASE S.param1 WHEN 0 THEN 'initializing'
WHEN 1 THEN 'waiting for checkpoint to finish'
@@ -1669,7 +1661,6 @@ CREATE VIEW pg_stat_progress_basebackup AS
CREATE VIEW pg_stat_progress_copy AS
SELECT
- pg_catalog.gp_execution_segment() AS gp_segment_id,
S.pid AS pid, S.datid AS datid, D.datname AS datname,
S.relid AS relid,
CASE S.param5 WHEN 1 THEN 'COPY FROM'
diff --git a/src/backend/catalog/system_views_gp_summary.sql b/src/backend/catalog/system_views_gp_summary.sql
index f83329203ab..6f42f7d4d80 100644
--- a/src/backend/catalog/system_views_gp_summary.sql
+++ b/src/backend/catalog/system_views_gp_summary.sql
@@ -135,6 +135,7 @@ FROM
case when d.policytype = 'r' then (sum(n_live_tup)/d.numsegments)::bigint else sum(n_live_tup) end n_live_tup,
case when d.policytype = 'r' then (sum(n_dead_tup)/d.numsegments)::bigint else sum(n_dead_tup) end n_dead_tup,
case when d.policytype = 'r' then (sum(n_mod_since_analyze)/d.numsegments)::bigint else sum(n_mod_since_analyze) end n_mod_since_analyze,
+ case when d.policytype = 'r' then (sum(n_ins_since_vacuum)/d.numsegments)::bigint else sum(n_ins_since_vacuum) end n_ins_since_vacuum,
max(last_vacuum) as last_vacuum,
max(last_autovacuum) as last_autovacuum,
max(last_analyze) as last_analyze,
diff --git a/src/test/isolation2/expected/analyze_progress.out b/src/test/isolation2/expected/analyze_progress.out
index 97c02fbe617..68faf24a5e8 100644
--- a/src/test/isolation2/expected/analyze_progress.out
+++ b/src/test/isolation2/expected/analyze_progress.out
@@ -92,4 +92,3 @@ ANALYZE
-- teardown
DROP TABLE t_analyze_repl;
DROP
-
diff --git a/src/test/isolation2/expected/ao_index_build_progress.out b/src/test/isolation2/expected/ao_index_build_progress.out
index 2cc97d09031..fd91bedfe58 100644
--- a/src/test/isolation2/expected/ao_index_build_progress.out
+++ b/src/test/isolation2/expected/ao_index_build_progress.out
@@ -142,7 +142,7 @@ SELECT gp_wait_until_triggered_fault('AppendOnlyStorageRead_ReadNextBlock_succes
-- By now, we should have reported some blocks (of size 'block_size') as "done",
-- as well as a total number of blocks that matches the size of col j's segfile.
-- Note: since we already had a block directory prior to the index build on
--- column 'j', only column 'j' will be scanned.
+-- column 'j', only column 'j' will be scanned. CBDB_CHERRY_PICK_MERGE_FIXME: fix when ao blkdir will be supported
1U: SELECT command, phase, ((pg_stat_file(pg_relation_filepath('aoco_index_build_progress') || '.' || 129)).size + (current_setting('block_size')::int - 1)) / current_setting('block_size')::int AS col_j_blocks, blocks_total AS blocks_total_reported, blocks_done AS blocks_done_reported FROM gp_stat_progress_create_index WHERE gp_segment_id = 1 AND relid = 'aoco_index_build_progress'::regclass;
command | phase | col_j_blocks | blocks_total_reported | blocks_done_reported
--------------+--------------------------------+--------------+-----------------------+----------------------
@@ -152,7 +152,7 @@ SELECT gp_wait_until_triggered_fault('AppendOnlyStorageRead_ReadNextBlock_succes
SELECT command, phase, blocks_total, blocks_done FROM gp_stat_progress_create_index_summary WHERE relid = 'aoco_index_build_progress'::regclass;
command | phase | blocks_total | blocks_done
--------------+--------------------------------+--------------+-------------
- CREATE INDEX | building index: scanning table | 24 | 9
+ CREATE INDEX | building index: scanning table | 60 | 12
(1 row)
SELECT gp_inject_fault('AppendOnlyStorageRead_ReadNextBlock_success', 'reset', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
diff --git a/src/test/isolation2/expected/vacuum_progress_column.out b/src/test/isolation2/expected/vacuum_progress_column.out
index 587bd35f7c8..2889f8a9256 100644
--- a/src/test/isolation2/expected/vacuum_progress_column.out
+++ b/src/test/isolation2/expected/vacuum_progress_column.out
@@ -45,18 +45,6 @@ ABORT
DELETE FROM vacuum_progress_ao_column where j % 2 = 0;
DELETE 50000
--- Lookup pg_class and collected stats view before VACUUM
-SELECT relpages, reltuples, relallvisible FROM pg_class where relname = 'vacuum_progress_ao_column';
- relpages | reltuples | relallvisible
-----------+-----------+---------------
- 0 | -1 | 0
-(1 row)
-SELECT n_live_tup, n_dead_tup, last_vacuum, vacuum_count FROM pg_stat_all_tables WHERE relname = 'vacuum_progress_ao_column';
- n_live_tup | n_dead_tup | last_vacuum | vacuum_count
-------------+------------+-------------+--------------
- 100000 | 200000 | | 0
-(1 row)
-
-- Perform VACUUM and observe the progress
-- Suspend execution at pre-cleanup phase after truncating both segfiles to their logical EOF.
@@ -168,7 +156,7 @@ SELECT relpages, reltuples, relallvisible FROM pg_class where relname = 'vacuum_
----------+-----------+---------------
37 | 50000 | 0
(1 row)
-SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuum_count FROM pg_stat_all_tables WHERE relname = 'vacuum_progress_ao_column';
+SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuum_count FROM gp_stat_all_tables WHERE relname = 'vacuum_progress_ao_column' and gp_segment_id = 1;
n_live_tup | n_dead_tup | has_last_vacuum | vacuum_count
------------+------------+-----------------+--------------
50000 | 0 | t | 1
@@ -248,7 +236,7 @@ SELECT relpages, reltuples, relallvisible FROM pg_class where relname = 'vacuum_
----------+-----------+---------------
13 | 50000 | 0
(1 row)
-SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuum_count FROM pg_stat_all_tables WHERE relname = 'vacuum_progress_ao_column';
+SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuum_count FROM gp_stat_all_tables WHERE relname = 'vacuum_progress_ao_column' and gp_segment_id = 1;
n_live_tup | n_dead_tup | has_last_vacuum | vacuum_count
------------+------------+-----------------+--------------
50000 | 0 | t | 2
@@ -259,19 +247,6 @@ SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuu
-- Current behavior is it will clear previous compact phase num_dead_tuples in post-cleanup
-- phase (at injecting point vacuum_ao_post_cleanup_end), which is different from above case
-- in which vacuum worker isn't changed.
-ALTER SYSTEM SET gp_fts_mark_mirror_down_grace_period to 10;
-ALTER
-ALTER SYSTEM SET gp_fts_probe_interval to 10;
-ALTER
-SELECT gp_segment_id, pg_reload_conf() FROM gp_id UNION SELECT gp_segment_id, pg_reload_conf() FROM gp_dist_random('gp_id');
- gp_segment_id | pg_reload_conf
----------------+----------------
- 2 | t
- 1 | t
- 0 | t
- -1 | t
-(4 rows)
-
DROP TABLE IF EXISTS vacuum_progress_ao_column;
DROP
CREATE TABLE vacuum_progress_ao_column(i int, j int);
@@ -315,7 +290,7 @@ DELETE 50000
SET
1&: vacuum vacuum_progress_ao_column; <waiting ...>
-2: SELECT gp_wait_until_triggered_fault('vacuum_ao_after_compact', 3, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+2: SELECT gp_wait_until_triggered_fault('vacuum_ao_after_compact', 1, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
gp_wait_until_triggered_fault
-------------------------------
Success:
@@ -325,13 +300,17 @@ SET
-- Non-zero progressing data num_dead_tuples is showed up.
select gp_segment_id, relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum where gp_segment_id > -1;
-ERROR: relation "gp_stat_progress_vacuum" does not exist
-LINE 1: ...cuum_count, max_dead_tuples, num_dead_tuples from gp_stat_pr...
- ^
+ gp_segment_id | relname | phase | heap_blks_total | heap_blks_scanned | heap_blks_vacuumed | index_vacuum_count | max_dead_tuples | num_dead_tuples
+---------------+---------------------------+--------------------------+-----------------+-------------------+--------------------+--------------------+-----------------+-----------------
+ 1 | vacuum_progress_ao_column | append-optimized compact | 25 | 9 | 17 | 0 | 33327 | 16621
+ 0 | vacuum_progress_ao_column | append-optimized compact | 25 | 9 | 17 | 0 | 33462 | 16726
+ 2 | vacuum_progress_ao_column | append-optimized compact | 25 | 9 | 17 | 0 | 33211 | 16653
+(3 rows)
select relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum_summary;
-ERROR: relation "gp_stat_progress_vacuum_summary" does not exist
-LINE 1: ...cuum_count, max_dead_tuples, num_dead_tuples from gp_stat_pr...
- ^
+ relname | phase | heap_blks_total | heap_blks_scanned | heap_blks_vacuumed | index_vacuum_count | max_dead_tuples | num_dead_tuples
+---------------------------+--------------------------+-----------------+-------------------+--------------------+--------------------+-----------------+-----------------
+ vacuum_progress_ao_column | append-optimized compact | 75 | 27 | 51 | 0 | 100000 | 50000
+(1 row)
-- Resume execution of compact phase and block at syncrep on one segment.
2: SELECT gp_inject_fault_infinite('wal_sender_loop', 'suspend', dbid) FROM gp_segment_configuration WHERE role = 'p' and content = 1;
@@ -372,7 +351,7 @@ LINE 1: ...cuum_count, max_dead_tuples, num_dead_tuples from gp_stat_pr...
-- initializes a new vacrelstats at the beginning of post-cleanup phase.
-- Also all segments should reach to the same "vacuum_worker_changed" point
-- due to FTS version being changed.
-2: SELECT gp_wait_until_triggered_fault('vacuum_worker_changed', 3, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+2: SELECT gp_wait_until_triggered_fault('vacuum_worker_changed', 1, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
gp_wait_until_triggered_fault
-------------------------------
Success:
@@ -383,10 +362,10 @@ LINE 1: ...cuum_count, max_dead_tuples, num_dead_tuples from gp_stat_pr...
2: SELECT content, role, preferred_role, mode, status FROM gp_segment_configuration WHERE content > -1;
content | role | preferred_role | mode | status
---------+------+----------------+------+--------
- 0 | p | p | s | u
- 0 | m | m | s | u
2 | p | p | s | u
2 | m | m | s | u
+ 0 | p | p | s | u
+ 0 | m | m | s | u
1 | p | p | n | u
1 | m | m | n | d
(6 rows)
@@ -406,7 +385,7 @@ LINE 1: ...cuum_count, max_dead_tuples, num_dead_tuples from gp_stat_pr...
Success:
Success:
(3 rows)
-2: SELECT gp_wait_until_triggered_fault('vacuum_ao_post_cleanup_end', 3, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+2: SELECT gp_wait_until_triggered_fault('vacuum_ao_post_cleanup_end', 1, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
gp_wait_until_triggered_fault
-------------------------------
Success:
@@ -416,13 +395,17 @@ LINE 1: ...cuum_count, max_dead_tuples, num_dead_tuples from gp_stat_pr...
-- The previous collected num_dead_tuples in compact phase is zero.
select gp_segment_id, relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum where gp_segment_id > -1;
-ERROR: relation "gp_stat_progress_vacuum" does not exist
-LINE 1: ...cuum_count, max_dead_tuples, num_dead_tuples from gp_stat_pr...
- ^
+ gp_segment_id | relname | phase | heap_blks_total | heap_blks_scanned | heap_blks_vacuumed | index_vacuum_count | max_dead_tuples | num_dead_tuples
+---------------+---------------------------+-------------------------------+-----------------+-------------------+--------------------+--------------------+-----------------+-----------------
+ 2 | vacuum_progress_ao_column | append-optimized post-cleanup | 0 | 0 | 0 | 0 | 0 | 0
+ 0 | vacuum_progress_ao_column | append-optimized post-cleanup | 0 | 0 | 0 | 0 | 0 | 0
+ 1 | vacuum_progress_ao_column | append-optimized post-cleanup | 0 | 0 | 0 | 0 | 0 | 0
+(3 rows)
select relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum_summary;
-ERROR: relation "gp_stat_progress_vacuum_summary" does not exist
-LINE 1: ...cuum_count, max_dead_tuples, num_dead_tuples from gp_stat_pr...
- ^
+ relname | phase | heap_blks_total | heap_blks_scanned | heap_blks_vacuumed | index_vacuum_count | max_dead_tuples | num_dead_tuples
+---------------------------+-------------------------------+-----------------+-------------------+--------------------+--------------------+-----------------+-----------------
+ vacuum_progress_ao_column | append-optimized post-cleanup | 0 | 0 | 0 | 0 | 0 | 0
+(1 row)
2: SELECT gp_inject_fault('vacuum_ao_post_cleanup_end', 'reset', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
gp_inject_fault
@@ -469,15 +452,3 @@ reset Debug_appendonly_print_compaction;
RESET
reset default_table_access_method;
RESET
-ALTER SYSTEM RESET gp_fts_mark_mirror_down_grace_period;
-ALTER
-ALTER SYSTEM RESET gp_fts_probe_interval;
-ALTER
-SELECT gp_segment_id, pg_reload_conf() FROM gp_id UNION SELECT gp_segment_id, pg_reload_conf() FROM gp_dist_random('gp_id');
- gp_segment_id | pg_reload_conf
----------------+----------------
- 2 | t
- 1 | t
- 0 | t
- -1 | t
-(4 rows)
diff --git a/src/test/isolation2/expected/vacuum_progress_row.out b/src/test/isolation2/expected/vacuum_progress_row.out
index 619b3e41b80..81392c5a9ef 100644
--- a/src/test/isolation2/expected/vacuum_progress_row.out
+++ b/src/test/isolation2/expected/vacuum_progress_row.out
@@ -44,23 +44,6 @@ ABORT
DELETE FROM vacuum_progress_ao_row where j % 2 = 0;
DELETE 50000
--- Lookup pg_class and collected stats view before VACUUM
-SELECT relpages, reltuples, relallvisible FROM pg_class where relname = 'vacuum_progress_ao_row';
- relpages | reltuples | relallvisible
-----------+-----------+---------------
- 0 | -1 | 0
-(1 row)
-SELECT n_live_tup, n_dead_tup, last_vacuum, vacuum_count FROM pg_stat_all_tables WHERE relname = 'vacuum_progress_ao_row';
- n_live_tup | n_dead_tup | last_vacuum | vacuum_count
-------------+------------+-------------+--------------
- 33327 | 66654 | | 0
-(1 row)
-SELECT n_live_tup, n_dead_tup, last_vacuum, vacuum_count FROM gp_stat_all_tables_summary WHERE relname = 'vacuum_progress_ao_row';
- n_live_tup | n_dead_tup | last_vacuum | vacuum_count
-------------+------------+-------------+--------------
- 100000 | 200000 | | 0
-(1 row)
-
-- Perform VACUUM and observe the progress
-- Suspend execution at pre-cleanup phase after truncating both segfiles to their logical EOF.
@@ -139,11 +122,13 @@ SELECT gp_inject_fault('appendonly_insert', 'reset', dbid) FROM gp_segment_confi
Success:
Success:
(3 rows)
-SELECT gp_wait_until_triggered_fault('vacuum_ao_after_compact', 1, dbid) FROM gp_segment_configuration WHERE content = 1 AND role = 'p';
+SELECT gp_wait_until_triggered_fault('vacuum_ao_after_compact', 1, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
gp_wait_until_triggered_fault
-------------------------------
Success:
-(1 row)
+ Success:
+ Success:
+(3 rows)
-- After compacting all segfiles we expect 50000 dead tuples
select relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum where gp_segment_id = 1;
relname | phase | heap_blks_total | heap_blks_scanned | heap_blks_vacuumed | index_vacuum_count | max_dead_tuples | num_dead_tuples
@@ -171,11 +156,13 @@ SELECT gp_inject_fault('vacuum_ao_after_compact', 'reset', dbid) FROM gp_segment
Success:
Success:
(3 rows)
-SELECT gp_wait_until_triggered_fault('vacuum_ao_post_cleanup_end', 1, dbid) FROM gp_segment_configuration WHERE content = 1 AND role = 'p';
+SELECT gp_wait_until_triggered_fault('vacuum_ao_post_cleanup_end', 1, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
gp_wait_until_triggered_fault
-------------------------------
Success:
-(1 row)
+ Success:
+ Success:
+(3 rows)
-- We should have skipped recycling the awaiting drop segment because the segment was still visible to the SELECT gp_wait_until_triggered_fault query.
select relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum where gp_segment_id = 1;
relname | phase | heap_blks_total | heap_blks_scanned | heap_blks_vacuumed | index_vacuum_count | max_dead_tuples | num_dead_tuples
@@ -209,7 +196,7 @@ SELECT relpages, reltuples, relallvisible FROM pg_class where relname = 'vacuum_
----------+-----------+---------------
84 | 50000 | 0
(1 row)
-SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuum_count FROM pg_stat_all_tables WHERE relname = 'vacuum_progress_ao_row';
+SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuum_count FROM gp_stat_all_tables WHERE relname = 'vacuum_progress_ao_row' and gp_segment_id = 1;
n_live_tup | n_dead_tup | has_last_vacuum | vacuum_count
------------+------------+-----------------+--------------
16705 | 0 | t | 1
@@ -297,7 +284,7 @@ SELECT relpages, reltuples, relallvisible FROM pg_class where relname = 'vacuum_
----------+-----------+---------------
30 | 50000 | 0
(1 row)
-SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuum_count FROM pg_stat_all_tables WHERE relname = 'vacuum_progress_ao_row';
+SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuum_count FROM gp_stat_all_tables WHERE relname = 'vacuum_progress_ao_row' and gp_segment_id = 1;
n_live_tup | n_dead_tup | has_last_vacuum | vacuum_count
------------+------------+-----------------+--------------
16705 | 0 | t | 2
@@ -308,87 +295,213 @@ SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuu
50000 | 0 | t | 2
(1 row)
--- open if system views gp_stat_progress_vacuum* are enabled
---1q:
----- Test vacuum worker process is changed at post-cleanup phase due to mirror down.
----- Current behavior is it will clear previous compact phase num_dead_tuples in post-cleanup
----- phase (at injecting point vacuum_ao_post_cleanup_end), which is different from above case
----- in which vacuum worker isn't changed.
---ALTER SYSTEM SET gp_fts_mark_mirror_down_grace_period to 10;
---ALTER SYSTEM SET gp_fts_probe_interval to 10;
---SELECT gp_segment_id, pg_reload_conf() FROM gp_id UNION SELECT gp_segment_id, pg_reload_conf() FROM gp_dist_random('gp_id');
---
---DROP TABLE IF EXISTS vacuum_progress_ao_row;
---CREATE TABLE vacuum_progress_ao_row(i int, j int);
---CREATE INDEX on vacuum_progress_ao_row(i);
---CREATE INDEX on vacuum_progress_ao_row(j);
---1: BEGIN;
---2: BEGIN;
---1: INSERT INTO vacuum_progress_ao_row SELECT i, i FROM generate_series(1, 100000) i;
---2: INSERT INTO vacuum_progress_ao_row SELECT i, i FROM generate_series(1, 100000) i;
---2: COMMIT;
---2: BEGIN;
---2: INSERT INTO vacuum_progress_ao_row SELECT i, i FROM generate_series(1, 100000) i;
---2: ABORT;
---2q:
---1: ABORT;
---DELETE FROM vacuum_progress_ao_row where j % 2 = 0;
---
----- Suspend execution at the end of compact phase.
---2: SELECT gp_inject_fault('vacuum_ao_after_compact', 'suspend', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
---
---1: set debug_appendonly_print_compaction to on;
---1&: vacuum vacuum_progress_ao_row;
---
---2: SELECT gp_wait_until_triggered_fault('vacuum_ao_after_compact', 3, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
---
----- Non-zero progressing data num_dead_tuples is showed up.
---select gp_segment_id, relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum where gp_segment_id > -1;
---select relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum_summary;
---
----- Resume execution of compact phase and block at syncrep.
---2: SELECT gp_inject_fault_infinite('wal_sender_loop', 'suspend', dbid) FROM gp_segment_configuration WHERE role = 'p' and content = 1;
---2: SELECT gp_inject_fault('vacuum_ao_after_compact', 'reset', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
----- stop the mirror should turn off syncrep
---2: SELECT pg_ctl(datadir, 'stop', 'immediate') FROM gp_segment_configuration WHERE content=1 AND role = 'm';
---
----- Resume walsender to detect mirror down and suspend at the beginning
----- of post-cleanup taken over by a new vacuum worker.
---2: SELECT gp_inject_fault('vacuum_worker_changed', 'suspend', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
----- resume walsender and let it exit so that mirror stop can be detected
---2: SELECT gp_inject_fault_infinite('wal_sender_loop', 'reset', dbid) FROM gp_segment_configuration WHERE role = 'p' and content = 1;
----- Ensure we enter into the target logic which stops cumulative data but
----- initializes a new vacrelstats at the beginning of post-cleanup phase.
----- Also all segments should reach to the same "vacuum_worker_changed" point
----- due to FTS version being changed.
---2: SELECT gp_wait_until_triggered_fault('vacuum_worker_changed', 1, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
----- now seg1's mirror is marked as down
---2: SELECT content, role, preferred_role, mode, status FROM gp_segment_configuration WHERE content > -1;
---
----- Resume execution and entering post_cleaup phase, suspend at the end of it.
---2: SELECT gp_inject_fault('vacuum_ao_post_cleanup_end', 'suspend', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
---2: SELECT gp_inject_fault('vacuum_worker_changed', 'reset', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
---2: SELECT gp_wait_until_triggered_fault('vacuum_ao_post_cleanup_end', 1, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
---
----- The previous collected num_dead_tuples in compact phase is zero.
---select gp_segment_id, relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum where gp_segment_id > -1;
---select relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum_summary;
---
---2: SELECT gp_inject_fault('vacuum_ao_post_cleanup_end', 'reset', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
---
---1<:
---
----- restore environment
---1: reset debug_appendonly_print_compaction;
---
---2: SELECT pg_ctl_start(datadir, port) FROM gp_segment_configuration WHERE role = 'm' AND content = 1;
---2: SELECT wait_until_all_segments_synchronized();
---
----- Cleanup
---SELECT gp_inject_fault_infinite('all', 'reset', dbid) FROM gp_segment_configuration;
---reset Debug_appendonly_print_compaction;
---reset default_table_access_method;
---ALTER SYSTEM RESET gp_fts_mark_mirror_down_grace_period;
---ALTER SYSTEM RESET gp_fts_probe_interval;
---SELECT gp_segment_id, pg_reload_conf() FROM gp_id UNION SELECT gp_segment_id, pg_reload_conf() FROM gp_dist_random('gp_id');
---
+1q: ... <quitting>
+-- Test vacuum worker process is changed at post-cleanup phase due to mirror down.
+-- Current behavior is it will clear previous compact phase num_dead_tuples in post-cleanup
+-- phase (at injecting point vacuum_ao_post_cleanup_end), which is different from above case
+-- in which vacuum worker isn't changed.
+DROP TABLE IF EXISTS vacuum_progress_ao_row;
+DROP
+CREATE TABLE vacuum_progress_ao_row(i int, j int);
+CREATE
+CREATE INDEX on vacuum_progress_ao_row(i);
+CREATE
+CREATE INDEX on vacuum_progress_ao_row(j);
+CREATE
+1: BEGIN;
+BEGIN
+2: BEGIN;
+BEGIN
+1: INSERT INTO vacuum_progress_ao_row SELECT i, i FROM generate_series(1, 100000) i;
+INSERT 100000
+2: INSERT INTO vacuum_progress_ao_row SELECT i, i FROM generate_series(1, 100000) i;
+INSERT 100000
+2: COMMIT;
+COMMIT
+2: BEGIN;
+BEGIN
+2: INSERT INTO vacuum_progress_ao_row SELECT i, i FROM generate_series(1, 100000) i;
+INSERT 100000
+2: ABORT;
+ABORT
+2q: ... <quitting>
+1: ABORT;
+ABORT
+DELETE FROM vacuum_progress_ao_row where j % 2 = 0;
+DELETE 50000
+
+-- Suspend execution at the end of compact phase.
+2: SELECT gp_inject_fault('vacuum_ao_after_compact', 'suspend', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+ gp_inject_fault
+-----------------
+ Success:
+ Success:
+ Success:
+(3 rows)
+
+1: set debug_appendonly_print_compaction to on;
+SET
+1&: vacuum vacuum_progress_ao_row; <waiting ...>
+
+2: SELECT gp_wait_until_triggered_fault('vacuum_ao_after_compact', 1, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+ gp_wait_until_triggered_fault
+-------------------------------
+ Success:
+ Success:
+ Success:
+(3 rows)
+
+-- Non-zero progressing data num_dead_tuples is showed up.
+select gp_segment_id, relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum where gp_segment_id > -1;
+ gp_segment_id | relname | phase | heap_blks_total | heap_blks_scanned | heap_blks_vacuumed | index_vacuum_count | max_dead_tuples | num_dead_tuples
+---------------+------------------------+--------------------------+-----------------+-------------------+--------------------+--------------------+-----------------+-----------------
+ 1 | vacuum_progress_ao_row | append-optimized compact | 55 | 19 | 37 | 0 | 33327 | 16622
+ 2 | vacuum_progress_ao_row | append-optimized compact | 55 | 19 | 37 | 0 | 33211 | 16653
+ 0 | vacuum_progress_ao_row | append-optimized compact | 56 | 19 | 37 | 0 | 33462 | 16725
+(3 rows)
+select relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum_summary;
+ relname | phase | heap_blks_total | heap_blks_scanned | heap_blks_vacuumed | index_vacuum_count | max_dead_tuples | num_dead_tuples
+------------------------+--------------------------+-----------------+-------------------+--------------------+--------------------+-----------------+-----------------
+ vacuum_progress_ao_row | append-optimized compact | 166 | 57 | 111 | 0 | 100000 | 50000
+(1 row)
+
+-- Resume execution of compact phase and block at syncrep.
+2: SELECT gp_inject_fault_infinite('wal_sender_loop', 'suspend', dbid) FROM gp_segment_configuration WHERE role = 'p' and content = 1;
+ gp_inject_fault_infinite
+--------------------------
+ Success:
+(1 row)
+2: SELECT gp_inject_fault('vacuum_ao_after_compact', 'reset', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+ gp_inject_fault
+-----------------
+ Success:
+ Success:
+ Success:
+(3 rows)
+-- stop the mirror should turn off syncrep
+2: SELECT pg_ctl(datadir, 'stop', 'immediate') FROM gp_segment_configuration WHERE content=1 AND role = 'm';
+ pg_ctl
+--------
+ OK
+(1 row)
+
+-- Resume walsender to detect mirror down and suspend at the beginning
+-- of post-cleanup taken over by a new vacuum worker.
+2: SELECT gp_inject_fault('vacuum_worker_changed', 'suspend', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+ gp_inject_fault
+-----------------
+ Success:
+ Success:
+ Success:
+(3 rows)
+-- resume walsender and let it exit so that mirror stop can be detected
+2: SELECT gp_inject_fault_infinite('wal_sender_loop', 'reset', dbid) FROM gp_segment_configuration WHERE role = 'p' and content = 1;
+ gp_inject_fault_infinite
+--------------------------
+ Success:
+(1 row)
+-- Ensure we enter into the target logic which stops cumulative data but
+-- initializes a new vacrelstats at the beginning of post-cleanup phase.
+-- Also all segments should reach to the same "vacuum_worker_changed" point
+-- due to FTS version being changed.
+2: SELECT gp_wait_until_triggered_fault('vacuum_worker_changed', 1, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+ gp_wait_until_triggered_fault
+-------------------------------
+ Success:
+ Success:
+ Success:
+(3 rows)
+-- now seg1's mirror is marked as down
+2: SELECT content, role, preferred_role, mode, status FROM gp_segment_configuration WHERE content > -1;
+ content | role | preferred_role | mode | status
+---------+------+----------------+------+--------
+ 2 | p | p | s | u
+ 2 | m | m | s | u
+ 0 | p | p | s | u
+ 0 | m | m | s | u
+ 1 | p | p | n | u
+ 1 | m | m | n | d
+(6 rows)
+
+-- Resume execution and entering post_cleaup phase, suspend at the end of it.
+2: SELECT gp_inject_fault('vacuum_ao_post_cleanup_end', 'suspend', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+ gp_inject_fault
+-----------------
+ Success:
+ Success:
+ Success:
+(3 rows)
+2: SELECT gp_inject_fault('vacuum_worker_changed', 'reset', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+ gp_inject_fault
+-----------------
+ Success:
+ Success:
+ Success:
+(3 rows)
+2: SELECT gp_wait_until_triggered_fault('vacuum_ao_post_cleanup_end', 1, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+ gp_wait_until_triggered_fault
+-------------------------------
+ Success:
+ Success:
+ Success:
+(3 rows)
+
+-- The previous collected num_dead_tuples in compact phase is zero.
+select gp_segment_id, relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum where gp_segment_id > -1;
+ gp_segment_id | relname | phase | heap_blks_total | heap_blks_scanned | heap_blks_vacuumed | index_vacuum_count | max_dead_tuples | num_dead_tuples
+---------------+------------------------+-------------------------------+-----------------+-------------------+--------------------+--------------------+-----------------+-----------------
+ 0 | vacuum_progress_ao_row | append-optimized post-cleanup | 0 | 0 | 0 | 0 | 0 | 0
+ 2 | vacuum_progress_ao_row | append-optimized post-cleanup | 0 | 0 | 0 | 0 | 0 | 0
+ 1 | vacuum_progress_ao_row | append-optimized post-cleanup | 0 | 0 | 0 | 0 | 0 | 0
+(3 rows)
+select relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum_summary;
+ relname | phase | heap_blks_total | heap_blks_scanned | heap_blks_vacuumed | index_vacuum_count | max_dead_tuples | num_dead_tuples
+------------------------+-------------------------------+-----------------+-------------------+--------------------+--------------------+-----------------+-----------------
+ vacuum_progress_ao_row | append-optimized post-cleanup | 0 | 0 | 0 | 0 | 0 | 0
+(1 row)
+
+2: SELECT gp_inject_fault('vacuum_ao_post_cleanup_end', 'reset', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+ gp_inject_fault
+-----------------
+ Success:
+ Success:
+ Success:
+(3 rows)
+
+1<: <... completed>
+VACUUM
+
+-- restore environment
+1: reset debug_appendonly_print_compaction;
+RESET
+
+2: SELECT pg_ctl_start(datadir, port) FROM gp_segment_configuration WHERE role = 'm' AND content = 1;
+ pg_ctl_start
+--------------------------------------------------
+ waiting for server to start done
+server started
+
+(1 row)
+2: SELECT wait_until_all_segments_synchronized();
+ wait_until_all_segments_synchronized
+--------------------------------------
+ OK
+(1 row)
+
+-- Cleanup
+SELECT gp_inject_fault_infinite('all', 'reset', dbid) FROM gp_segment_configuration;
+ gp_inject_fault_infinite
+--------------------------
+ Success:
+ Success:
+ Success:
+ Success:
+ Success:
+ Success:
+ Success:
+ Success:
+(8 rows)
+reset Debug_appendonly_print_compaction;
+RESET
+reset default_table_access_method;
+RESET
diff --git a/src/test/isolation2/input/autovacuum-analyze.source b/src/test/isolation2/input/autovacuum-analyze.source
index 32e79cdd491..19187b107c2 100644
--- a/src/test/isolation2/input/autovacuum-analyze.source
+++ b/src/test/isolation2/input/autovacuum-analyze.source
@@ -178,7 +178,7 @@ SELECT count(*) FROM pg_statistic where starelid = 'autostatstbl'::regclass;
select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
-- expect analyze_count = 1, autoanalyze_count = 0, and n_mod_since_analyze = 1000 since ANALYZE executed
-- in same transaction for the insert statement.
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
-- Wait until autovacuum is triggered
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);
-- we can see the auto-ANALYZE finished
select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
-- expect analyze_count = 1, autoanalyze_count = 1, and n_mod_since_analyze = 0
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
-- Case 2 --
-- 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', '', '
select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
-- expect analyze_count = 2, autoanalyze_count = 1, and n_mod_since_analyze = 1000 since ANALYZE executed
-- in same transaction for the insert statement.
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
-- Wait until autovacuum is triggered
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);
-- we can see the auto-ANALYZE finished, check statistic and analyze count
select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
-- expect analyze_count = 2, autoanalyze_count = 2, and n_mod_since_analyze = 0
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
-- Case 3 --
@@ -244,7 +244,7 @@ SELECT gp_inject_fault('auto_vac_worker_after_report_activity', 'suspend', '', '
select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
-- expect analyze_count = 2, autoanalyze_count = 2, and n_mod_since_analyze = 1000 since ANALYZE executed
-- in same transaction for the insert statement.
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
-- Wait until autovacuum is triggered
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);
-- we can see the auto-ANALYZE finished, check statistic and analyze count
select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
-- expect analyze_count = 2, autoanalyze_count = 3, and n_mod_since_analyze = 0 since ANALYZE executed
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
-- Reset GUCs.
ALTER SYSTEM RESET autovacuum_naptime;
diff --git a/src/test/isolation2/output/autovacuum-analyze.source b/src/test/isolation2/output/autovacuum-analyze.source
index e071f9e7007..b8727a10a51 100644
--- a/src/test/isolation2/output/autovacuum-analyze.source
+++ b/src/test/isolation2/output/autovacuum-analyze.source
@@ -422,7 +422,7 @@ select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
(1 row)
-- expect analyze_count = 1, autoanalyze_count = 0, and n_mod_since_analyze = 1000 since ANALYZE executed
-- in same transaction for the insert statement.
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
analyze_count | autoanalyze_count | n_mod_since_analyze
---------------+-------------------+---------------------
1 | 0 | 1000
@@ -465,7 +465,7 @@ select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
3 | 1000
(1 row)
-- expect analyze_count = 1, autoanalyze_count = 1, and n_mod_since_analyze = 0
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
analyze_count | autoanalyze_count | n_mod_since_analyze
---------------+-------------------+---------------------
1 | 1 | 0
@@ -502,7 +502,7 @@ select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
(1 row)
-- expect analyze_count = 2, autoanalyze_count = 1, and n_mod_since_analyze = 1000 since ANALYZE executed
-- in same transaction for the insert statement.
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
analyze_count | autoanalyze_count | n_mod_since_analyze
---------------+-------------------+---------------------
2 | 1 | 1000
@@ -545,7 +545,7 @@ select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
3 | 2000
(1 row)
-- expect analyze_count = 2, autoanalyze_count = 2, and n_mod_since_analyze = 0
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
analyze_count | autoanalyze_count | n_mod_since_analyze
---------------+-------------------+---------------------
2 | 2 | 0
@@ -581,7 +581,7 @@ select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
(1 row)
-- expect analyze_count = 2, autoanalyze_count = 2, and n_mod_since_analyze = 1000 since ANALYZE executed
-- in same transaction for the insert statement.
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
analyze_count | autoanalyze_count | n_mod_since_analyze
---------------+-------------------+---------------------
2 | 2 | 1000
@@ -624,7 +624,7 @@ select relpages, reltuples from pg_class where oid = 'autostatstbl'::regclass;
6 | 3000
(1 row)
-- expect analyze_count = 2, autoanalyze_count = 3, and n_mod_since_analyze = 0 since ANALYZE executed
-select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables_internal where relname = 'autostatstbl';
+select analyze_count, autoanalyze_count, n_mod_since_analyze from pg_stat_all_tables where relname = 'autostatstbl';
analyze_count | autoanalyze_count | n_mod_since_analyze
---------------+-------------------+---------------------
2 | 3 | 0
diff --git a/src/test/isolation2/output/parallel_retrieve_cursor/explain.source b/src/test/isolation2/output/parallel_retrieve_cursor/explain.source
index e26fe7bd9fa..15baecb724f 100644
--- a/src/test/isolation2/output/parallel_retrieve_cursor/explain.source
+++ b/src/test/isolation2/output/parallel_retrieve_cursor/explain.source
@@ -129,14 +129,17 @@ EXPLAIN (VERBOSE, COSTS false) DECLARE c1 PARALLEL RETRIEVE CURSOR FOR SELECT *
Optimizer: Postgres query optimizer
(5 rows)
EXPLAIN (VERBOSE, COSTS false) DECLARE c1 PARALLEL RETRIEVE CURSOR FOR SELECT * FROM pg_class ORDER BY relname;
- QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Index Scan using pg_class_relname_nsp_index on pg_catalog.pg_class
- Output: oid, relname, relnamespace, reltype, reloftype, relowner, relam, relfilenode, reltablespace, relpages, reltuples, relallvisible, reltoastrelid, relhasindex, relisshared, relpersistence, relkind, relnatts, relchecks, relhasrules, relhastriggers, relhassubclass, relrowsecurity, relforcerowsecurity, relispopulated, relreplident, relispartition, relisivm, relisdynamic, relmvrefcount, relrewrite, relfrozenxid, relminmxid, relacl, reloptions, relpartbound
- Settings: enable_incremental_sort = 'on'
- Endpoint: "on coordinator"
- Optimizer: Postgres query optimizer
-(5 rows)
+ QUERY PLAN
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ Sort
+ Output: oid, relname, relnamespace, reltype, reloftype, relowner, relam, relfilenode, reltablespace, relpages, reltuples, relallvisible, reltoastrelid, relhasindex, relisshared, relpersistence, relkind, relnatts, relchecks, relhasrules, relhastriggers, relhassubclass, relrowsecurity, relforcerowsecurity, relispopulated, relreplident, relispartition, relisivm, relisdynamic, relmvrefcount, relrewrite, relfrozenxid, relminmxid, relacl, reloptions, relpartbound
+ Sort Key: pg_class.relname
+ -> Seq Scan on pg_catalog.pg_class
+ Output: oid, relname, relnamespace, reltype, reloftype, relowner, relam, relfilenode, reltablespace, relpages, reltuples, relallvisible, reltoastrelid, relhasindex, relisshared, relpersistence, relkind, relnatts, relchecks, relhasrules, relhastriggers, relhassubclass, relrowsecurity, relforcerowsecurity, relispopulated, relreplident, relispartition, relisivm, relisdynamic, relmvrefcount, relrewrite, relfrozenxid, relminmxid, relacl, reloptions, relpartbound
+ Settings: enable_incremental_sort = 'on'
+ Endpoint: "on coordinator"
+ Optimizer: Postgres query optimizer
+(8 rows)
EXPLAIN (VERBOSE, COSTS false) DECLARE c1 PARALLEL RETRIEVE CURSOR FOR SELECT * FROM pg_class WHERE gp_segment_id=1;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
diff --git a/src/test/isolation2/sql/setup.sql b/src/test/isolation2/sql/setup.sql
index 6241413ba3b..949f22f0002 100644
--- a/src/test/isolation2/sql/setup.sql
+++ b/src/test/isolation2/sql/setup.sql
@@ -461,27 +461,6 @@ begin
end; /* in func */
$$ language plpgsql;
--- Helper function that ensures stats collector receives stat from the latest operation.
-create or replace function wait_until_vacuum_count_change_to(relid oid, stat_val_expected bigint)
- returns text as $$
-declare
- stat_val int; /* in func */
- i int; /* in func */
-begin
- i := 0; /* in func */
- while i < 1200 loop
- select pg_stat_get_vacuum_count(relid) into stat_val; /* in func */
- if stat_val = stat_val_expected then /* in func */
- return 'OK'; /* in func */
- end if; /* in func */
- perform pg_sleep(0.1); /* in func */
- perform pg_stat_clear_snapshot(); /* in func */
- i := i + 1; /* in func */
- end loop; /* in func */
- return 'Fail'; /* in func */
-end; /* in func */
-$$ language plpgsql;
-
-- Helper function to get the number of blocks in a relation.
CREATE OR REPLACE FUNCTION nblocks(rel regclass) RETURNS int AS $$ /* in func */
BEGIN /* in func */
diff --git a/src/test/isolation2/sql/vacuum_progress_column.sql b/src/test/isolation2/sql/vacuum_progress_column.sql
index 648d43303be..cff0d8394ba 100644
--- a/src/test/isolation2/sql/vacuum_progress_column.sql
+++ b/src/test/isolation2/sql/vacuum_progress_column.sql
@@ -30,10 +30,6 @@ CREATE INDEX on vacuum_progress_ao_column(j);
-- Also delete half of the tuples evenly before the EOF of segno 2.
DELETE FROM vacuum_progress_ao_column where j % 2 = 0;
--- Lookup pg_class and collected stats view before VACUUM
-SELECT relpages, reltuples, relallvisible FROM pg_class where relname = 'vacuum_progress_ao_column';
-SELECT n_live_tup, n_dead_tup, last_vacuum, vacuum_count FROM pg_stat_all_tables WHERE relname = 'vacuum_progress_ao_column';
-
-- Perform VACUUM and observe the progress
-- Suspend execution at pre-cleanup phase after truncating both segfiles to their logical EOF.
@@ -71,7 +67,7 @@ SELECT gp_inject_fault('vacuum_ao_post_cleanup_end', 'reset', dbid) FROM gp_segm
-- pg_class and collected stats view should be updated after the 1st VACUUM
1U: SELECT wait_until_dead_tup_change_to('vacuum_progress_ao_column'::regclass::oid, 0);
SELECT relpages, reltuples, relallvisible FROM pg_class where relname = 'vacuum_progress_ao_column';
-SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuum_count FROM pg_stat_all_tables WHERE relname = 'vacuum_progress_ao_column';
+SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuum_count FROM gp_stat_all_tables WHERE relname = 'vacuum_progress_ao_column' and gp_segment_id = 1;
-- Perform VACUUM again to recycle the remaining awaiting drop segment marked by the previous run.
@@ -99,17 +95,13 @@ SELECT gp_inject_fault('appendonly_after_truncate_segment_file', 'reset', dbid)
-- pg_class and collected stats view should be updated after the 2nd VACUUM
1U: SELECT wait_until_dead_tup_change_to('vacuum_progress_ao_column'::regclass::oid, 0);
SELECT relpages, reltuples, relallvisible FROM pg_class where relname = 'vacuum_progress_ao_column';
-SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuum_count FROM pg_stat_all_tables WHERE relname = 'vacuum_progress_ao_column';
+SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuum_count FROM gp_stat_all_tables WHERE relname = 'vacuum_progress_ao_column' and gp_segment_id = 1;
1q:
-- Test vacuum worker process is changed at post-cleanup phase due to mirror down.
-- Current behavior is it will clear previous compact phase num_dead_tuples in post-cleanup
-- phase (at injecting point vacuum_ao_post_cleanup_end), which is different from above case
-- in which vacuum worker isn't changed.
-ALTER SYSTEM SET gp_fts_mark_mirror_down_grace_period to 10;
-ALTER SYSTEM SET gp_fts_probe_interval to 10;
-SELECT gp_segment_id, pg_reload_conf() FROM gp_id UNION SELECT gp_segment_id, pg_reload_conf() FROM gp_dist_random('gp_id');
-
DROP TABLE IF EXISTS vacuum_progress_ao_column;
CREATE TABLE vacuum_progress_ao_column(i int, j int);
CREATE INDEX on vacuum_progress_ao_column(i);
@@ -132,7 +124,7 @@ DELETE FROM vacuum_progress_ao_column where j % 2 = 0;
1: set debug_appendonly_print_compaction to on;
1&: vacuum vacuum_progress_ao_column;
-2: SELECT gp_wait_until_triggered_fault('vacuum_ao_after_compact', 3, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+2: SELECT gp_wait_until_triggered_fault('vacuum_ao_after_compact', 1, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
-- Non-zero progressing data num_dead_tuples is showed up.
select gp_segment_id, relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum where gp_segment_id > -1;
@@ -153,14 +145,14 @@ select relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, he
-- initializes a new vacrelstats at the beginning of post-cleanup phase.
-- Also all segments should reach to the same "vacuum_worker_changed" point
-- due to FTS version being changed.
-2: SELECT gp_wait_until_triggered_fault('vacuum_worker_changed', 3, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+2: SELECT gp_wait_until_triggered_fault('vacuum_worker_changed', 1, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
-- now seg1's mirror is marked as down
2: SELECT content, role, preferred_role, mode, status FROM gp_segment_configuration WHERE content > -1;
-- Resume execution and entering post_cleaup phase, suspend at the end of it.
2: SELECT gp_inject_fault('vacuum_ao_post_cleanup_end', 'suspend', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
2: SELECT gp_inject_fault('vacuum_worker_changed', 'reset', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
-2: SELECT gp_wait_until_triggered_fault('vacuum_ao_post_cleanup_end', 3, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+2: SELECT gp_wait_until_triggered_fault('vacuum_ao_post_cleanup_end', 1, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
-- The previous collected num_dead_tuples in compact phase is zero.
select gp_segment_id, relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum where gp_segment_id > -1;
@@ -180,6 +172,3 @@ select relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, he
SELECT gp_inject_fault_infinite('all', 'reset', dbid) FROM gp_segment_configuration;
reset Debug_appendonly_print_compaction;
reset default_table_access_method;
-ALTER SYSTEM RESET gp_fts_mark_mirror_down_grace_period;
-ALTER SYSTEM RESET gp_fts_probe_interval;
-SELECT gp_segment_id, pg_reload_conf() FROM gp_id UNION SELECT gp_segment_id, pg_reload_conf() FROM gp_dist_random('gp_id');
diff --git a/src/test/isolation2/sql/vacuum_progress_row.sql b/src/test/isolation2/sql/vacuum_progress_row.sql
index 93da2a47bbc..ec4b5a354db 100644
--- a/src/test/isolation2/sql/vacuum_progress_row.sql
+++ b/src/test/isolation2/sql/vacuum_progress_row.sql
@@ -29,11 +29,6 @@ CREATE INDEX on vacuum_progress_ao_row(j);
-- Also delete half of the tuples evenly before the EOF of segno 2.
DELETE FROM vacuum_progress_ao_row where j % 2 = 0;
--- Lookup pg_class and collected stats view before VACUUM
-SELECT relpages, reltuples, relallvisible FROM pg_class where relname = 'vacuum_progress_ao_row';
-SELECT n_live_tup, n_dead_tup, last_vacuum, vacuum_count FROM gp_stat_all_tables WHERE relname = 'vacuum_progress_ao_row' and gp_segment_id = 1;
-SELECT n_live_tup, n_dead_tup, last_vacuum, vacuum_count FROM gp_stat_all_tables_summary WHERE relname = 'vacuum_progress_ao_row';
-
-- Perform VACUUM and observe the progress
-- Suspend execution at pre-cleanup phase after truncating both segfiles to their logical EOF.
@@ -57,7 +52,7 @@ select relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, he
-- Resume execution and suspend again after compacting all segfiles
SELECT gp_inject_fault('vacuum_ao_after_compact', 'suspend', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
SELECT gp_inject_fault('appendonly_insert', 'reset', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
-SELECT gp_wait_until_triggered_fault('vacuum_ao_after_compact', 1, dbid) FROM gp_segment_configuration WHERE content = 1 AND role = 'p';
+SELECT gp_wait_until_triggered_fault('vacuum_ao_after_compact', 1, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
-- After compacting all segfiles we expect 50000 dead tuples
select relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum where gp_segment_id = 1;
select relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum_summary;
@@ -65,7 +60,7 @@ select relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, he
-- Resume execution and entering post_cleaup phase, suspend at the end of it.
SELECT gp_inject_fault('vacuum_ao_post_cleanup_end', 'suspend', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
SELECT gp_inject_fault('vacuum_ao_after_compact', 'reset', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
-SELECT gp_wait_until_triggered_fault('vacuum_ao_post_cleanup_end', 1, dbid) FROM gp_segment_configuration WHERE content = 1 AND role = 'p';
+SELECT gp_wait_until_triggered_fault('vacuum_ao_post_cleanup_end', 1, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
-- We should have skipped recycling the awaiting drop segment because the segment was still visible to the SELECT gp_wait_until_triggered_fault query.
select relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum where gp_segment_id = 1;
select relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum_summary;
@@ -76,7 +71,7 @@ SELECT gp_inject_fault('vacuum_ao_post_cleanup_end', 'reset', dbid) FROM gp_segm
-- pg_class and collected stats view should be updated after the 1st VACUUM
1U: SELECT wait_until_dead_tup_change_to('vacuum_progress_ao_row'::regclass::oid, 0);
SELECT relpages, reltuples, relallvisible FROM pg_class where relname = 'vacuum_progress_ao_row';
-SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuum_count FROM pg_stat_all_tables WHERE relname = 'vacuum_progress_ao_row';
+SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuum_count FROM gp_stat_all_tables WHERE relname = 'vacuum_progress_ao_row' and gp_segment_id = 1;
-- Perform VACUUM again to recycle the remaining awaiting drop segment marked by the previous run.
SELECT gp_inject_fault('vacuum_ao_after_index_delete', 'suspend', dbid) FROM gp_segment_configuration WHERE content = 0 AND role = 'p';
@@ -106,6 +101,77 @@ SELECT relpages, reltuples, relallvisible FROM pg_class where relname = 'vacuum_
SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuum_count FROM gp_stat_all_tables WHERE relname = 'vacuum_progress_ao_row' and gp_segment_id = 1;
SELECT n_live_tup, n_dead_tup, last_vacuum is not null as has_last_vacuum, vacuum_count FROM gp_stat_all_tables_summary WHERE relname = 'vacuum_progress_ao_row';
+1q:
+-- Test vacuum worker process is changed at post-cleanup phase due to mirror down.
+-- Current behavior is it will clear previous compact phase num_dead_tuples in post-cleanup
+-- phase (at injecting point vacuum_ao_post_cleanup_end), which is different from above case
+-- in which vacuum worker isn't changed.
+DROP TABLE IF EXISTS vacuum_progress_ao_row;
+CREATE TABLE vacuum_progress_ao_row(i int, j int);
+CREATE INDEX on vacuum_progress_ao_row(i);
+CREATE INDEX on vacuum_progress_ao_row(j);
+1: BEGIN;
+2: BEGIN;
+1: INSERT INTO vacuum_progress_ao_row SELECT i, i FROM generate_series(1, 100000) i;
+2: INSERT INTO vacuum_progress_ao_row SELECT i, i FROM generate_series(1, 100000) i;
+2: COMMIT;
+2: BEGIN;
+2: INSERT INTO vacuum_progress_ao_row SELECT i, i FROM generate_series(1, 100000) i;
+2: ABORT;
+2q:
+1: ABORT;
+DELETE FROM vacuum_progress_ao_row where j % 2 = 0;
+
+-- Suspend execution at the end of compact phase.
+2: SELECT gp_inject_fault('vacuum_ao_after_compact', 'suspend', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+
+1: set debug_appendonly_print_compaction to on;
+1&: vacuum vacuum_progress_ao_row;
+
+2: SELECT gp_wait_until_triggered_fault('vacuum_ao_after_compact', 1, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+
+-- Non-zero progressing data num_dead_tuples is showed up.
+select gp_segment_id, relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum where gp_segment_id > -1;
+select relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum_summary;
+
+-- Resume execution of compact phase and block at syncrep.
+2: SELECT gp_inject_fault_infinite('wal_sender_loop', 'suspend', dbid) FROM gp_segment_configuration WHERE role = 'p' and content = 1;
+2: SELECT gp_inject_fault('vacuum_ao_after_compact', 'reset', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+-- stop the mirror should turn off syncrep
+2: SELECT pg_ctl(datadir, 'stop', 'immediate') FROM gp_segment_configuration WHERE content=1 AND role = 'm';
+
+-- Resume walsender to detect mirror down and suspend at the beginning
+-- of post-cleanup taken over by a new vacuum worker.
+2: SELECT gp_inject_fault('vacuum_worker_changed', 'suspend', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+-- resume walsender and let it exit so that mirror stop can be detected
+2: SELECT gp_inject_fault_infinite('wal_sender_loop', 'reset', dbid) FROM gp_segment_configuration WHERE role = 'p' and content = 1;
+-- Ensure we enter into the target logic which stops cumulative data but
+-- initializes a new vacrelstats at the beginning of post-cleanup phase.
+-- Also all segments should reach to the same "vacuum_worker_changed" point
+-- due to FTS version being changed.
+2: SELECT gp_wait_until_triggered_fault('vacuum_worker_changed', 1, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+-- now seg1's mirror is marked as down
+2: SELECT content, role, preferred_role, mode, status FROM gp_segment_configuration WHERE content > -1;
+
+-- Resume execution and entering post_cleaup phase, suspend at the end of it.
+2: SELECT gp_inject_fault('vacuum_ao_post_cleanup_end', 'suspend', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+2: SELECT gp_inject_fault('vacuum_worker_changed', 'reset', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+2: SELECT gp_wait_until_triggered_fault('vacuum_ao_post_cleanup_end', 1, dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+
+-- The previous collected num_dead_tuples in compact phase is zero.
+select gp_segment_id, relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum where gp_segment_id > -1;
+select relid::regclass as relname, phase, heap_blks_total, heap_blks_scanned, heap_blks_vacuumed, index_vacuum_count, max_dead_tuples, num_dead_tuples from gp_stat_progress_vacuum_summary;
+
+2: SELECT gp_inject_fault('vacuum_ao_post_cleanup_end', 'reset', dbid) FROM gp_segment_configuration WHERE content > -1 AND role = 'p';
+
+1<:
+
+-- restore environment
+1: reset debug_appendonly_print_compaction;
+
+2: SELECT pg_ctl_start(datadir, port) FROM gp_segment_configuration WHERE role = 'm' AND content = 1;
+2: SELECT wait_until_all_segments_synchronized();
+
-- Cleanup
SELECT gp_inject_fault_infinite('all', 'reset', dbid) FROM gp_segment_configuration;
reset Debug_appendonly_print_compaction;
diff --git a/src/test/regress/expected/pgstat_qd_tabstat.out b/src/test/regress/expected/pgstat_qd_tabstat.out
index ca612e18b9c..6fae20e2777 100644
--- a/src/test/regress/expected/pgstat_qd_tabstat.out
+++ b/src/test/regress/expected/pgstat_qd_tabstat.out
@@ -520,8 +520,8 @@ select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n
153 | 0 | 0 | 0 | 102 | 0 | 153
(1 row)
--- pg_stat_all_tables collects gpstats across segments
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
+-- gp_stat_all_tables_summary collects gpstats across segments
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from gp_stat_all_tables_summary where relid = 'mt'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
153 | 0 | 0 | 0 | 102 | 0 | 153
@@ -561,8 +561,8 @@ select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n
153 | 0 | 0 | 0 | 102 | 0 | 153
(1 row)
--- pg_stat_all_tables collects gpstats across segments
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
+-- gp_stat_all_tables_summary collects gpstats across segments
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from gp_stat_all_tables_summary where relid = 'mt'::regclass;
n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze
-----------+-----------+-----------+---------------+------------+------------+---------------------
153 | 0 | 0 | 0 | 102 | 0 | 153
diff --git a/src/test/regress/expected/stats.out b/src/test/regress/expected/stats.out
index 04ea7de5d16..3f43153f8b5 100644
--- a/src/test/regress/expected/stats.out
+++ b/src/test/regress/expected/stats.out
@@ -28,7 +28,7 @@ SELECT t.seq_scan, t.seq_tup_read, t.idx_scan, t.idx_tup_fetch,
(b.heap_blks_read + b.heap_blks_hit) AS heap_blks,
(b.idx_blks_read + b.idx_blks_hit) AS idx_blks,
pg_stat_get_snapshot_timestamp() as snap_ts
- FROM pg_catalog.pg_stat_user_tables AS t,
+ FROM pg_catalog.gp_stat_user_tables_summary AS t,
pg_catalog.pg_statio_user_tables AS b
WHERE t.relname='tenk2' AND b.relname='tenk2';
COMMIT;
@@ -121,7 +121,7 @@ SELECT pg_stat_force_next_flush();
BEGIN;
SET LOCAL stats_fetch_consistency = snapshot;
SELECT relname, n_tup_ins, n_tup_upd, n_tup_del, n_live_tup, n_dead_tup
- FROM pg_stat_user_tables
+ FROM gp_stat_user_tables_summary
WHERE relname like 'trunc_stats_test%' order by relname;
relname | n_tup_ins | n_tup_upd | n_tup_del | n_live_tup | n_dead_tup
-------------------+-----------+-----------+-----------+------------+------------
@@ -136,7 +136,7 @@ SELECT st.seq_scan >= pr.seq_scan + 1,
st.seq_tup_read >= pr.seq_tup_read + cl.reltuples,
st.idx_scan >= pr.idx_scan + 1,
st.idx_tup_fetch >= pr.idx_tup_fetch + 1
- FROM pg_stat_user_tables AS st, pg_class AS cl, prevstats AS pr
+ FROM gp_stat_user_tables_summary AS st, pg_class AS cl, prevstats AS pr
WHERE st.relname='tenk2' AND cl.relname='tenk2';
?column? | ?column? | ?column? | ?column?
----------+----------+----------+----------
diff --git a/src/test/regress/sql/pgstat_qd_tabstat.sql b/src/test/regress/sql/pgstat_qd_tabstat.sql
index 0fb8c0ccb71..72f76ac3d6e 100644
--- a/src/test/regress/sql/pgstat_qd_tabstat.sql
+++ b/src/test/regress/sql/pgstat_qd_tabstat.sql
@@ -233,7 +233,7 @@ select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n
insert into base_table select i,i,i from generate_series(1, 100) i;
refresh materialized view mt;
select pg_sleep(0.77) from gp_dist_random('gp_id'); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'mt'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
-- pg_stat_all_tables collects gpstats across segments
select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
@@ -249,7 +249,7 @@ select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n
insert into base_table select i,i,i from generate_series(1, 100) i;
refresh materialized view mt;
select pg_sleep(0.77) from gp_dist_random('gp_id'); -- Force pgstat_report_stat() to send tabstat.
-select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables_internal where relid = 'mt'::regclass;
+select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
-- pg_stat_all_tables collects gpstats across segments
select n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze from pg_stat_all_tables where relid = 'mt'::regclass;
diff --git a/src/test/regress/sql/stats.sql b/src/test/regress/sql/stats.sql
index c4afe1d10f3..dfbc354b9f0 100644
--- a/src/test/regress/sql/stats.sql
+++ b/src/test/regress/sql/stats.sql
@@ -27,7 +27,7 @@ SELECT t.seq_scan, t.seq_tup_read, t.idx_scan, t.idx_tup_fetch,
(b.heap_blks_read + b.heap_blks_hit) AS heap_blks,
(b.idx_blks_read + b.idx_blks_hit) AS idx_blks,
pg_stat_get_snapshot_timestamp() as snap_ts
- FROM pg_catalog.pg_stat_user_tables AS t,
+ FROM pg_catalog.gp_stat_user_tables_summary AS t,
pg_catalog.pg_statio_user_tables AS b
WHERE t.relname='tenk2' AND b.relname='tenk2';
COMMIT;
@@ -111,14 +111,14 @@ BEGIN;
SET LOCAL stats_fetch_consistency = snapshot;
SELECT relname, n_tup_ins, n_tup_upd, n_tup_del, n_live_tup, n_dead_tup
- FROM pg_stat_user_tables
+ FROM gp_stat_user_tables_summary
WHERE relname like 'trunc_stats_test%' order by relname;
SELECT st.seq_scan >= pr.seq_scan + 1,
st.seq_tup_read >= pr.seq_tup_read + cl.reltuples,
st.idx_scan >= pr.idx_scan + 1,
st.idx_tup_fetch >= pr.idx_tup_fetch + 1
- FROM pg_stat_user_tables AS st, pg_class AS cl, prevstats AS pr
+ FROM gp_stat_user_tables_summary AS st, pg_class AS cl, prevstats AS pr
WHERE st.relname='tenk2' AND cl.relname='tenk2';
-- GPDB_13_MERGE_FIXME: Some statistics are handled by stat collector process on each segment but not sent to master.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org