Skip to content

Commit

Permalink
Fix Cherry-pick Resgroup V2 and toolkit from GPDB
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaqizho committed Jul 30, 2024
1 parent 5fa2fe3 commit 17506d4
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 34 deletions.
1 change: 0 additions & 1 deletion contrib/auto_explain/expected/auto_explain.out
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ 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
Optimizer: Postgres query optimizer
(slice0) Executor memory: 105K bytes.
Memory used: 128000kB
relname
Expand Down
6 changes: 3 additions & 3 deletions gpcontrib/gp_toolkit/gp_toolkit--1.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1963,12 +1963,12 @@ LANGUAGE plpgsql;
--
--------------------------------------------------------------------------------

CREATE FUNCTION gp_toolkit.__gp_workfile_entries_f_on_master()
CREATE FUNCTION gp_toolkit.__gp_workfile_entries_f_on_coordinator()
RETURNS SETOF record
AS '$libdir/gp_workfile_mgr', 'gp_workfile_mgr_cache_entries'
LANGUAGE C VOLATILE EXECUTE ON COORDINATOR;

GRANT EXECUTE ON FUNCTION gp_toolkit.__gp_workfile_entries_f_on_master() TO public;
GRANT EXECUTE ON FUNCTION gp_toolkit.__gp_workfile_entries_f_on_coordinator() TO public;

