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

Tablespace name not changing in pg_yb_tablegroup after ALTER TABLE CASCADE #23336

Closed
yugabyte-ci opened this issue Jul 31, 2024 · 0 comments
Closed
Assignees
Labels
jira-originated kind/bug This issue is a bug priority/medium Medium priority issue

Comments

@yugabyte-ci
Copy link
Contributor

yugabyte-ci commented Jul 31, 2024

Jira Link: DB-12263

@yugabyte-ci yugabyte-ci added jira-originated kind/bug This issue is a bug priority/medium Medium priority issue status/awaiting-triage Issue awaiting triage labels Jul 31, 2024
@yugabyte-ci yugabyte-ci changed the title Tablespace name not changing in pg_yb_tablegroup after ALTER Tablespace name not changing in pg_yb_tablegroup after ALTER TABLE CASCADE Aug 13, 2024
@yugabyte-ci yugabyte-ci removed the status/awaiting-triage Issue awaiting triage label Aug 13, 2024
utkarsh-um-yb added a commit that referenced this issue Sep 13, 2024
…ER TABLE CASCADE

Summary:
The issue occurred when running the following sequence:
```
CREATE TABLE <table_name> SET TABLESPACE <tablespace_name>;
ALTER TABLE ALL IN TABLESPACE <tablespace_name> SET TABLESPACE <new_tablespace_name> CASCADE;
```
After executing the ALTER TABLE command, the `grptablespace` column in `pg_yb_tablegroup` did not reflect the change as expected.
- This issue was due to two functions (`ybAlterTablespaceForTablegroup` followed by `RenameTablegroup`) altering a tuple in `pg_yb_tablegroup` sequentially, with the second function using outdated cache data from `SysCache`.
- The fix merges these functions to ensure the `grptablespace` column is updated correctly and consistently.

JIRA: DB-12263

Test Plan:
== Automated Testing ==
- ./yb_build.sh --java-test org.yb.pgsql.TestPgRegressColocatedTablesWithTablespaces#testPgRegressColocatedTablesWithTablespaces

In the above test, added a case where we use `ALTER TABLE ALL ... TABLESPACE ... CASCADE` to move all tables and check that in the table `pg_yb_tablegroup`, `grpname` (tablegroup name) is equal to `colocation_grptablespace` for all tablegroups except default.

Reviewers: skumar, yguan, aagrawal

Reviewed By: yguan

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D36978
jasonyb pushed a commit that referenced this issue Sep 16, 2024
Summary:
 32572f7 [#23629]yugabyted: 2nd node doesn't join if webserver_port is changed
 b2d16eb [PLAT-15182]: Reset config working incorrectly for kubernetes universe
 dd60793 [#23843] YSQL: Do not retry schema mismatch errors that occur as part of a batched execution.
 22b6a47 [#23661] YSQL: Change the default wal_level to logical
 5eb925b [#23410] YSQL: Fix CREATE TABLE with pg_default tablespace in colocated databases
 2c0c0eb [#23913] build: fix ysql conn mgr ASAN issue
 b98984a Disable failing DR local provider tests
 48e3c40 Update YBA HA pre-reqs (#23865)
 9baa0be [docs] Release notes for 2.20.2.4 (#23880)
 a2a74d0 [Docs][Voyager] Added a known-issue in PG and some missing entries from PG compatibility doc (#23906)
 0a738ee [#23336] YSQL: Fix tablespace id update in pg_yb_tablegroup after ALTER TABLE CASCADE
 a0e2c4a [PLAT-15156] Pass pg_max_mem_mb during configure phase
 Excluded: 7f59bd8 [#22519] YSQL: Substitute YBSetRowLockPolicy function with YBGetDocDBWaitPolicy

MERGE:

- yb_pg_publication.out:
  - CREATE PUBLICATION testpub_foralltables FOR ALL TABLES;: YB master
    22b6a47 causes WARNING about
    wal_level not being "logical" to go away.  This warning is only
    present in YB pg15 because YB pg15
    5c5a2a0 was not able to suppress
    this WARNING for this one case (see that commit message for more
    details).
- yb_publication.out:
  - CREATE PUBLICATION testpub FOR ALL TABLES;: (same)
- yb_pg_pg_stat_statements.out
  - Check WAL is generated for the above statements: "DROP TABLE
    pgss_test" row's wal column values change.  Likely related to YB
    master 22b6a47.  Not sure how
    exactly it relates, but since it makes the test closer to the
    original pg_stat_statements.out, take it without question.
- yb_colocated_tables_with_tablespaces.{sql,out}:
  - Explicitly specifying pg_default tablespace must not create a new
    tablegroup: YB master 5eb925b adds
    these queries with SELECT * from system table, and upstream PG
    changes that to include the oid column.  We don't want to show the
    oid column since that can easily change, so replace * with explicit
    column names.

Test Plan: Jenkins: rebase: pg15-cherrypicks

Reviewers: tfoucher, jenkins-bot, stiwary, utkarsh.munjal

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D38035
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira-originated kind/bug This issue is a bug priority/medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

2 participants