Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#23182] YSQL: Fix upgrade test failure when using 2.20.3.1 snapshot
Summary: The following upgrade test that uses a 2.20.3.1 initdb snapshot currently fails: ./yb_build.sh release --java-test 'org.yb.pgsql.TestYsqlUpgrade#upgradeIsIdempotent' --java-test-args '-Dysql_sys_catalog_snapshot_path=/tmp/yugabyte-2.20.3.1/share/initial_sys_catalog_snapshot' The error looks like an expected diff found in pg_rewrite table: ``` Expected row: ...... :constraintDeps <> :stmt_location 0 :stmt_len 1006})] Actual row: ...... :constraintDeps <> :stmt_location 56 :stmt_len 406})] ``` After debugging, I found that this test runs ysql upgrade twice: 1. First time it runs ysql upgrade triggers running the following scripts sequentially ``` V44__19211__yb_stream_id_in_pg_replication_slots.sql V45__19128__yb_ash.sql ... V52__22028__yb_reset_analyze_statistics.sql ``` 2. Second time it deletes everything from pg_yb_migration table, and run ysql upgrade again. This caused to run sequentially ``` V9__10150__yb_extension_role.sql V10__9178__yb_is_local_table_function.sql ... V52__22028__yb_reset_analyze_statistics.sql ``` The script that caused the test failure is `V33__14209__yb_terminated_queries.sql`. This is a migration script that predates the 2.20.3.1 initdb snapshot. When the 2.20.3.1 initdb snapshot was built it ran yb_system_views.sql. In yb_system_views.sql there is "CREATE VIEW yb_terminated_queries ..." but in the migration script `V33__14209__yb_terminated_queries.sql` it has "CREATE OR REPLACE VIEW pg_catalog.yb_terminated_queries ...". These two statements differ textually and therefore their parse results will have different character position, statement length, etc. If we ran `V33__14209__yb_terminated_queries.sql` when the the initdb already has the view, the test fails because of parse results changes like :stmt_len 1006 vs :stmt_len 406. To fix test failure like this, I changed this test to only rerun the migration scripts that come after the 2.20.3.1 release by keeping the <baseline> row in pg_yb_migration. To ensure the default test behavior remains the same, when running with 2.0.9.0 (the default snapshot), the test still delete every row from pg_yb_migration table. Jira: DB-12122 Test Plan: 1. Run the default ysql upgrade test ./yb_build.sh release --java-test 'org.yb.pgsql.TestYsqlUpgrade' 2. Download various releases to get their initdb snapshots to validate the test. ./yb_build.sh release --sj --java-test 'org.yb.pgsql.TestYsqlUpgrade' --java-test-args '-Dysql_sys_catalog_snapshot_path=/tmp/yugabyte-2.20.3.1/share/initial_sys_catalog_snapshot' ./yb_build.sh release --sj --java-test 'org.yb.pgsql.TestYsqlUpgrade' --java-test-args '-Dysql_sys_catalog_snapshot_path=/tmp/yugabyte-2.0.9.0/share/initial_sys_catalog_snapshot' ./yb_build.sh release --sj --java-test 'org.yb.pgsql.TestYsqlUpgrade' --java-test-args '-Dysql_sys_catalog_snapshot_path=/tmp/yugabyte-2.11.2.0/share/initial_sys_catalog_snapshot' ./yb_build.sh release --sj --java-test 'org.yb.pgsql.TestYsqlUpgrade' --java-test-args '-Dysql_sys_catalog_snapshot_path=/tmp/yugabyte-2.12.12.0/share/initial_sys_catalog_snapshot' ./yb_build.sh release --sj --java-test 'org.yb.pgsql.TestYsqlUpgrade' --java-test-args '-Dysql_sys_catalog_snapshot_path=/tmp/yugabyte-2.14.13.0/share/initial_sys_catalog_snapshot' ./yb_build.sh release --sj --java-test 'org.yb.pgsql.TestYsqlUpgrade' --java-test-args '-Dysql_sys_catalog_snapshot_path=/tmp/yugabyte-2.16.9.0/share/initial_sys_catalog_snapshot' ./yb_build.sh release --sj --java-test 'org.yb.pgsql.TestYsqlUpgrade' --java-test-args '-Dysql_sys_catalog_snapshot_path=/tmp/yugabyte-2.20.2.0/share/initial_sys_catalog_snapshot' ./yb_build.sh release --sj --java-test 'org.yb.pgsql.TestYsqlUpgrade' --java-test-args '-Dysql_sys_catalog_snapshot_path=/tmp/yugabyte-2.14.17.0/share/initial_sys_catalog_snapshot' ./yb_build.sh release --sj --java-test 'org.yb.pgsql.TestYsqlUpgrade' --java-test-args '-Dysql_sys_catalog_snapshot_path=/tmp/yugabyte-2.18.8.0/share/initial_sys_catalog_snapshot' ./yb_build.sh release --sj --java-test 'org.yb.pgsql.TestYsqlUpgrade' --java-test-args '-Dysql_sys_catalog_snapshot_path=/tmp/yugabyte-2.20.4.1/share/initial_sys_catalog_snapshot' ./yb_build.sh release --sj --java-test 'org.yb.pgsql.TestYsqlUpgrade' --java-test-args '-Dysql_sys_catalog_snapshot_path=/tmp/yugabyte-2.18.3.0/share/initial_sys_catalog_snapshot' ./yb_build.sh release --sj --java-test 'org.yb.pgsql.TestYsqlUpgrade' --java-test-args '-Dysql_sys_catalog_snapshot_path=/tmp/yugabyte-2.21.1.0/share/initial_sys_catalog_snapshot' ./yb_build.sh release --sj --java-test 'org.yb.pgsql.TestYsqlUpgrade' --java-test-args '-Dysql_sys_catalog_snapshot_path=/tmp/yugabyte-2024.1.0.0/share/initial_sys_catalog_snapshot' Reviewers: yguan Reviewed By: yguan Subscribers: yql Differential Revision: https://phorge.dev.yugabyte.com/D36523
- Loading branch information