Skip to content

Commit

Permalink
connection: log sharding error
Browse files Browse the repository at this point in the history
I chose INFO log level in case ALL parameters are missing (no sharding info provided).
WARN otherwise - in case there was some failure in parsing the sharding info.
  • Loading branch information
muzarski committed Jan 27, 2025
1 parent e379289 commit ea19dec
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions scylla/src/network/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use crate::response::{
NonErrorAuthResponse, NonErrorStartupResponse, PagingState, PagingStateResponse, QueryResponse,
};
use crate::routing::locator::tablets::{RawTablet, TabletParsingError};
use crate::routing::{Shard, ShardInfo, Sharder};
use crate::routing::{Shard, ShardInfo, Sharder, ShardingError};
use crate::statement::prepared_statement::PreparedStatement;
use crate::statement::{Consistency, PageSize};
use bytes::Bytes;
Expand Down Expand Up @@ -1848,7 +1848,23 @@ pub(super) async fn open_connection(
};

// If this is ScyllaDB that we connected to, we received sharding information.
let shard_info = ShardInfo::try_from(&supported.options).ok();
let shard_info = match ShardInfo::try_from(&supported.options) {
Ok(info) => Some(info),
Err(ShardingError::NoShardInfo) => {
tracing::info!(
"[{}] No sharding information received. Continuing with no sharding info.",
addr
);
None
}
Err(e) => {
tracing::warn!(
"[{}] Error while parsing sharding information: {}. Continuing with no sharding info.",
addr, e
);
None
}
};
let supported_compression = supported
.options
.remove(options::COMPRESSION)
Expand Down

0 comments on commit ea19dec

Please sign in to comment.