Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YSQL] Migrate pg_tablegroup to pg_yb_tablegroup #10190

Closed
timothy-e opened this issue Oct 5, 2021 · 0 comments
Closed

[YSQL] Migrate pg_tablegroup to pg_yb_tablegroup #10190

timothy-e opened this issue Oct 5, 2021 · 0 comments
Assignees
Labels
area/ysql Yugabyte SQL (YSQL)

Comments

@timothy-e
Copy link
Contributor

Add column grptablespace

@timothy-e timothy-e self-assigned this Oct 5, 2021
@timothy-e timothy-e changed the title Migrate pg_tablegroup to pg_yb_tablegroup [YSQL] Migrate pg_tablegroup to pg_yb_tablegroup Oct 5, 2021
@timothy-e timothy-e added the area/ysql Yugabyte SQL (YSQL) label Oct 5, 2021
@timothy-e timothy-e moved this from To do to In progress in Setting Tablespaces for Tablegroups Oct 12, 2021
@timothy-e timothy-e moved this from In progress to In Review in Setting Tablespaces for Tablegroups Oct 20, 2021
timothy-e added a commit that referenced this issue Nov 25, 2021
Summary:
This patch replaces pg_tablegroup and all of its references with a new table pg_yb_tablgroup that has an additional column 'grptablespace'.

In an upgraded cluster, pg_tablegroup table will still exist but it will not be used anymore. This can break backwards compatibility, but this is acceptable as this is a beta feature. This patch also contains initdb migration to copy over rows from pg_tablegroup to the new table pg_yb_tablegroup.

This patch also relaxes a previous requirement from initdb migration that prevented user oids from being used in upgrade mode. This check has been relaxed to allow copying over oids from pg_tablegroup to pg_yb_tablegroup.

The `upgradeIsIdempotent` test is also updated to

1. create early version of catalog
2. apply migrations
3. delete migrations table
4. apply migrations

instead of

1. create new version of catalog
2. delete migrations table
3. apply migrations

Test Plan:
```
ybd release --java-test org.yb.pgsql.TestYsqlUpgrade
ybd release --java-test org.yb.pgsql.TestPgRegressTablegroup
```
Manual testing outlined in the migrations README

Verified that we cannot delete a tablegroup if it is used by a table.

Super user cannot delete it, even if modifiying system tables is enabled.
* `ERROR:  cannot drop table pg_yb_tablegroup because it is required by the database system`
* enforced by `findDependentObjects` in `dependency.c`

Reviewers: alex, dsrinivasan

Reviewed By: alex, dsrinivasan

Subscribers: smishra

Differential Revision: https://phabricator.dev.yugabyte.com/D13448
@timothy-e timothy-e moved this from In Review to Done in Setting Tablespaces for Tablegroups Nov 25, 2021
timothy-e added a commit that referenced this issue Nov 26, 2021
Summary:
This patch replaces pg_tablegroup and all of its references with a new table pg_yb_tablgroup that has an additional column 'grptablespace'.

In an upgraded cluster, pg_tablegroup table will still exist but it will not be used anymore. This can break backwards compatibility, but this is acceptable as this is a beta feature. This patch also contains initdb migration to copy over rows from pg_tablegroup to the new table pg_yb_tablegroup.

This patch also relaxes a previous requirement from initdb migration that prevented user oids from being used in upgrade mode. This check has been relaxed to allow copying over oids from pg_tablegroup to pg_yb_tablegroup.

The `upgradeIsIdempotent` test is also updated to

1. create early version of catalog
2. apply migrations
3. delete migrations table
4. apply migrations

instead of

1. create new version of catalog
2. delete migrations table
3. apply migrations

Test Plan:
```
ybd release --java-test org.yb.pgsql.TestYsqlUpgrade
ybd release --java-test org.yb.pgsql.TestPgRegressTablegroup
```
Manual testing outlined in the migrations README

Verified that we cannot delete a tablegroup if it is used by a table.

Super user cannot delete it, even if modifiying system tables is enabled.
* `ERROR:  cannot drop table pg_yb_tablegroup because it is required by the database system`
* enforced by `findDependentObjects` in `dependency.c`

Reviewers: alex, dsrinivasan

Reviewed By: alex, dsrinivasan

Subscribers: smishra

Differential Revision: https://phabricator.dev.yugabyte.com/D13448
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL)
Development

No branches or pull requests

1 participant