Skip to content

Commit

Permalink
refactor by CR
Browse files Browse the repository at this point in the history
  • Loading branch information
chunshao90 committed May 17, 2023
1 parent 73b043e commit 8c852af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ SELECT * from partition_table_t where name in ("ceresdb5", "ceresdb6", "ceresdb7

DROP TABLE IF EXISTS `partition_table_t`;

-- The route cache will cause the data table to be queried after it is deleted. Refer to #893.
-- SHOW CREATE TABLE partition_table_t;
13 changes: 8 additions & 5 deletions proxy/src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ impl<Q: QueryExecutor + 'static> Proxy<Q> {
async fn handle_auto_create_table(
&self,
request_id: RequestId,
database: &str,
schema: &str,
req: &WriteRequest,
) -> Result<()> {
if !self.auto_create_table {
Expand All @@ -428,26 +428,29 @@ impl<Q: QueryExecutor + 'static> Proxy<Q> {

let schema_config = self
.schema_config_provider
.schema_config(database)
.schema_config(schema)
.box_err()
.with_context(|| ErrWithCause {
code: StatusCode::INTERNAL_SERVER_ERROR,
msg: format!("Fail to fetch schema config, schema_name:{database}"),
msg: format!("Fail to fetch schema config, schema_name:{schema}"),
})?
.cloned()
.unwrap_or_default();

// TODO: Consider whether to build tables concurrently when there are too many
// tables.
for write_table_req in &req.table_requests {
let table_info = self
.router
.fetch_table_info(database, &write_table_req.table)
.fetch_table_info(schema, &write_table_req.table)
.await?;
if table_info.is_some() {
continue;
}
self.create_table(
request_id,
self.instance.catalog_manager.default_catalog_name(),
database,
schema,
write_table_req,
&schema_config,
None,
Expand Down

0 comments on commit 8c852af

Please sign in to comment.