Summary:
Currently, YSQL upgrade tests work roughly as follows:
1. During build time, a snapshot of the catalog tablet is taken.
2. A very old catalog snapshot (from 2.0.9) is saved in [[ https://github.com/yugabyte/yugabyte-db-ysql-catalog-snapshots/releases | a special GitHub repo ]].
3. When a YSQL upgrade test is run, the old snapshot is downloaded from the above repo and restored. Then all of the YSQL migration scripts (located in `src/yb/yql/pgwrapper/migrations`) are run.
With the changes to the catalog format in pg15, this 2.0.9 snapshot is now incompatible, so we can't use the old snapshot. We will not support YSQL upgrade between pg11 and pg15 versions of YB; there is a special, more complex upgrade path for that.
To fix these tests for pg15, I uploaded a snapshot of the current pg15 catalog to the repo and modified the tests to start from this snapshot instead.
We currently have two sys catalog snapshots that we use for tests: debug and release. We originally needed two different snapshots because debug and release builds used different data formats. Now, debug builds use the release data format, but ASAN/TSAN builds still use the old debug format. I renamed the debug snapshot to "sanitizers" for clarity.
Another issue is the differences in entries in the `pg_collate` system table, which contains collations, at least some of which are provided by the operating system. For example, the collation `en_US.utf8` on Linux is called `en_US.UTF-8` on Mac. This leads to issues on Mac builds when we try to compare the Mac-generated catalog with the Linux-generated one downloaded from the aforementioned GitHub repo. To address this issue, I generated a third snapshot on Mac that is used on Mac. Note that this was previously not an issue because in 2.0.9.0, we did not support system collations yet, so the 2.0.9.0 snapshot did not contain the Linux-specific entries (migration scripts such as `V19__6560__pg_collation_icu_70.sql` would correctly add the Mac versions of these system collations to the 2.0.9.0 snapshot).
### General changes
- Replace the old 2.0.9.0 snapshot with a new 2.25.0.0-pg15-alpha snapshot.
### Specific test modifications
TestYsqlUpgrade.java:
- upgradeCheckingIdempotency: This test previously restored the 2.0.9.0 snapshot and asserted that the major version # was 0. now that the 2.0.9.0 snapshot has been replaced with a pg15 snapshot, the major version # is non-zero.
- Remove this assertion since we no longer support restoring from pre-pg15 snapshots.
- This function checks that the right migration scripts were applied, but it assumes that we will always have to run at least one migration script. Disable this check in the case that we don't have to run any migrations.
- takeSysCatalogSnapshot: This function scans the entire system catalog so it can compare the current catalog state to the state of the old snapshot with all the migration scripts applied. To do this comparison, the test relied on the `relhasoids` column in `pg_class`, which no longer exists. Reconstruct the `relhasoids` column here using a subquery.
Jira: DB-13178
Test Plan:
```
./yb_build.sh release --java-test 'org.yb.pgsql.TestYsqlUpgrade#migratingIsEquivalentToReinitdb'
./yb_build.sh release --java-test 'org.yb.pgsql.TestYsqlUpgrade#upgradeIsIdempotent`
./yb_build.sh release --java-test 'org.yb.pgsql.TestYsqlUpgrade#upgradeIsIdempotentSingleConn`
./yb_build.sh release --java-test 'org.yb.pgsql.TestUsingOlderSnapshot#switchingToAnOlderSnaphsot'
./yb_build.sh release --java-test 'org.yb.pgsql.TestYbRoleProfile#testProfilesOnOldDbVersion'
./yb_build.sh release --cxx-test yb-admin-snapshot-schedule-test --gtest-filter '*PgsqlTestOldSysCatalogSnapshot*'
./yb_build.sh release --cxx-test yb-admin-snapshot-schedule-test --gtest-filter '* PgsqlTestMigrationFromEarliestSysCatalogSnapshot*'
```
Reviewers: tfoucher, telgersma
Reviewed By: telgersma
Subscribers: yql, svc_phabricator, ybase
Differential Revision: https://phorge.dev.yugabyte.com/D38439