Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
colocation: set pgtable_id for SetSchema (#4986)
Summary: `pgtable_id` for schemas are not set consistently for master metadata and tserver metadata. - Create table request from postgres does not set it - `CatalogManager::CreateTable` does not set it - `RaftGroupMetadata::AddTable` does set it - `CatalogManager::AlterTable` does set it - `CatalogManager::AddIndexInfoToTable` does not set it - `CatalogManager::MarkIndexInfoFromTableForDeletion` does not set it - `RaftGroupMetadata::SetSchema` does not set it Ideally, `pgtable_id` would be set into the master schema on create, either on the create table request from postgres or `CatalogManager::CreateTable`. However, this may cause backwards compatibility issues. For now, tackle this problem at `RaftGroupMetadata::SetSchema` by setting `pgtable_id` there. This is just a copy-paste from `RaftGroupMetadata::AddTable`. Ideally, both shouldn't have to do this because the master schema would already have it. Test Plan: ```sh ./bin/yb-ctl create \ --master_flags "ysql_disable_index_backfill=false" \ --tserver_flags "ysql_disable_index_backfill=false" ./bin/ysqlsh ``` ```sql CREATE TABLE t (i int); CREATE INDEX ON t (i); DROP INDEX t_i_idx; DROP TABLE t; -- no corruption from docdb ``` ```sh # Set `ysql_disable_index_backfill` default to false in the code, then ./yb_build.sh \ --cxx-test pgwrapper_pg_libpq-test \ --gtest_filter PgLibPqTest.TableColocation ``` Reviewers: neha Reviewed By: neha Subscribers: yql Differential Revision: https://phabricator.dev.yugabyte.com/D8834
- Loading branch information