mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-06 13:22:57 +00:00
refactor: change how frontend grpc services are orchestrated (#3134)
This commit is contained in:
@@ -24,8 +24,6 @@ use catalog::kvbackend::KvBackendCatalogManager;
|
||||
use common_config::WalConfig;
|
||||
use common_meta::key::catalog_name::CatalogNameKey;
|
||||
use common_meta::key::schema_name::SchemaNameKey;
|
||||
use common_query::Output;
|
||||
use common_recordbatch::util;
|
||||
use common_runtime::Builder as RuntimeBuilder;
|
||||
use common_telemetry::warn;
|
||||
use common_test_util::ports;
|
||||
@@ -503,16 +501,19 @@ pub async fn setup_grpc_server_with(
|
||||
);
|
||||
|
||||
let fe_instance_ref = instance.instance.clone();
|
||||
let flight_handler = Arc::new(GreptimeRequestHandler::new(
|
||||
|
||||
let greptime_request_handler = GreptimeRequestHandler::new(
|
||||
ServerGrpcQueryHandlerAdapter::arc(fe_instance_ref.clone()),
|
||||
user_provider.clone(),
|
||||
runtime.clone(),
|
||||
));
|
||||
);
|
||||
|
||||
let flight_handler = Arc::new(greptime_request_handler.clone());
|
||||
|
||||
let fe_grpc_server = Arc::new(
|
||||
GrpcServerBuilder::new(runtime)
|
||||
.option_config(grpc_config)
|
||||
.query_handler(ServerGrpcQueryHandlerAdapter::arc(fe_instance_ref.clone()))
|
||||
.database_handler(greptime_request_handler)
|
||||
.flight_handler(flight_handler)
|
||||
.prometheus_handler(fe_instance_ref.clone())
|
||||
.user_provider(user_provider)
|
||||
@@ -532,16 +533,6 @@ pub async fn setup_grpc_server_with(
|
||||
(fe_grpc_addr, instance.guard, fe_grpc_server)
|
||||
}
|
||||
|
||||
pub async fn check_output_stream(output: Output, expected: &str) {
|
||||
let recordbatches = match output {
|
||||
Output::Stream(stream) => util::collect_batches(stream).await.unwrap(),
|
||||
Output::RecordBatches(recordbatches) => recordbatches,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let pretty_print = recordbatches.pretty_print().unwrap();
|
||||
assert_eq!(pretty_print, expected, "actual: \n{}", pretty_print);
|
||||
}
|
||||
|
||||
pub async fn setup_mysql_server(
|
||||
store_type: StorageType,
|
||||
name: &str,
|
||||
|
||||
@@ -19,6 +19,7 @@ use common_catalog::consts::DEFAULT_CATALOG_NAME;
|
||||
use common_query::Output;
|
||||
use common_recordbatch::util;
|
||||
use common_telemetry::logging;
|
||||
use common_test_util::recordbatch::check_output_stream;
|
||||
use common_test_util::temp_dir;
|
||||
use datatypes::vectors::{StringVector, TimestampMillisecondVector, UInt64Vector, VectorRef};
|
||||
use frontend::error::{Error, Result};
|
||||
@@ -29,7 +30,6 @@ use rstest_reuse::apply;
|
||||
use servers::query_handler::sql::SqlQueryHandler;
|
||||
use session::context::{QueryContext, QueryContextRef};
|
||||
|
||||
use crate::test_util::check_output_stream;
|
||||
use crate::tests::test_util::{
|
||||
both_instances_cases, both_instances_cases_with_custom_storages, check_unordered_output_stream,
|
||||
distributed, distributed_with_multiple_object_stores, find_testing_resource, prepare_path,
|
||||
|
||||
@@ -24,6 +24,7 @@ use common_meta::{distributed_time_constants, RegionIdent};
|
||||
use common_procedure::{watcher, ProcedureWithId};
|
||||
use common_query::Output;
|
||||
use common_telemetry::info;
|
||||
use common_test_util::recordbatch::check_output_stream;
|
||||
use frontend::error::Result as FrontendResult;
|
||||
use frontend::instance::Instance;
|
||||
use futures::TryStreamExt;
|
||||
@@ -35,7 +36,7 @@ use servers::query_handler::sql::SqlQueryHandler;
|
||||
use session::context::{QueryContext, QueryContextRef};
|
||||
use table::metadata::TableId;
|
||||
use tests_integration::cluster::{GreptimeDbCluster, GreptimeDbClusterBuilder};
|
||||
use tests_integration::test_util::{check_output_stream, get_test_store_config, StorageType};
|
||||
use tests_integration::test_util::{get_test_store_config, StorageType};
|
||||
use tokio::time;
|
||||
|
||||
#[macro_export]
|
||||
|
||||
@@ -24,6 +24,7 @@ use common_meta::wal::kafka::KafkaConfig as MetaKafkaConfig;
|
||||
use common_meta::wal::WalConfig as MetaWalConfig;
|
||||
use common_query::Output;
|
||||
use common_telemetry::info;
|
||||
use common_test_util::recordbatch::check_output_stream;
|
||||
use common_test_util::temp_dir::create_temp_dir;
|
||||
use frontend::error::Result as FrontendResult;
|
||||
use frontend::instance::Instance;
|
||||
@@ -37,9 +38,7 @@ use session::context::{QueryContext, QueryContextRef};
|
||||
use store_api::storage::RegionId;
|
||||
use table::metadata::TableId;
|
||||
use tests_integration::cluster::{GreptimeDbCluster, GreptimeDbClusterBuilder};
|
||||
use tests_integration::test_util::{
|
||||
check_output_stream, get_test_store_config, StorageType, PEER_PLACEHOLDER_ADDR,
|
||||
};
|
||||
use tests_integration::test_util::{get_test_store_config, StorageType, PEER_PLACEHOLDER_ADDR};
|
||||
use uuid::Uuid;
|
||||
|
||||
const TEST_TABLE_NAME: &str = "migration_target";
|
||||
|
||||
Reference in New Issue
Block a user