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

Altering tablespace of a single table in a Tablegroup must throw error #23314

Closed
yugabyte-ci opened this issue Jul 30, 2024 · 0 comments
Closed
Assignees
Labels
area/ysql Yugabyte SQL (YSQL) jira-originated kind/bug This issue is a bug priority/high High Priority

Comments

@yugabyte-ci
Copy link
Contributor

yugabyte-ci commented Jul 30, 2024

Jira Link: DB-12239

@yugabyte-ci yugabyte-ci added jira-originated kind/bug This issue is a bug priority/high High Priority status/awaiting-triage Issue awaiting triage labels Jul 30, 2024
@yugabyte-ci yugabyte-ci added area/ysql Yugabyte SQL (YSQL) and removed status/awaiting-triage Issue awaiting triage labels Aug 13, 2024
utkarsh-um-yb added a commit that referenced this issue Sep 14, 2024
… tablespace

Summary:
Previously, the `ALTER TABLE <table> SET TABLESPACE <tablespace>` command allowed changing the tablespace of a single colocated table, which should not be possible.
- Colocated tables cannot be moved individually since de-colocation is not supported.
- This fix ensures that attempting to move a single colocated table will now result in an error.
- Instead, to move all tables within a tablespace, use:
```ALTER TABLE ALL IN TABLESPACE <tsp> SET TABLESPACE <new tsp> CASCADE```
- The fix enforces this by setting `yb_cascade` in `AlterTableCmd` to true for the movement of all colocated tables. If `yb_cascade` is not true and a single colocated table is being moved, an error is thrown.

JIRA: DB-12239

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

In the above test added a scenario, where we try to move a single colocated table in a tablespace, and ensures that it throws an error.

Reviewers: skumar, yguan, aagrawal

Reviewed By: yguan

Subscribers: jason, yql

