-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#23626] allow loading old dumps that do not have index pg_class OIDs
Summary: The original diff, D37360, failed to account for one way of setting PG class OIDs. That broke backwards compatibility. This diff fixes this by taking that way of setting OIDs into account as well. In particular, the previous flag yb_ignore_heap_pg_class_oids, is generalized into yb_ignore_pg_class_oids, which ignores both heap PG class OIDs and index PG class OIDs now. NOTE: this involves renaming a flag but the previous flag has not actually gone out in any public release so this is okay. Fixes #23626 Test Plan: Verify preserving all pg_class OIDs works for new version: ``` ybd --cxx-test yb-backup-cross-feature-test --gtest_filter '*.TestPreservingPgEnumOids' --test-args '--verbose_yb_backup' >& /tmp/generic.mdl.log ybd --cxx-test yb-backup-cross-feature-test --gtest_filter '*.TestPreservingPgTypeAndClassOids' --test-args '--verbose_yb_backup' >& /tmp/generic.mdl.log ``` Testing backward compatibility: * spin up a universe without D36675 * git switch --detach 516ead0^ * create objects that will need OIDs supplied: ``` CREATE SEQUENCE foo; CREATE TYPE public.complex AS ( re double precision, im double precision ); CREATE TYPE filler_2 AS ENUM ('A','B','C'); CREATE TABLE indexed_table (a INT, b INT); CREATE INDEX simple_index ON indexed_table (a DESC); CREATE TABLE table_with_index_and_constraint (k INT PRIMARY KEY, v TEXT, UNIQUE (v)) ``` * dump out the metadata using YSQL dump: ``` build/latest/postgres/bin/ysql_dump --host=127.0.0.10 --dbname=yugabyte --include-yb-metadata --serializable-deferrable --create --schema-only --file=/tmp/dump ``` * shut that universe down and start up a new one using this diff * restore the metadata: ``` ~/code/yugabyte-db/bin/ysqlsh -h 127.0.0.20 --dbname=template1 -c 'DROP DATABASE yugabyte;' bin/ysqlsh -h 127.0.0.20 --dbname=template1 --file=/tmp/dump ``` * verify no errors To ensure check still works, add `SET yb_ignore_pg_class_oids = false;` to that dump after each occurrence of ``` SET yb_binary_restore = true; ``` verify you get an error trying to restore it: ``` ysqlsh:/tmp/dump2:81: ERROR: pg_class heap OID value not set when in binary upgrade mode ``` Other tests: ``` ybd --java-test 'org.yb.pgsql.TestYsqlDump#ysqlDumpAllWithYbMetadata' >& /tmp/generic.mdl.log ybd --java-test 'org.yb.pgsql.TestYsqlDump#ysqlDumpWithYbMetadata' >& /tmp/generic.mdl.log2 ybd --java-test 'org.yb.pgsql.TestYsqlDump#ysqlDumpColocatedDB' >& /tmp/generic.mdl.log3 ybd --java-test 'org.yb.pgsql.TestYsqlDump#ysqlDumpLegacyColocatedDB' >& /tmp/generic.mdl.log4 ybd --java-test 'org.yb.pgsql.TestYsqlDump#ysqlDumpWithoutYbMetadata' >& /tmp/generic.mdl.log5 ``` Reviewers: myang, xCluster Reviewed By: myang Subscribers: yql, ybase Differential Revision: https://phorge.dev.yugabyte.com/D37588
- Loading branch information
Showing
11 changed files
with
27 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters