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

[Phase 1][YSQL][Colocation] Alter table fails on colocated table #4293

Closed
ndeodhar opened this issue Apr 24, 2020 · 3 comments
Closed

[Phase 1][YSQL][Colocation] Alter table fails on colocated table #4293

ndeodhar opened this issue Apr 24, 2020 · 3 comments
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug priority/medium Medium priority issue

Comments

@ndeodhar
Copy link
Contributor

ndeodhar commented Apr 24, 2020

Jira Link: [DB-391](https://yugabyte.atlassian.net/browse/DB-391)
Alter table fails on colocated DB:

yugabyte=# create database codb with colocated=true;
CREATE DATABASE
yugabyte=# \c codb
You are now connected to database "codb" as user "yugabyte".
codb=# create table test(a int primary key);
CREATE TABLE
codb=# insert into test select generate_series(1,100);
INSERT 0 100
codb=# alter table test add column b int;
ERROR:  Timed out: Timed out waiting for AlterTable
@ndeodhar ndeodhar added kind/bug This issue is a bug area/ysql Yugabyte SQL (YSQL) labels Apr 24, 2020
@jaki
Copy link
Contributor

jaki commented May 12, 2020

The overall issue is that alter table doesn't handle non-primary tables of tablets well. Here are some details to fix it, going in time order:

  1. master AsyncAlterTable should take table param (otherwise, it always uses tablet's primary table)
  2. ChangeMetadataRequestPB probably needs some alter_table_id field
  3. Some modifications to TabletService
  4. Some modifications to Tablet
  5. Some modifications to RaftGroupMetadata
  6. master HandleTabletSchemaVersionReport should take table param (otherwise, it always uses tablet's primary table)

See https://github.com/jaki/yugabyte-db/tree/colo-alter-table for partial work.

ndeodhar added a commit that referenced this issue Jun 25, 2020
Summary:
Add alter table support for colocated tables.
Changes include:
1. AlterSchema RPC takes table ID as input. If there is no table ID, we use tablet's primary table ID.
2. SchemaPB now contains information about colocated table ID.

Future diff:
Tablet report sends a schema version for each tablet. Since a colocated tablet can have multiple tables, we need to send multiple schema versions (1 per table) and process that on the master.

Test Plan: Added tests to yb_feature_colocation

Reviewers: bogdan, hector

Reviewed By: hector

Subscribers: jason, yql

Differential Revision: https://phabricator.dev.yugabyte.com/D8603
AbdallahKhaled93 pushed a commit to AbdallahKhaled93/yugabyte-db that referenced this issue Jun 29, 2020
Summary:
Add alter table support for colocated tables.
Changes include:
1. AlterSchema RPC takes table ID as input. If there is no table ID, we use tablet's primary table ID.
2. SchemaPB now contains information about colocated table ID.

Future diff:
Tablet report sends a schema version for each tablet. Since a colocated tablet can have multiple tables, we need to send multiple schema versions (1 per table) and process that on the master.

Test Plan: Added tests to yb_feature_colocation

Reviewers: bogdan, hector

Reviewed By: hector

Subscribers: jason, yql

Differential Revision: https://phabricator.dev.yugabyte.com/D8603
deeps1991 pushed a commit to deeps1991/yugabyte-db that referenced this issue Jul 22, 2020
Summary:
Add alter table support for colocated tables.
Changes include:
1. AlterSchema RPC takes table ID as input. If there is no table ID, we use tablet's primary table ID.
2. SchemaPB now contains information about colocated table ID.

Future diff:
Tablet report sends a schema version for each tablet. Since a colocated tablet can have multiple tables, we need to send multiple schema versions (1 per table) and process that on the master.

Test Plan: Added tests to yb_feature_colocation

Reviewers: bogdan, hector

Reviewed By: hector

Subscribers: jason, yql

Differential Revision: https://phabricator.dev.yugabyte.com/D8603
@frozenspider frozenspider changed the title [Colocation] Alter table fails on colocated table [YSQL][Colocation] Alter table fails on colocated table Apr 20, 2022
@tverona1
Copy link
Contributor

Validate this for tablegroups as well

@tverona1 tverona1 changed the title [YSQL][Colocation] Alter table fails on colocated table [Phase 1][YSQL][Colocation] Alter table fails on colocated table May 17, 2022
@yugabyte-ci yugabyte-ci added the priority/medium Medium priority issue label May 17, 2022
@frozenspider
Copy link
Contributor

Verified - this has been fixed, ALTER works for both means of colocation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug priority/medium Medium priority issue
Projects
Status: Done
Development

No branches or pull requests

5 participants