Skip to content

Commit

Permalink
fix: auto_create_table without ceresmeta (#911)
Browse files Browse the repository at this point in the history
## Related Issues
Closes #

## Detailed Changes
Fix the bug that the automatic table creation will cause repeated table
creation in the deployment mode without `ceresmeta`.

## Test Plan 
CI and TSBS.
  • Loading branch information
chunshao90 authored May 23, 2023
1 parent d628a52 commit dcae0e0
Show file tree
Hide file tree
Showing 4 changed files with 268 additions and 126 deletions.
9 changes: 8 additions & 1 deletion proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use std::{

use ::http::StatusCode;
use catalog::schema::{
CreateOptions, CreateTableRequest, DropOptions, DropTableRequest, SchemaRef,
CreateOptions, CreateTableRequest, DropOptions, DropTableRequest, NameRef, SchemaRef,
};
use ceresdbproto::storage::{
storage_service_client::StorageServiceClient, PrometheusRemoteQueryRequest,
Expand Down Expand Up @@ -70,6 +70,7 @@ pub struct Proxy<Q> {
schema_config_provider: SchemaConfigProviderRef,
hotspot_recorder: Arc<HotspotRecorder>,
engine_runtimes: Arc<EngineRuntimes>,
cluster_with_meta: bool,
}

impl<Q: QueryExecutor + 'static> Proxy<Q> {
Expand All @@ -84,6 +85,7 @@ impl<Q: QueryExecutor + 'static> Proxy<Q> {
schema_config_provider: SchemaConfigProviderRef,
hotspot_config: hotspot::Config,
engine_runtimes: Arc<EngineRuntimes>,
cluster_with_meta: bool,
) -> Self {
let forwarder = Arc::new(Forwarder::new(
forward_config,
Expand All @@ -104,13 +106,18 @@ impl<Q: QueryExecutor + 'static> Proxy<Q> {
schema_config_provider,
hotspot_recorder,
engine_runtimes,
cluster_with_meta,
}
}

pub fn instance(&self) -> InstanceRef<Q> {
self.instance.clone()
}

fn default_catalog_name(&self) -> NameRef {
self.instance.catalog_manager.default_catalog_name()
}

async fn maybe_forward_prom_remote_query(
&self,
metric: String,
Expand Down
Loading

0 comments on commit dcae0e0

Please sign in to comment.