Skip to content

Commit b7e8ec5

Browse files
committed
topology: match against NextRowError::...::DbError::Invalid
This change is required for the tests to pass after next commit. The next commit causes the DbError in topology code to be placed under QueryError::NextRowError. Without this change, tests fail, because we propagate the error for Cassandra clusters, instead of ignoring it.
1 parent f3b10ef commit b7e8ec5

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

scylla/src/cluster/metadata.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//! - [CollectionType],
1717
//!
1818
19-
use crate::client::pager::QueryPager;
19+
use crate::client::pager::{NextPageError, NextRowError, QueryPager};
2020
use crate::cluster::node::resolve_contact_points;
2121
use crate::deserialize::DeserializeOwnedRow;
2222
use crate::errors::{DbError, NewSessionError, QueryError, RequestAttemptError};
@@ -52,7 +52,7 @@ use uuid::Uuid;
5252
use crate::cluster::node::{InternalKnownNode, NodeAddr, ResolvedContactPoint};
5353
use crate::errors::{
5454
KeyspaceStrategyError, KeyspacesMetadataError, MetadataError, PeersMetadataError,
55-
ProtocolError, TablesMetadataError, UdtMetadataError, ViewsMetadataError,
55+
ProtocolError, RequestError, TablesMetadataError, UdtMetadataError, ViewsMetadataError,
5656
};
5757

5858
type PerKeyspace<T> = HashMap<String, T>;
@@ -1874,7 +1874,15 @@ async fn query_table_partitioners(
18741874
// that we are only interested in the ones resulting from non-existent table
18751875
// system_schema.scylla_tables.
18761876
// For more information please refer to https://github.com/scylladb/scylla-rust-driver/pull/349#discussion_r762050262
1877-
Err(QueryError::DbError(DbError::Invalid, _)) => Ok(HashMap::new()),
1877+
// FIXME 2: The specific error we expect here should appear in QueryError::NextRowError. Currently
1878+
// leaving match against both variants. This will be fixed, once `MetadataError` is further adjusted
1879+
// in a follow-up PR. The goal is to return MetadataError from all functions related to metadata fetch.
1880+
Err(QueryError::DbError(DbError::Invalid, _))
1881+
| Err(QueryError::NextRowError(NextRowError::NextPageError(
1882+
NextPageError::RequestFailure(RequestError::LastAttemptError(
1883+
RequestAttemptError::DbError(DbError::Invalid, _),
1884+
)),
1885+
))) => Ok(HashMap::new()),
18781886
result => result,
18791887
}
18801888
}

0 commit comments

Comments
 (0)