Skip to content

Commit

Permalink
topology: skip invalid peers instead of failing
Browse files Browse the repository at this point in the history
It appears that in some clusters there sometimes emerges a transient
state that there are some incomplete/invalid peer entries in system
tables. Under such circumstances, the driver would throw an error and
fail the metadata refresh altogether, eventually leading to critical
conditions such as no hosts to query.
To fix this in line with how other drivers approach this, a warning is
emitted upon invalid peer entry read, and the entry is skipped with no
error returned.
  • Loading branch information
wprzytula committed Jul 29, 2024
1 parent 21ef1f4 commit fa2c2ed
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions scylla/src/transport/topology.rs
Original file line number Diff line number Diff line change
Expand Up @@ -819,10 +819,16 @@ async fn query_peers(conn: &Arc<Connection>, connect_port: u16) -> Result<Vec<Pe

let translated_peers_futures = untranslated_rows.map(|row_result| async {
let (source, raw_row) = row_result?;
let row = raw_row.into_typed().map_err(|_| {
QueryError::ProtocolError("system.peers or system.local has invalid column type")
})?;
create_peer_from_row(source, row, local_address).await
match raw_row.into_typed() {
Ok(row) => create_peer_from_row(source, row, local_address).await,
Err(err) => {
warn!(
"system.peers or system.local has an invalid row, skipping it: {}",
err
);
Ok(None)
}
}
});

let peers = translated_peers_futures
Expand Down

0 comments on commit fa2c2ed

Please sign in to comment.