CREATE FUNCTION gp_toolkit.__gp_workfile_entries_f_on_segments()
RETURNS SETOF record
Expand All @@ -1990,7 +1990,7 @@ GRANT EXECUTE ON FUNCTION gp_toolkit.__gp_workfile_entries_f_on_segments() TO pu
CREATE VIEW gp_toolkit.gp_workfile_entries AS
WITH all_entries AS (
SELECT C.*
FROM gp_toolkit.__gp_workfile_entries_f_on_master() AS C (
FROM gp_toolkit.__gp_workfile_entries_f_on_coordinator() AS C (
segid int,
prefix text,
size bigint,
Expand Down
8 changes: 4 additions & 4 deletions gpcontrib/gp_toolkit/gp_toolkit--1.3.sql
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ CREATE EXTERNAL WEB TABLE gp_toolkit.__gp_log_segment_ext
logline int,
logstack text
)
EXECUTE E'cat $GP_SEG_LOGDIR/*.csv'
EXECUTE E'cat $GP_SEG_DATADIR/log/*.csv'
FORMAT 'CSV' (DELIMITER AS ',' NULL AS '' QUOTE AS '"');

REVOKE ALL ON TABLE gp_toolkit.__gp_log_segment_ext FROM public;
Expand Down Expand Up @@ -245,7 +245,7 @@ CREATE EXTERNAL WEB TABLE gp_toolkit.__gp_log_coordinator_ext
logline int,
logstack text
)
EXECUTE E'cat $GP_SEG_LOGDIR/*.csv' ON COORDINATOR
EXECUTE E'cat $GP_SEG_DATADIR/log/*.csv' ON COORDINATOR
FORMAT 'CSV' (DELIMITER AS ',' NULL AS '' QUOTE AS '"');

REVOKE ALL ON TABLE gp_toolkit.__gp_log_coordinator_ext FROM public;
Expand Down Expand Up @@ -1435,9 +1435,9 @@ AS
THEN 0
ELSE pg_catalog.pg_relation_size(sotd.sotdoid) *
CASE
WHEN pg_catalog.get_ao_compression_ratio(sotd.sotdoid) = -1
WHEN (select pg_catalog.get_ao_compression_ratio(sotd.sotdoid)) = -1
THEN NULL
ELSE pg_catalog.get_ao_compression_ratio(sotd.sotdoid)
ELSE (select pg_catalog.get_ao_compression_ratio(sotd.sotdoid))
END
END
ELSE sotd.sotdsize
Expand Down
9 changes: 9 additions & 0 deletions src/backend/catalog/system_views.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,15 @@ 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, *
Expand Down
3 changes: 2 additions & 1 deletion src/backend/partitioning/partdesc.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ static PartitionDesc RelationBuildPartitionDesc(Relation rel,
PartitionDesc
RelationGetPartitionDesc(Relation rel, bool omit_detached)
{
Assert(rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE);
if (rel->rd_rel->relkind != RELKIND_PARTITIONED_TABLE)
return NULL;

/*
* If relcache has a partition descriptor, use that. However, we can only
Expand Down
32 changes: 16 additions & 16 deletions src/test/regress/expected/autostats.out
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,13 @@ $$
language plpgsql;
select test_auto_stats_in_function('copy t_test_auto_stats_in_function from program ''echo 1''',
false, 't_test_auto_stats_in_function');
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=none, ntuples=0
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=none, ntuples=-1
NOTICE: table "tmp_test_auto_stats_in_function" does not exist, skipping
INFO: gp_autostats_mode=on_no_stats, gp_autostats_mode_in_functions=none, ntuples=0
INFO: gp_autostats_mode=on_no_stats, gp_autostats_mode_in_functions=none, ntuples=-1
NOTICE: table "tmp_test_auto_stats_in_function" does not exist, skipping
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_no_stats, ntuples=1
NOTICE: table "tmp_test_auto_stats_in_function" does not exist, skipping
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_no_stats, ntuples=0
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_no_stats, ntuples=-1
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_change, ntuples=1
NOTICE: table "tmp_test_auto_stats_in_function" does not exist, skipping
test_auto_stats_in_function
Expand All @@ -226,8 +226,8 @@ NOTICE: table "tmp_test_auto_stats_in_function" does not exist, skipping

select test_auto_stats_in_function('create table tmp_test_auto_stats_in_function as select * from t_test_auto_stats_in_function distributed randomly',
true, 'tmp_test_auto_stats_in_function');
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=none, ntuples=0
INFO: gp_autostats_mode=on_no_stats, gp_autostats_mode_in_functions=none, ntuples=0
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=none, ntuples=-1
INFO: gp_autostats_mode=on_no_stats, gp_autostats_mode_in_functions=none, ntuples=-1
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_no_stats, ntuples=1
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_no_stats, ntuples=<NULL>
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_change, ntuples=1
Expand All @@ -238,14 +238,14 @@ INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_change, ntuples

select test_auto_stats_in_function('delete from t_test_auto_stats_in_function',
true, 't_test_auto_stats_in_function');
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=none, ntuples=0
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=none, ntuples=-1
NOTICE: table "tmp_test_auto_stats_in_function" does not exist, skipping
INFO: gp_autostats_mode=on_no_stats, gp_autostats_mode_in_functions=none, ntuples=0
INFO: gp_autostats_mode=on_no_stats, gp_autostats_mode_in_functions=none, ntuples=-1
NOTICE: table "tmp_test_auto_stats_in_function" does not exist, skipping
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_no_stats, ntuples=1
NOTICE: table "tmp_test_auto_stats_in_function" does not exist, skipping
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_no_stats, ntuples=1
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_change, ntuples=0
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_change, ntuples=-1
NOTICE: table "tmp_test_auto_stats_in_function" does not exist, skipping
test_auto_stats_in_function
-----------------------------
Expand Down Expand Up @@ -307,32 +307,32 @@ $$
language plpgsql;
call test_auto_stats_in_function('copy t_test_auto_stats_in_function from program ''echo 1''',
false, 't_test_auto_stats_in_function');
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=none, ntuples=0
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=none, ntuples=-1
NOTICE: table "tmp_test_auto_stats_in_function" does not exist, skipping
INFO: gp_autostats_mode=on_no_stats, gp_autostats_mode_in_functions=none, ntuples=0
INFO: gp_autostats_mode=on_no_stats, gp_autostats_mode_in_functions=none, ntuples=-1
NOTICE: table "tmp_test_auto_stats_in_function" does not exist, skipping
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_no_stats, ntuples=1
NOTICE: table "tmp_test_auto_stats_in_function" does not exist, skipping
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_no_stats, ntuples=0
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_no_stats, ntuples=-1
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_change, ntuples=1
NOTICE: table "tmp_test_auto_stats_in_function" does not exist, skipping
call test_auto_stats_in_function('create table tmp_test_auto_stats_in_function as select * from t_test_auto_stats_in_function distributed randomly',
true, 'tmp_test_auto_stats_in_function');
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=none, ntuples=0
INFO: gp_autostats_mode=on_no_stats, gp_autostats_mode_in_functions=none, ntuples=0
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=none, ntuples=-1
INFO: gp_autostats_mode=on_no_stats, gp_autostats_mode_in_functions=none, ntuples=-1
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_no_stats, ntuples=1
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_no_stats, ntuples=<NULL>
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_change, ntuples=1
call test_auto_stats_in_function('delete from t_test_auto_stats_in_function',
true, 't_test_auto_stats_in_function');
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=none, ntuples=0
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=none, ntuples=-1
NOTICE: table "tmp_test_auto_stats_in_function" does not exist, skipping
INFO: gp_autostats_mode=on_no_stats, gp_autostats_mode_in_functions=none, ntuples=0
INFO: gp_autostats_mode=on_no_stats, gp_autostats_mode_in_functions=none, ntuples=-1
NOTICE: table "tmp_test_auto_stats_in_function" does not exist, skipping
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_no_stats, ntuples=1
NOTICE: table "tmp_test_auto_stats_in_function" does not exist, skipping
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_no_stats, ntuples=1
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_change, ntuples=0
INFO: gp_autostats_mode=none, gp_autostats_mode_in_functions=on_change, ntuples=-1
NOTICE: table "tmp_test_auto_stats_in_function" does not exist, skipping
drop procedure test_auto_stats_in_function(text, boolean, text);
create table t_test_auto_stats_in_function(a int);
Expand Down
9 changes: 2 additions & 7 deletions src/test/regress/greenplum_schedule
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ test: gp_dispatch_keepalives
test: copy_eol

test: disable_autovacuum
# test gp_fastsequence allocation (early in schedule as log grepping is expensive)
# These tests gp_log_system could have issue reading partial log that's generated
# from concurrent test. So anything that uses it needs to be run alone.
test: uao_dml/gp_fastsequence_row
test: uao_dml/gp_fastsequence_column

test: python_processed64bit
test: enable_autovacuum

Expand Down Expand Up @@ -337,6 +331,7 @@ test: bfv_meta_track
test: ao_segfile

# run this at the end of the schedule for more chance to catch abnormalities
test: gp_check_files
# different CI env with GPDB
# test: gp_check_files

# end of tests
4 changes: 2 additions & 2 deletions src/test/regress/input/oid_wraparound.source
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ SELECT gp_set_next_oid_master(4290000000);
SELECT gp_set_next_oid_segments(16384);

-- We expect the QE to increment once to 16385 and the QD should
-- fast-forward to 16391. The QD could possibly fast-forward to 16392
-- fast-forward to 16388. The QD could possibly fast-forward to 16389
-- if the pg_type heap page was not pruned for dead pg_type entry for
-- oid_wraparound_table relation which will result in Oid 16386
-- collision.
SELECT gp_get_next_oid_master();
SELECT gp_get_next_oid_segments();
CREATE TABLE oid_wraparound_table_other AS SELECT 1 AS a;
SELECT gp_get_next_oid_master() in (16391, 16392);
SELECT gp_get_next_oid_master() in (16388, 16389);
SELECT gp_get_next_oid_segments();

0 comments on commit 17506d4

Please sign in to comment.