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>
pull/24376/head
Andrew Lamb 2022-05-01 16:20:16 -04:00 committed by GitHub
parent fdc2f2fec8
commit dd3147c2ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -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<Compactor>, 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() => {}
}
}
}
}

View File

@ -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,
)]

View File

@ -85,7 +85,6 @@ impl<C: CompactorHandler + std::fmt::Debug + 'static> ServerType for CompactorSe
/// Provide a placeholder gRPC service.
async fn server_grpc(self: Arc<Self>, builder_input: RpcBuilderInput) -> Result<(), RpcError> {
let builder = setup_builder!(builder_input, self);
// TODO add a service here
serve_builder!(builder);
Ok(())