-
Notifications
You must be signed in to change notification settings - Fork 345
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
Frontend should check table exists before creating a table #2128
Comments
I'd like to address this issue, but I don't know how to make a test which can reproduce it. I tried to reproduce this issue, like so: #[tokio::test(flavor = "multi_thread")]
async fn test_issue2128() {
common_telemetry::init_default_ut_logging();
let instance =
tests::create_distributed_instance("test_distributed_insert_delete_and_query").await;
let frontend = instance.frontend();
let frontend = frontend.as_ref();
let table_name = "my_dist_table";
let sql = format!(
r"
CREATE TABLE {table_name} (
a INT,
ts TIMESTAMP,
TIME INDEX (ts)
) PARTITION BY RANGE COLUMNS(a) (
PARTITION r0 VALUES LESS THAN (10),
PARTITION r1 VALUES LESS THAN (20),
PARTITION r2 VALUES LESS THAN (50),
PARTITION r3 VALUES LESS THAN (MAXVALUE),
)"
);
create_table(frontend, sql).await;
let sql = format!(
r"
CREATE TABLE if not exists {table_name} (
a INT,
ts TIMESTAMP,
TIME INDEX (ts)
) PARTITION BY RANGE COLUMNS(a) (
PARTITION r0 VALUES LESS THAN (10),
PARTITION r1 VALUES LESS THAN (20),
PARTITION r2 VALUES LESS THAN (50),
PARTITION r3 VALUES LESS THAN (MAXVALUE),
)"
);
create_table(frontend, sql).await;
// And then I executed |
How about having a try with gtctl |
I tried it and playground in greptimecloud, but create table was successfully created. (playground in greptimecloud has 3 regions.) Am I missing something? ReproductionCREATE TABLE test_table (
a INT PRIMARY KEY,
ts TIMESTAMP TIME INDEX
) PARTITION BY RANGE COLUMNS(a) (
PARTITION r0 VALUES LESS THAN (10),
PARTITION r1 VALUES LESS THAN (20),
PARTITION r2 VALUES LESS THAN (MAXVALUE),
); Then CREATE TABLE if not exists test_table (
a INT PRIMARY KEY,
ts TIMESTAMP TIME INDEX
) PARTITION BY RANGE COLUMNS(a) (
PARTITION r0 VALUES LESS THAN (10),
PARTITION r1 VALUES LESS THAN (20),
PARTITION r2 VALUES LESS THAN (MAXVALUE),
); Link |
Hi @NiwakaDev , Thank you for your report. The cloud service may not use the latest version. I'll double-check it later. |
Verified, it's gone in v0.4 |
What type of bug is this?
Incorrect result
What subsystems are affected?
Frontend, Meta
What happened?
Runs a 3-node datanode cluster.
Firstly, Creates a 3-region table, it should be ok.
And rerun the above, then you will get an error:
This is because the creating table will run into the
selector
method before checking whether the table exists. Currently, the datanode can't have multiple regions of one table.What operating system did you use?
ubuntu 23.04
Relevant log output and stack trace
No response
How can we reproduce the bug?
Runs a 3-node datanode cluster.
Firstly, Creates a 3-region table, it should be ok.
And rerun the above, then you will get an error:
The text was updated successfully, but these errors were encountered: