Skip to content

Commit

Permalink
test: improve pg_hint_plan regress tests
Browse files Browse the repository at this point in the history
Summary:
- fix: remove some bad error text in the init test
- refactor: change the final ANALYZE in the init test to a comment
  because changes to the number of existing tables changes the number of
  warnings output
- refactor: avoid selecting yb_ settings because additions of new yb_
  GUC variables change the output of SELECT
- style: add comments referencing the original tests

Test Plan: ./yb_build.sh --java-test org.yb.pgsql.TestPgRegressExtension

Reviewers: rskannan

Reviewed By: rskannan

Subscribers: yql

Differential Revision: https://phabricator.dev.yugabyte.com/D11143
  • Loading branch information
jaki committed Apr 5, 2021
1 parent fbe8976 commit 47d83e7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 96 deletions.
102 changes: 11 additions & 91 deletions src/postgres/src/test/regress/expected/yb_pg_hint_plan_init.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
-- Testing pg_hint_plan
-- Initialization of tables for pg_hint_plan test
-- This test is derived from the init test in
-- <https://github.com/ossc-db/pg_hint_plan/>.
SET search_path TO public;
CREATE EXTENSION pg_hint_plan;
CREATE SCHEMA s0;
Expand Down Expand Up @@ -143,22 +145,19 @@ ERROR: ALTER SYSTEM not supported yet
LINE 6: ALTER SYSTEM SET effective_cache_size TO 16384;
^
HINT: Please report the issue on https://github.com/YugaByte/yugabyte-db/issues
ERROR: ALTER SYSTEM not supported yet
LINE 6: ALTER SYSTEM SET effective_cache_size TO 16384;
ERROR: syntax error at or near "ERROR"
LINE 1: ERROR: ALTER SYSTEM not supported yet
^
^
HINT: Please report the issue on https://github.com/YugaByte/yugabyte-db/issues
SELECT pg_reload_conf();
ERROR: syntax error at or near "^"
LINE 1: ^
^
pg_reload_conf
----------------
t
(1 row)

SET effective_cache_size TO 16384;
-- YB: modify view to avoid yb_ settings.
CREATE VIEW settings AS
SELECT name, setting, category
FROM pg_settings
WHERE category LIKE 'Query Tuning%'
AND name NOT LIKE 'yb_%'
OR name = 'client_min_messages'
ORDER BY category, name;
SELECT * FROM settings;
Expand Down Expand Up @@ -211,84 +210,5 @@ SELECT * FROM settings;
enable_tidscan | on | Query Tuning / Planner Method Configuration
(45 rows)

ANALYZE;
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
WARNING: analyzing non-temporary tables will be ignored
-- TODO(jason): uncomment when closing issue #1420.
-- ANALYZE;
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- This test is derived from the pg_hint_plan test in
-- <https://github.com/ossc-db/pg_hint_plan/>.
SET search_path TO public;
SET client_min_messages TO log;
\set SHOW_CONTEXT always
Expand Down
11 changes: 6 additions & 5 deletions src/postgres/src/test/regress/sql/yb_pg_hint_plan_init.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
-- Testing pg_hint_plan
-- Initialization of tables for pg_hint_plan test
-- This test is derived from the init test in
-- <https://github.com/ossc-db/pg_hint_plan/>.
SET search_path TO public;

CREATE EXTENSION pg_hint_plan;
Expand Down Expand Up @@ -131,19 +133,18 @@ CREATE VIEW v4 AS SELECT v_2.t1_id, t_3.id FROM v2 v_2, t3 t_3 WHERE v_2.t1_id =

/* Fix auto-tunable parameters */
ALTER SYSTEM SET effective_cache_size TO 16384;
ERROR: ALTER SYSTEM not supported yet
LINE 6: ALTER SYSTEM SET effective_cache_size TO 16384;
^
HINT: Please report the issue on https://github.com/YugaByte/yugabyte-db/issues
SELECT pg_reload_conf();
SET effective_cache_size TO 16384;

-- YB: modify view to avoid yb_ settings.
CREATE VIEW settings AS
SELECT name, setting, category
FROM pg_settings
WHERE category LIKE 'Query Tuning%'
AND name NOT LIKE 'yb_%'
OR name = 'client_min_messages'
ORDER BY category, name;
SELECT * FROM settings;

ANALYZE;
-- TODO(jason): uncomment when closing issue #1420.
-- ANALYZE;
2 changes: 2 additions & 0 deletions src/postgres/src/test/regress/sql/yb_pg_hint_plan_test1.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- This test is derived from the pg_hint_plan test in
-- <https://github.com/ossc-db/pg_hint_plan/>.
SET search_path TO public;
SET client_min_messages TO log;
\set SHOW_CONTEXT always
Expand Down

0 comments on commit 47d83e7

Please sign in to comment.