-
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.
[#24720] YSQL: Disable auto analyze on the database during restore
Summary: Auto analyze service should skip running ANALYZEs on a database that is being restored. Otherwise, serialization errors can occur between DDL statements in the dump script and ANALYZEs run by auto analyze in the background when a cluster has auto analyze service enabled. These serialization errors occur on the concurrent increments to the catalog version. To support this, the `yb_disable_auto_analyze` GUC is introduced. By executing `ALTER DATABASE ... SET yb_disable_auto_analyze=on`, a user can stop auto analyze on all tables of the DB. The auto analyze service queries for the value of this GUC before running ANALYZE on tables that have crossed the required mutation threshold. To resume auto analyze again, the user should set the GUC to off. With this change, ysql_dump will disable auto analyze on the target database before any DDLs are executed and re-enable it after all DDLs are done if: (1) `--format p` (which is the default plain text output format) is used, (2) `--include-yb-metadata` is specified and (3) `--create` is not specified (this is because if output script also has to create the database, we need to disable auto analyze after the creation. This will be done in a follow-up revision). This change also disables auto analyze during a YSQL major version upgrade. ## Cross-version backup/restore compatibility: To maintain backwards compatibility i.e., when running restore on a db version without this GUC, the restore script checks for the presence of the GUC before setting it on the database using ALTER DATABASE. Jira: DB-13797 Test Plan: ./yb_build.sh release --gtest_filter PgAutoAnalyzeTest.DisableAndReEnableAutoAnalyze ./yb_build.sh release --cxx-test yb-backup-cross-feature-test --gtest-filter YBBackupTest.TestAutoAnalyzeEnabledDuringRestore ./yb_build.sh release --java-test org.yb.pgsql.TestYsqlDump ./yb_build.sh release --java-test org.yb.pgsql.TestYsqlUpgrade Reviewers: mihnea, hsunder, yguan, sanketh Reviewed By: hsunder Subscribers: sanketh, smishra, ybase, loginov, yql Differential Revision: https://phorge.dev.yugabyte.com/D40066
- Loading branch information
Showing
19 changed files
with
366 additions
and
49 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
Oops, something went wrong.