Skip to content

Commit

Permalink
feat: add flownode_peer_cache to Inserter
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyXu committed Jul 2, 2024
1 parent 9cb55cd commit cc3b9f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/frontend/src/instance/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,13 @@ impl FrontendBuilder {
.context(error::CacheRequiredSnafu {
name: TABLE_FLOWNODE_SET_CACHE_NAME,
})?;
let flownode_peer_cache = self.layered_cache_registry.get();
let inserter = Arc::new(Inserter::new(
self.catalog_manager.clone(),
partition_manager.clone(),
node_manager.clone(),
table_flownode_cache,
flownode_peer_cache,
));
let deleter = Arc::new(Deleter::new(
self.catalog_manager.clone(),
Expand Down
7 changes: 6 additions & 1 deletion src/operator/src/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use catalog::CatalogManagerRef;
use client::{OutputData, OutputMeta};
use common_catalog::consts::default_engine;
use common_grpc_expr::util::{extract_new_columns, ColumnExpr};
use common_meta::cache::TableFlownodeSetCacheRef;
use common_meta::cache::{FlownodePeerCacheRef, TableFlownodeSetCacheRef};
use common_meta::node_manager::{AffectedRows, NodeManagerRef};
use common_meta::peer::Peer;
use common_query::prelude::{GREPTIME_TIMESTAMP, GREPTIME_VALUE};
Expand Down Expand Up @@ -62,6 +62,9 @@ pub struct Inserter {
partition_manager: PartitionRuleManagerRef,
node_manager: NodeManagerRef,
table_flownode_set_cache: TableFlownodeSetCacheRef,
/// Only available in cluster mode, it not necessary to query peer info in standalone mode.
#[allow(dead_code)]
flownode_peer_cache: Option<FlownodePeerCacheRef>,
}

pub type InserterRef = Arc<Inserter>;
Expand All @@ -88,12 +91,14 @@ impl Inserter {
partition_manager: PartitionRuleManagerRef,
node_manager: NodeManagerRef,
table_flownode_set_cache: TableFlownodeSetCacheRef,
flownode_peer_cache: Option<FlownodePeerCacheRef>,
) -> Self {
Self {
catalog_manager,
partition_manager,
node_manager,
table_flownode_set_cache,
flownode_peer_cache,
}
}

Expand Down

0 comments on commit cc3b9f1

Please sign in to comment.