Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the need for metadata db in eventhub group peer #983

Merged
merged 4 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions nexus/analyzer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,11 +663,8 @@ fn parse_db_options(
Some(config)
}
DbType::Eventhub => {
let conn_str: String = opts
.get("metadata_db")
.map(|s| s.to_string())
.unwrap_or_default();
let metadata_db = parse_metadata_db_info(&conn_str)?;
let conn_str = opts.get("metadata_db");
let metadata_db = parse_metadata_db_info(conn_str.copied())?;
let subscription_id = opts
.get("subscription_id")
.map(|s| s.to_string())
Expand Down Expand Up @@ -711,11 +708,8 @@ fn parse_db_options(
Some(config)
}
DbType::S3 => {
let s3_conn_str: String = opts
.get("metadata_db")
.map(|s| s.to_string())
.unwrap_or_default();
let metadata_db = parse_metadata_db_info(&s3_conn_str)?;
let s3_conn_str = opts.get("metadata_db");
let metadata_db = parse_metadata_db_info(s3_conn_str.copied())?;
let s3_config = S3Config {
url: opts
.get("url")
Expand Down Expand Up @@ -754,10 +748,8 @@ fn parse_db_options(
Some(config)
}
DbType::EventhubGroup => {
let conn_str = opts
.get("metadata_db")
.context("no metadata db specified")?;
let metadata_db = parse_metadata_db_info(conn_str)?;
let conn_str = opts.get("metadata_db");
let metadata_db = parse_metadata_db_info(conn_str.copied())?;

// metadata_db is required for eventhub group
if metadata_db.is_none() {
Expand Down Expand Up @@ -808,7 +800,12 @@ fn parse_db_options(
Ok(config)
}

fn parse_metadata_db_info(conn_str: &str) -> anyhow::Result<Option<PostgresConfig>> {
fn parse_metadata_db_info(conn_str: Option<&str>) -> anyhow::Result<Option<PostgresConfig>> {
let conn_str = match conn_str {
Some(conn_str) => conn_str,
None => return Ok(None),
};

if conn_str.is_empty() {
return Ok(None);
}
Expand Down
2 changes: 1 addition & 1 deletion nexus/flow-rs/src/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl FlowGrpcClient {
requested_flow_state: state.into(),
source_peer: Some(workflow_details.source_peer),
destination_peer: Some(workflow_details.destination_peer),
flow_state_update: None
flow_state_update: None,
};
let response = self.client.flow_state_change(state_change_req).await?;
let state_change_response = response.into_inner();
Expand Down
Loading