Skip to content

Commit 1362b2c

Browse files
committed
connection: log sharding error
I chose INFO log level in case ALL parameters are missing (no sharding info provided). ERROR otherwise - in case there was some failure in parsing the sharding info.
1 parent e379289 commit 1362b2c

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

scylla/src/network/connection.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use crate::response::{
2929
NonErrorAuthResponse, NonErrorStartupResponse, PagingState, PagingStateResponse, QueryResponse,
3030
};
3131
use crate::routing::locator::tablets::{RawTablet, TabletParsingError};
32-
use crate::routing::{Shard, ShardInfo, Sharder};
32+
use crate::routing::{Shard, ShardInfo, Sharder, ShardingError};
3333
use crate::statement::prepared_statement::PreparedStatement;
3434
use crate::statement::{Consistency, PageSize};
3535
use bytes::Bytes;
@@ -1848,7 +1848,23 @@ pub(super) async fn open_connection(
18481848
};
18491849

18501850
// If this is ScyllaDB that we connected to, we received sharding information.
1851-
let shard_info = ShardInfo::try_from(&supported.options).ok();
1851+
let shard_info = match ShardInfo::try_from(&supported.options) {
1852+
Ok(info) => Some(info),
1853+
Err(ShardingError::NoShardInfo) => {
1854+
tracing::info!(
1855+
"[{}] No sharding information received. Proceeding with no sharding info.",
1856+
addr
1857+
);
1858+
None
1859+
}
1860+
Err(e) => {
1861+
tracing::error!(
1862+
"[{}] Error while parsing sharding information: {}. Proceeding with no sharding info.",
1863+
addr, e
1864+
);
1865+
None
1866+
}
1867+
};
18521868
let supported_compression = supported
18531869
.options
18541870
.remove(options::COMPRESSION)

0 commit comments

Comments
 (0)