-
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.
[#16971] DocDB: Refactor hide table on drop
Summary: When a table is dropped it sometimes gets hidden instead and later lazily dropped. The code that covers the logic for determining when the table is hidden and when it is dropped is spread across components and non intuitive to follow. This change simplifies the logic and makes it more extensible for new features like db scoped xcluster to hide the table in the future. Delete request for tables and tablets occur in the following places: 1. A individual tablet is deleted when it is split, and the split OpId has been applied. The tservers call `DeleteNotServingTablet` on master when this happens. 2. A table and all its tablets are deleted by `DeleteTableInternal` which is called from a user initiated table drop, failed table create and index backfill. 3. `DeleteYsqlDBTables` drops all the tables in the YSQL DB. All 3 now end up calling `DeleteOrHideTabletsOfTable` with a `TabletDeleteRetainerInfo` object. `TabletDeleteRetainerInfo` contains the context for when a table\tablet should be Hidden instead of being directly Deleted. This object is populated in one function `CatalogManager::GetTabletDeleteRetainerInfo`. This function passes the object to all master managers which may require the object to be Hidden. This is currently the `MasterSnapshotCoordinator` and `xrepl_catalog_manager`. In a later change `xcluster_manager` will also be hooked in here. `DeleteYsqlDBTables` does not currently hide tables, so it uses `TabletDeleteRetainerInfo::AlwaysDelete`. The tablet will be Hidden as long as `CatalogManager::ShouldRetainHiddenTablet` returns true. Similar to `GetTabletDeleteRetainerInfo` this calls the master managers which require the object to be retained as Hidden. When we require tables to be hidden for other purposes in the future we only need to update `GetTabletDeleteRetainerInfo`, `ShouldRetainHiddenTablet` and `TabletDeleteRetainerInfo`. `CatalogManager::CleanupHiddenTables` will delete Hidden tables after all its tablets have been deleted. `CatalogManager::CleanupHiddenTablets` uses `ShouldRetainHiddenTablet` to determine when it is safe to clean it up. All Snapshot related retention logic has been moved into `MasterSnapshotCoordinator`. All xCluster and cdcsdk related code have been moved into xrepl_catalog_manager. Some functions names have been changed to make them cleaner. Jira: DB-6295 Test Plan: Jenkins Reviewers: jhe, asrivastava, xCluster Reviewed By: jhe Subscribers: bogdan, ybase Differential Revision: https://phorge.dev.yugabyte.com/D32780
- Loading branch information
Showing
16 changed files
with
615 additions
and
415 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
Large diffs are not rendered by default.
Oops, something went wrong.
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.