Skip to content

Commit

Permalink
[pg15] test: fix TestYsqlDump#ysqlDumpWithYbMetadata output
Browse files Browse the repository at this point in the history
Summary:

- Adjust the OIDs emitted in the dump output due to catalog differences; I did not determine the exact reason for the differences.
- Add SET xmloption = content and SET default_table_access_method = heap to the dump output.
- Remove the SELECT pg_catalog.binary_upgrade_set_next_pg_type_oid statement before the CREATE SEQUENCE dump, as creating a sequence no longer creates an associated type (upstream PG commit f3faf35f370f558670c8213a08f2683f3811ffc7)
- Ensure the dump output file includes an ACL dump for the public schema. This is necessary because YB pg 15 commit 50f46b2 adds an extra GRANT ALL ON SCHEMA public TO public; to the test setup.
- Include an ACL dump for the new extension object pg_stat_statements_info, introduced by upstream PG commit 9fbc3f318d039c3e1e8614c38e40843cf8fcffde.
- Update the output to reflect that the "public" schema is now owned by "pg_database_owner".
- Other minor output changes.

The result of `\dgrt+` is changed due to changes in the execution plan:
```
# explain SELECT grpname AS "Group Name",
  pg_catalog.pg_get_userbyid(grpowner) AS "Group Owner",
  c.relname AS "Name",
  CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'm' THEN 'materialized view' WHEN 'i' THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN 'special' WHEN 'f' THEN 'foreign table' WHEN 'p' THEN 'table' WHEN 'I' THEN 'index' END as "Type",
  pg_catalog.pg_get_userbyid(c.relowner) AS "Owner"
FROM pg_catalog.pg_yb_tablegroup g
INNER JOIN (
  SELECT cl.oid, cl.relname, cl.relkind, cl.relowner,
         props.tablegroup_oid
  FROM pg_catalog.pg_class cl, yb_table_properties(cl.oid) props
) c
ON c.tablegroup_oid = g.oid;
```
PG11:
```
                                        QUERY PLAN
------------------------------------------------------------------------------------------
 Hash Join  (cost=112.50..164.26 rows=321 width=288)
   Hash Cond: (props.tablegroup_oid = g.oid)
   ->  Nested Loop  (cost=0.00..38.52 rows=321 width=73)
         ->  Seq Scan on pg_class cl  (cost=0.00..32.10 rows=321 width=73)
         ->  Function Scan on yb_table_properties props  (cost=0.00..0.01 rows=1 width=4)
   ->  Hash  (cost=100.00..100.00 rows=1000 width=72)
         ->  Seq Scan on pg_yb_tablegroup g  (cost=0.00..100.00 rows=1000 width=72)
(7 rows)
```
PG15 - another execution order:
```
                                        QUERY PLAN
------------------------------------------------------------------------------------------
 Nested Loop  (cost=0.00..55.30 rows=345 width=288)
   Join Filter: (props.tablegroup_oid = g.oid)
   ->  Seq Scan on pg_yb_tablegroup g  (cost=0.00..0.10 rows=1 width=72)
   ->  Nested Loop  (cost=0.00..41.40 rows=345 width=73)
         ->  Seq Scan on pg_class cl  (cost=0.00..34.50 rows=345 width=73)
         ->  Function Scan on yb_table_properties props  (cost=0.00..0.01 rows=1 width=4)
(6 rows)
```
PG11:
```
 grp2         | yugabyte    | tgroup_options_tgroup_and_custom_colocation_id | table | yugabyte
 grp2         | yugabyte    | tgroup_one_option_and_tgroup                   | table | yugabyte
 grp2         | yugabyte    | tgroup_options_and_tgroup                      | table | yugabyte
```
PG15:
```
 grp2         | yugabyte    | tgroup_one_option_and_tgroup                   | table | yugabyte
 grp2         | yugabyte    | tgroup_options_and_tgroup                      | table | yugabyte
 grp2         | yugabyte    | tgroup_options_tgroup_and_custom_colocation_id | table | yugabyte
```

Test Plan:
for _ in {1..50}; do grep TestYsqlDump#ysqlDumpWithYbMetadata pg15_tests/passing_tests.tsv; done | pg15_tests/run_tests.sh

Reviewers: jason, fizaa

Reviewed By: jason

Subscribers: loginov, yql

Differential Revision: https://phorge.dev.yugabyte.com/D36504
  • Loading branch information
fizaaluthra authored and OlegLoginov committed Aug 22, 2024
1 parent 0ec746b commit ab32fa2
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 113 deletions.
1 change: 1 addition & 0 deletions pg15_tests/passing_tests.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ JAVA org.yb.pgsql.TestYsqlDump#ysqlDumpAllWithYbMetadata
JAVA org.yb.pgsql.TestYsqlDump#ysqlDumpAllWithoutYbMetadata
JAVA org.yb.pgsql.TestYsqlDump#ysqlDumpColocatedDB
JAVA org.yb.pgsql.TestYsqlDump#ysqlDumpLegacyColocatedDB
JAVA org.yb.pgsql.TestYsqlDump#ysqlDumpWithYbMetadata
JAVA org.yb.pgsql.TestYsqlDump#ysqlDumpWithoutYbMetadata
JAVA org.yb.pgsql.TestYsqlMetrics
JAVA org.yb.pgsql.TestYsqlPartitionedBackup
Expand Down
Loading

0 comments on commit ab32fa2

Please sign in to comment.