From dd3147c2ecc8d33ef5794416a7fb249e9107ece9 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Sun, 1 May 2022 16:20:16 -0400 Subject: [PATCH] fix: allow `--grpc-bind` and `--api-bind` args in all-in-one mode (#4494) * fix: allow `--grpc-bind` and `--api-bind` args in all-in-one mode * fix: shutdown compactor more quickly on cancel Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- compactor/src/handler.rs | 10 +++++++--- influxdb_iox/src/commands/run/all_in_one.rs | 4 ++++ ioxd_compactor/src/lib.rs | 1 - 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/compactor/src/handler.rs b/compactor/src/handler.rs index 2deb2df819..f10fb89d27 100644 --- a/compactor/src/handler.rs +++ b/compactor/src/handler.rs @@ -5,7 +5,7 @@ use backoff::{Backoff, BackoffConfig}; use data_types2::SequencerId; use futures::{ future::{BoxFuture, Shared}, - FutureExt, TryFutureExt, + select, FutureExt, TryFutureExt, }; use iox_catalog::interface::Catalog; use iox_time::TimeProvider; @@ -198,9 +198,13 @@ async fn run_compactor(compactor: Arc, shutdown: CancellationToken) { let _ = futures::future::join_all(handles).await; - // if all candidate partitions have been compacted, wait a bit before checking again + // if all candidate partitions have been compacted, wait a bit + // before checking again, but don'skip sleeping if cancel arrives if compactions_run == n_candidates { - tokio::time::sleep(Duration::from_secs(5)).await; + select! { + () = tokio::time::sleep(Duration::from_secs(5)).fuse() => {}, + () = shutdown.cancelled().fuse() => {} + } } } } diff --git a/influxdb_iox/src/commands/run/all_in_one.rs b/influxdb_iox/src/commands/run/all_in_one.rs index 1d1007bd61..58fca31f2e 100644 --- a/influxdb_iox/src/commands/run/all_in_one.rs +++ b/influxdb_iox/src/commands/run/all_in_one.rs @@ -228,6 +228,8 @@ pub struct Config { /// The address on which IOx will serve Router HTTP API requests #[clap( long = "--router-http-bind", + // by default, write API requests go to router + alias = "api-bind", env = "INFLUXDB_IOX_ROUTER_HTTP_BIND_ADDR", default_value = DEFAULT_ROUTER_HTTP_BIND_ADDR, )] @@ -244,6 +246,8 @@ pub struct Config { /// The address on which IOx will serve Querier gRPC API requests #[clap( long = "--querier-grpc-bind", + // by default, grpc requests go to querier + alias = "grpc-bind", env = "INFLUXDB_IOX_QUERIER_GRPC_BIND_ADDR", default_value = DEFAULT_QUERIER_GRPC_BIND_ADDR, )] diff --git a/ioxd_compactor/src/lib.rs b/ioxd_compactor/src/lib.rs index 47a659ae8b..ef2a038a36 100644 --- a/ioxd_compactor/src/lib.rs +++ b/ioxd_compactor/src/lib.rs @@ -85,7 +85,6 @@ impl ServerType for CompactorSe /// Provide a placeholder gRPC service. async fn server_grpc(self: Arc, builder_input: RpcBuilderInput) -> Result<(), RpcError> { let builder = setup_builder!(builder_input, self); - // TODO add a service here serve_builder!(builder); Ok(())