feat(router): configurable replication factor

This change allows the replication factor to be specified at runtime,
defaulting to "replication disabled".
pull/24376/head
Dom Dwyer 2023-03-23 17:46:31 +01:00
parent 125fef388c
commit feae0ce345
No known key found for this signature in database
GPG Key ID: E4C40DBD9157879A
2 changed files with 16 additions and 1 deletions

View File

@ -1,7 +1,10 @@
//! CLI config for the router using the RPC write path
use crate::ingester_address::IngesterAddress;
use std::{num::ParseIntError, time::Duration};
use std::{
num::{NonZeroUsize, ParseIntError},
time::Duration,
};
/// CLI config for the router using the RPC write path
#[derive(Debug, Clone, clap::Parser)]
@ -105,6 +108,17 @@ pub struct Router2Config {
value_parser = parse_duration
)]
pub rpc_write_timeout_seconds: Duration,
/// Specify the optional replication factor for each RPC write.
///
/// The total number of copies of data after replication will be this value,
/// plus 1.
///
/// If the desired replication level is not achieved, a partial write error
/// will be returned to the user. The write MAY be queryable after a partial
/// write failure.
#[clap(long = "rpc-write-replicas", env = "INFLUXDB_IOX_RPC_WRITE_REPLICAS")]
pub rpc_write_replicas: Option<NonZeroUsize>,
}
/// Map a string containing an integer number of seconds into a [`Duration`].

View File

@ -472,6 +472,7 @@ impl Config {
partition_key_pattern: "%Y-%m-%d".to_string(),
topic: QUERY_POOL_NAME.to_string(),
rpc_write_timeout_seconds: Duration::new(3, 0),
rpc_write_replicas: None,
};
// create a CompactorConfig for the all in one server based on