-
Notifications
You must be signed in to change notification settings - Fork 332
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
fix: concurrent rename two table to same name may cause override #1368
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🫨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the LocalCatalogManager have a similar issue?
greptimedb/src/catalog/src/local/manager.rs
Lines 415 to 442 in 716bde8
let schema = catalog | |
.schema(schema_name)? | |
.with_context(|| SchemaNotFoundSnafu { | |
catalog: catalog_name, | |
schema: schema_name, | |
})?; | |
let old_table = schema | |
.table(&request.table_name) | |
.await? | |
.context(TableNotExistSnafu { | |
table: &request.table_name, | |
})?; | |
let engine = old_table.table_info().meta.engine.to_string(); | |
// rename table in system catalog | |
self.system | |
.register_table( | |
catalog_name.clone(), | |
schema_name.clone(), | |
request.new_table_name.clone(), | |
request.table_id, | |
engine, | |
) | |
.await?; | |
Ok(schema | |
.rename_table(&request.table_name, request.new_table_name) | |
.is_ok()) |
Looks like we should acquire the register lock and check whether the new table exists
272af08
to
bd68f2a
Compare
This comment was marked as resolved.
This comment was marked as resolved.
Codecov Report
@@ Coverage Diff @@
## develop #1368 +/- ##
===========================================
- Coverage 86.04% 85.76% -0.28%
===========================================
Files 523 528 +5
Lines 78396 78486 +90
===========================================
- Hits 67454 67317 -137
- Misses 10942 11169 +227 |
…ptimeTeam#1368) * fix: concurrent rename two table to same name may cause override * fix: concurrently update system catalog table * fix: correctness
I hereby agree to the terms of the GreptimeDB CLA
What's changed and what's your intention?
fix concurrent rename two table to same name may cause override
Checklist
Refer to a related PR or issue link (optional)
fixes #1369