fix: Fail if compactor shard args are invalid before contacting the catalog

Fail fast if we know the shard config is invalid, without possibly
failing while contacting the catalog.

Also, fetching of the transition shard ID is going to go away soon
anyway.
pull/24376/head
Carol (Nichols || Goulding) 2023-03-20 16:41:31 -04:00
parent 635b22b5a9
commit 12974cf426
No known key found for this signature in database
GPG Key ID: E907EE5A736F87D4
1 changed files with 7 additions and 7 deletions

View File

@ -141,13 +141,6 @@ pub async fn create_compactor2_server_type(
compactor_config: Compactor2Config,
) -> Arc<dyn ServerType> {
let backoff_config = BackoffConfig::default();
let shard_id = Config::fetch_shard_id(
Arc::clone(&catalog),
backoff_config.clone(),
TOPIC.to_string(),
TRANSITION_SHARD_INDEX,
)
.await;
assert!(
compactor_config.shard_id.is_some() == compactor_config.shard_count.is_some(),
@ -172,6 +165,13 @@ pub async fn create_compactor2_server_type(
),
};
let shard_id = Config::fetch_shard_id(
Arc::clone(&catalog),
backoff_config.clone(),
TOPIC.to_string(),
TRANSITION_SHARD_INDEX,
)
.await;
let compactor = Compactor2::start(Config {
shard_id,
metric_registry: Arc::clone(&metric_registry),