Differential Revision: https://phorge.dev.yugabyte.com/D37055
jasonyb pushed a commit that referenced this issue Sep 16, 2024
Summary:
 027ce5b [doc] Configure CLion database project (#23856)
 3d59575 [docs] changed flag "enable_pg_parity_early_access" to "enable_pg_parity_tech_preview" in stable (#23909)
 ec951f8 [PLAT-14590] Fix permission check for otel-collector file existence check
 77f1c3a [PLAT-15212] Failover local provider test should validate safetime is restored during failover
 04a36f8 [DOC-444] [2.23] Lightweight DB clone (#23515)
 2809658 [PLAT-15145] Consume universe marker field for node-agent installation to decide the client type
 a3c7a31 [PLAT-15052][PLAT-8144] Airgap improvement to preprovision
 Excluded: 24a5af0 [#3946] YSQL: Add support for ALTER TABLE ... VALIDATE CONSTRAINT
 Excluded: 2ac2e98 [#23118] YSQL: Add support for ADD PRIMARY KEY ... USING INDEX
 ea51592 [DEVOPS-3234] yb_release: Change clean step error to warning
 72c91c4 [docs] Release notes for 2.23.0.0-b710 (#23687)
 e9ec9e2 [#23846] Support for automatically syncing inline third-party dependencies
 1977cf7 [#23766] docdb: Get colocated schema_version correctly in ChangeMetadataOperation
 02a4bac [#23896] Changing the pg-parity flag from --enable_pg_parity_tech_preview to --enable_pg_parity_early_access.
 dbddb04 [#23814] docs: Add log_dist option to auto_explain page. (#23921)
 56a9b49 [#23886] docdb: Fix load balancer leader balancing for geopartitioned tables
 48112fb [doc][yba] Warning for disk encryption agent (#23850)
 Excluded: 06baaf0 [#23314] YSQL: Prevent moving a single colocated table to a different tablespace
 886a2a0 [PLAT-15310] Fix failing UT on master for K8s service IPs
 f157e2e [#23917] xCluster: set up sequences_data stream(s) on source universe
 9d4b6e0 [PLAT-15302] Remove parallel query from enhanced PG parity gflags
 d50282d [doc] Fix RSS link (#23932)
 6990c7a [PLAT-15306] Update YBA node agent TLS certs to use strong ciphers
 d6e81df [PLAT-15325] Pass the region_name during YNP installation
 2ba8180 [PLAT-14883][Azure] OS upgrades seems to be leaving over unattached disks
 64aa030 [PLAT-15231]Query Regex not working in logs page - [PLAT-15235] [PLAT-15239][PLAT-15240][PLAT-15241][PLAT-15243]
 e9ab17d [#23835] ASH: Update the field in /rpcz from yql_endpoint_tserver_uuid to top_level_node_id
 c853c56 [#23899] YSQL: Support assertThrows in the org.yb.AssertionWrappers
 fdf8a67 [PLAT-15295] Use Pagination for querying LDAP server
 59fa2cd [PLAT-15295] Use Pagination for querying LDAP server
 af83ee5 [PLAT-15261][Master]Backups created through the Scheduled Backup feature are incorrectly tagged under the login user
 55b4187 [PLAT-15320][YBA CLI]K8s Universes throw `interface {} is string, not []float64` error

Test Plan: Jenkins: rebase: pg15-cherrypicks

Reviewers: jason, tfoucher

Differential Revision: https://phorge.dev.yugabyte.com/D38078
utkarsh-um-yb added a commit that referenced this issue Sep 18, 2024
…ble to a different tablespace

Summary:
Previously, the `ALTER TABLE <table> SET TABLESPACE <tablespace>` command allowed changing the tablespace of a single colocated table, which should not be possible.
- Colocated tables cannot be moved individually since de-colocation is not supported.
- This fix ensures that attempting to move a single colocated table will now result in an error.
- Instead, to move all tables within a tablespace, use:
```ALTER TABLE ALL IN TABLESPACE <tsp> SET TABLESPACE <new tsp> CASCADE```
- The fix enforces this by setting `yb_cascade` in `AlterTableCmd` to true for the movement of all colocated tables. If `yb_cascade` is not true and a single colocated table is being moved, an error is thrown.

original Commit: 06baaf0
Modifications:
 * src/postgres/src/backend/commands/tablecmds.c:
  * declaration of function `ATPrepSetTableSpace`:  06baaf0 commit introduces a new argument to the function and pg15 upstream had a different indentation than master at that location which caused a conflict. Resolved it by adding new argument and using the right indentation.
 * src/postgres/src/backend/parser/gram.y
  * ALTER TABLE SET TABLESPACE: Added a new statement (`n->yb_cascade = false;`) in master commit 06baaf0 and the next line (`$$ = (Node *) n;`) in the master had a different spacing than pg15 upstream due to upstream PG 30ed71e423ee63b263730b86326da2a629a29f84, which caused a conflict. Resolved it by adding the newly added statement and using the appropriate spacing in existing line.

JIRA: DB-12239

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

In the above test added a scenario, where we try to move a single colocated table in a tablespace, and ensures that it throws an error.

Reviewers: jason, tfoucher

Reviewed By: jason

Subscribers: yql, jason

Differential Revision: https://phorge.dev.yugabyte.com/D38079
utkarsh-um-yb added a commit that referenced this issue Sep 19, 2024
Summary:
Renamed the cascade variable to yb_cascade in ATPrepSetTableSpace, as it is a YugabyteDB-specific parameter introduced in commit 06baaf0 / D37055.

Jira: DB-12239

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

Reviewers: jason

Reviewed By: jason

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D38170
foucher added a commit that referenced this issue Sep 20, 2024
Summary:
 6b34652 [doc] Update badge colors (#23985)
 6dcfce6 [PLAT-15297][dr] GET /configs fails with java.lang.IllegalStateException: DrConfig iTest-dr(uuid) does not have any corresponding xCluster config
 7995311 [#23695] docdb: Improve help strings for tablet replica limit flags.
 7659151 [DOC-479] Voyager 1.8.1 updates (#23983)
 56c9cc9 [PLAT-15282]: fix NPE on k8s operator backup/restore status update
 c8776b5 [docs] SSL/TLS configuration with hashicorp vault YSQL plugin (#23979)
 Excluded: d3dd4f7 Bumping version to 2.25.0.0 on branch master
 Excluded: 0dbe7d6 [#23312] YSQL: Fix backup/restore for colocated tables without tablespace information.
 2beb872 [#23786] YSQL: add yb_make_next_ddl_statement_nonincrementing to YbDbAdminVariables
 28d0d8e [#24011] build: fix ./yb_build.sh --gcc13
 9feb6e8 [#24012] YSQL: Replace deprecated function shared_ptr::unique to fix macos compiler error
 2cc1480 [PLAT-15349] Fix update_lb_config automated NLB updates
 af4c46d [#23741] docdb: Add parameter to run PITR tests with clone instead
 0103dfc [PLAT-14459] Continuous backups for s3
 e6bb890 [PLAT-15192] [PLAT-15191] Document node-agent-provision.yaml
 1552321 [PLAT-15205] YBA callhome improvements
 ba6acbd [PLAT-15342] Install Node Agent as root level unit for ynp
 2478a50 [PLAT-13058] Remove references to public key filepath, since we don't need ssh keys for node agent based provisioning
 aa14f76 [#23975] YSQL, ASH: Fix TestYbAsh#testPgAuxInfo
 885b72b [#23960] DocDB: Fix WriteBuffer crash in move ctor
 Excluded: f4a002a [#23314] YSQL: Fix variable name to yb_ for ATPrepSetTableSpace
 29c56ed [PLAT-15369][YBA CLI]Backup list-increments doesn't support pretty/json outputs
 784160c [PLAT-15370][YBA CLI]backup list table output contains base_backup_uuid and backup_uuid
 b32222d [PLAT-15280][PLAT-14753] - Pg parity improvements and other ui fixes
 c6521cf [PLAT-15368][YBA CLI]Backup list print "No more backup present" after printing all the backups in -o pretty/json

- pg_catalog_version-test.cc
   - NonIncrementingDDLMode: YB master commit 2beb872 sets the role to yb_db_admin, which due to new behavior in upstream PG commit b073c3ccd06e4cb845e121387a43faa8c68a7b62 (documented in https://www.postgresql.org/docs/15/ddl-schemas.html#DDL-SCHEMAS-PATTERNS) causes the following unintended test failure: ERROR:  permission denied for schema public. Add a workaround to grant create permission to the role now set.

Test Plan: Jenkins: urgent, rebase: pg15-cherrypicks

Reviewers: jason, jenkins-bot

Differential Revision: https://phorge.dev.yugabyte.com/D38220
utkarsh-um-yb added a commit that referenced this issue Sep 20, 2024
…r ATPrepSetTableSpace

Summary:
Renamed the cascade variable to yb_cascade in ATPrepSetTableSpace, as it is a YugabyteDB-specific parameter introduced in commit 06baaf0 / D37055.

Original commit: f4a002a
 * src/postgres/src/backend/commands/tablecmds.c
  * ATPrepSetTableSpace declaration
   * This master commit renames argument cascade to yb_cascade.
   * Recent pg15-cherrypicks commit 1601e32 (change not yet in pg15 branch) changes style/spacing.
   * Take both changes.

Jira: DB-12239

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

Reviewers: jason, tfoucher

Reviewed By: tfoucher

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D38264
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) jira-originated kind/bug This issue is a bug priority/high High Priority
Projects
None yet
Development

No branches or pull requests

2 participants