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

Bug Report: Can't cancel Materialize workflow on non-existent table #16470

Closed
rbranson opened this issue Jul 24, 2024 · 1 comment · Fixed by #16505
Closed

Bug Report: Can't cancel Materialize workflow on non-existent table #16470

rbranson opened this issue Jul 24, 2024 · 1 comment · Fixed by #16505

Comments

@rbranson
Copy link
Contributor

rbranson commented Jul 24, 2024

Overview of the Issue

Materialize workflows can be created with target_table specified as a non-existent table, but then can't be cancelled.

Reproduction Steps

Schema:

create table foo (id1 int not null, id2 int not null, primary key(id1));

Create Materialize workflow:

~/bin $ ./vtctldclient --server localhost:15999 Materialize \
>     --workflow foo_materialize_0 \
>     --target-keyspace rbranson-materialize \
>     create \
>     --source-keyspace rbranson-materialize \
>     --table-settings '[{"target_table": "table_that_doesnt_exist", "create_ddl": "create table foo_id1_counts (id1 int not null, cnt bigint, primary key (id1))", "source_expression": "select id1, count(*) as cnt f
rom foo group by id1"}]' \
>     --tablet-types primary
Materialization workflow foo_materialize_0 successfully created in the rbranson-materialize keyspace. Use show to view the status. 

This breaks because the table "table_that_doesnt_exist" doesn't exist, which is immediately obvious by using show to view the workflow status. However, it's then not possible to cancel the workflow:

Attempt to cancel:

~/bin $ ./vtctldclient --server localhost:15999 Materialize --workflow foo_materialize_0 --target-keyspace rbranson-materialize cancel
E0724 16:18:08.808370     227 main.go:56] rpc error: code = Unknown desc = TabletManager.ExecuteFetchAsDba on aws_useast1a_1-2759492108 error: rpc error: code = Unknown desc = Unknown table 'rbranson-materialize.table_that_doesnt_exist' (errno 1051) (sqlstate 42S02) during query: drop table `rbranson-materialize`.`table_that_doesnt_exist`: rpc error: code = Unknown desc = Unknown table 'rbranson-materialize.table_that_doesnt_exist' (errno 1051) (sqlstate 42S02) during query: drop table `rbranson-materialize`.`table_that_doesnt_exist`

To workaround, create the non-existent table:

create table table_that_doesnt_exist (id int);

Now it can be cancelled:

~/bin $ ./vtctldclient --server localhost:15999 Materialize --workflow foo_materialize_0 --target-keyspace rbranson-materialize cancel
Successfully cancelled the foo_materialize_0 workflow in the rbranson-materialize keyspace

Binary Version

vtgate version Version: 18.0.0-SNAPSHOT (Git revision 51962e957063c7e386a1911ca36f6c3eeaf01bcd branch 'latest-18.0') built on Tue Jun 25 05:04:44 UTC 2024 by vitess@buildkitsandbox using go1.21.11 linux/amd64

Operating System and Environment details

ID=wolfi
NAME="Wolfi"
PRETTY_NAME="Wolfi"
VERSION_ID="20230201"
HOME_URL="https://wolfi.dev"
Linux 5.15.0-1062-aws
x86_64
@rbranson rbranson added Needs Triage This issue needs to be correctly labelled and triaged Type: Bug labels Jul 24, 2024
@mattlord mattlord self-assigned this Jul 25, 2024
@mattlord mattlord added Component: VReplication Status: Fixed and removed Needs Triage This issue needs to be correctly labelled and triaged Status: Fixed labels Jul 25, 2024
@mattlord
Copy link
Contributor

mattlord commented Jul 25, 2024

I expected this to have been fixed via: #15977

However, I can repeat the issue on main today:

❯ vtctld --version
vtctld version Version: 21.0.0-SNAPSHOT (Git revision 59408f95e1b3c1b0952deae2b891fcab18e1443e branch 'main') built on Thu Jul 25 11:39:03 EDT 2024 by [email protected] using go1.22.5 darwin/arm64

cd examples/local 

./101_initial_cluster.sh

vtctldclient materialize --workflow foo_materialize --target-keyspace commerce create --source-keyspace commerce --table-settings '[{"target_table": "table_that_doesnt_exist", "create_ddl": "create table product_counts (id int not null, product_count bigint unsigned, primary key (id))", "source_expression": "select id, count(*) as cnt from product group by id"}]' --tablet-types primary

❯ vtctldclient materialize --workflow foo_materialize --target-keyspace commerce cancel
E0725 11:45:17.351147   85014 main.go:56] rpc error: code = Unknown desc = TabletManager.ExecuteFetchAsDba on zone1-0000000101: rpc error: code = Unknown desc = Unknown table 'vt_commerce.table_that_doesnt_exist' (errno 1051) (sqlstate 42S02) during query: drop table `vt_commerce`.`table_that_doesnt_exist`

So I'll need to do a follow-up for materialize.

Thank you for the bug report, @rbranson !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants