@@ -101,8 +101,8 @@ pub async fn init_services(conf: &InnerConfig, ee_mode: bool) -> Result<(), Main
101101async fn precheck_services ( conf : & InnerConfig ) -> Result < ( ) , MainError > {
102102 let make_error = || "failed to precheck" ;
103103
104- if conf. query . max_memory_limit_enabled {
105- let size = conf. query . max_server_memory_usage as i64 ;
104+ if conf. query . common . max_memory_limit_enabled {
105+ let size = conf. query . common . max_server_memory_usage as i64 ;
106106 info ! ( "Set memory limit: {}" , size) ;
107107 GLOBAL_MEM_STAT . set_limit ( size, false ) ;
108108 }
@@ -136,13 +136,13 @@ pub async fn start_services(conf: &InnerConfig) -> Result<(), MainError> {
136136 . with_context ( make_error) ?;
137137 info ! (
138138 "Databend query has been registered:{:?}/{:?} to metasrv:{:?}." ,
139- conf. query. warehouse_id, conf. query. cluster_id, conf. meta. endpoints
139+ conf. query. common . warehouse_id, conf. query. common . cluster_id, conf. meta. endpoints
140140 ) ;
141141 }
142142
143143 // RPC API service.
144144 {
145- let address = conf. query . flight_api_address . clone ( ) ;
145+ let address = conf. query . common . flight_api_address . clone ( ) ;
146146 let mut srv = FlightService :: create ( conf. clone ( ) ) . with_context ( make_error) ?;
147147 let listening = srv
148148 . start ( address. parse ( ) . with_context ( make_error) ?)
@@ -154,12 +154,12 @@ pub async fn start_services(conf: &InnerConfig) -> Result<(), MainError> {
154154
155155 // MySQL handler.
156156 {
157- let hostname = conf. query . mysql_handler_host . clone ( ) ;
158- let listening = format ! ( "{}:{}" , hostname, conf. query. mysql_handler_port) ;
159- let tcp_keepalive_timeout_secs = conf. query . mysql_handler_tcp_keepalive_timeout_secs ;
157+ let hostname = conf. query . common . mysql_handler_host . clone ( ) ;
158+ let listening = format ! ( "{}:{}" , hostname, conf. query. common . mysql_handler_port) ;
159+ let tcp_keepalive_timeout_secs = conf. query . common . mysql_handler_tcp_keepalive_timeout_secs ;
160160 let tls_config = MySQLTlsConfig :: new (
161- conf. query . mysql_tls_server_cert . clone ( ) ,
162- conf. query . mysql_tls_server_key . clone ( ) ,
161+ conf. query . common . mysql_tls_server_cert . clone ( ) ,
162+ conf. query . common . mysql_tls_server_key . clone ( ) ,
163163 ) ;
164164
165165 let mut handler = MySQLHandler :: create ( tcp_keepalive_timeout_secs, tls_config)
@@ -180,8 +180,11 @@ pub async fn start_services(conf: &InnerConfig) -> Result<(), MainError> {
180180
181181 // ClickHouse HTTP handler.
182182 {
183- let hostname = conf. query . clickhouse_http_handler_host . clone ( ) ;
184- let listening = format ! ( "{}:{}" , hostname, conf. query. clickhouse_http_handler_port) ;
183+ let hostname = conf. query . common . clickhouse_http_handler_host . clone ( ) ;
184+ let listening = format ! (
185+ "{}:{}" ,
186+ hostname, conf. query. common. clickhouse_http_handler_port
187+ ) ;
185188
186189 let mut srv = HttpHandler :: create ( HttpHandlerKind :: Clickhouse ) ;
187190 let listening = srv
@@ -199,8 +202,8 @@ pub async fn start_services(conf: &InnerConfig) -> Result<(), MainError> {
199202
200203 // Databend HTTP handler.
201204 {
202- let hostname = conf. query . http_handler_host . clone ( ) ;
203- let listening = format ! ( "{}:{}" , hostname, conf. query. http_handler_port) ;
205+ let hostname = conf. query . common . http_handler_host . clone ( ) ;
206+ let listening = format ! ( "{}:{}" , hostname, conf. query. common . http_handler_port) ;
204207
205208 let mut srv = HttpHandler :: create ( HttpHandlerKind :: Query ) ;
206209 let listening = srv
@@ -219,7 +222,7 @@ pub async fn start_services(conf: &InnerConfig) -> Result<(), MainError> {
219222 // Metric API service.
220223 {
221224 set_system_version ( "query" , DATABEND_GIT_SEMVER , VERGEN_GIT_SHA ) ;
222- let address = conf. query . metric_api_address . clone ( ) ;
225+ let address = conf. query . common . metric_api_address . clone ( ) ;
223226 let mut srv = MetricService :: create ( ) ;
224227 let listening = srv
225228 . start ( address. parse ( ) . with_context ( make_error) ?)
@@ -231,7 +234,7 @@ pub async fn start_services(conf: &InnerConfig) -> Result<(), MainError> {
231234
232235 // Admin HTTP API service.
233236 {
234- let address = conf. query . admin_api_address . clone ( ) ;
237+ let address = conf. query . common . admin_api_address . clone ( ) ;
235238 let mut srv = AdminService :: create ( conf) ;
236239 let listening = srv
237240 . start ( address. parse ( ) . with_context ( make_error) ?)
@@ -245,7 +248,7 @@ pub async fn start_services(conf: &InnerConfig) -> Result<(), MainError> {
245248 {
246249 let address = format ! (
247250 "{}:{}" ,
248- conf. query. flight_sql_handler_host, conf. query. flight_sql_handler_port
251+ conf. query. common . flight_sql_handler_host, conf. query. common . flight_sql_handler_port
249252 ) ;
250253 let mut srv =
251254 FlightSQLServer :: create ( conf. clone ( ) , & BUILD_INFO ) . with_context ( make_error) ?;
@@ -307,10 +310,10 @@ pub async fn start_services(conf: &InnerConfig) -> Result<(), MainError> {
307310 println ! ( ) ;
308311 println ! ( "Memory:" ) ;
309312 println ! ( " limit: {}" , {
310- if conf. query. max_memory_limit_enabled {
313+ if conf. query. common . max_memory_limit_enabled {
311314 format!(
312315 "Memory: server memory limit to {} (bytes)" ,
313- conf. query. max_server_memory_usage
316+ conf. query. common . max_server_memory_usage
314317 )
315318 } else {
316319 "unlimited" . to_string( )
@@ -336,10 +339,10 @@ pub async fn start_services(conf: &InnerConfig) -> Result<(), MainError> {
336339 println ! ( ) ;
337340 println ! ( "Storage: {}" , conf. storage. params) ;
338341 println ! ( "Disk cache:" ) ;
339- println ! ( " storage: {}" , conf. cache. data_cache_storage) ;
342+ println ! ( " storage: {:? }" , conf. cache. data_cache_storage) ;
340343 println ! ( " path: {:?}" , conf. cache. disk_cache_config) ;
341344 println ! (
342- " reload policy: {}" ,
345+ " reload policy: {:? }" ,
343346 conf. cache. data_cache_key_reload_policy
344347 ) ;
345348
@@ -368,38 +371,38 @@ pub async fn start_services(conf: &InnerConfig) -> Result<(), MainError> {
368371
369372 println ! ( ) ;
370373 println ! ( "Admin" ) ;
371- println ! ( " listened at {}" , conf. query. admin_api_address) ;
374+ println ! ( " listened at {}" , conf. query. common . admin_api_address) ;
372375 println ! ( "MySQL" ) ;
373376 println ! (
374377 " listened at {}:{}" ,
375- conf. query. mysql_handler_host, conf. query. mysql_handler_port
378+ conf. query. common . mysql_handler_host, conf. query. common . mysql_handler_port
376379 ) ;
377380 println ! (
378381 " connect via: mysql -u${{USER}} -p${{PASSWORD}} -h{} -P{}" ,
379- conf. query. mysql_handler_host, conf. query. mysql_handler_port
382+ conf. query. common . mysql_handler_host, conf. query. common . mysql_handler_port
380383 ) ;
381384 println ! ( "Databend" ) ;
382385 println ! (
383386 " listened at {}:{}" ,
384- conf. query. http_handler_host, conf. query. http_handler_port
387+ conf. query. common . http_handler_host, conf. query. common . http_handler_port
385388 ) ;
386389
387390 println ! (
388391 " usage with args: bendsql -u ${{USER}} -p ${{PASSWORD}} -h {} -P {}" ,
389- conf. query. http_handler_host, conf. query. http_handler_port
392+ conf. query. common . http_handler_host, conf. query. common . http_handler_port
390393 ) ;
391394
392395 println ! (
393396 " usage with dsn: bendsql --dsn \" databend://${{USER}}:${{PASSWORD}}@{}:{}?sslmode=disable\" " ,
394- conf. query. http_handler_host, conf. query. http_handler_port
397+ conf. query. common . http_handler_host, conf. query. common . http_handler_port
395398 ) ;
396399
397400 println ! (
398401 " http: {}" ,
399402 HttpHandlerKind :: Query . usage(
400403 format!(
401404 "{}:{}" ,
402- conf. query. http_handler_host, conf. query. http_handler_port
405+ conf. query. common . http_handler_host, conf. query. common . http_handler_port
403406 )
404407 . parse( )
405408 . with_context( make_error) ?
@@ -421,8 +424,9 @@ pub async fn start_services(conf: &InnerConfig) -> Result<(), MainError> {
421424 start_time. elapsed( ) . as_secs_f32( )
422425 ) ;
423426
424- let graceful_shutdown_timeout =
425- Some ( Duration :: from_millis ( conf. query . shutdown_wait_timeout_ms ) ) ;
427+ let graceful_shutdown_timeout = Some ( Duration :: from_millis (
428+ conf. query . common . shutdown_wait_timeout_ms ,
429+ ) ) ;
426430 shutdown_handle
427431 . wait_for_termination_request ( graceful_shutdown_timeout)
428432 . await ;
0 commit comments