Skip to content

Commit

Permalink
topology: match against NextRowError::...::DbError::Invalid
Browse files Browse the repository at this point in the history
Without this change, tests fail, because we propagate the error for
Cassandra clusters, instead of ignoring it.
  • Loading branch information
muzarski committed Jan 16, 2025
1 parent 3bb99cd commit dc72120
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions scylla/src/cluster/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//! - [CollectionType],
//!
use crate::client::pager::QueryPager;
use crate::client::pager::{NextPageError, NextRowError, QueryPager};
use crate::cluster::node::resolve_contact_points;
use crate::deserialize::DeserializeOwnedRow;
use crate::errors::{DbError, NewSessionError, QueryError, RequestAttemptError};
Expand Down Expand Up @@ -51,7 +51,7 @@ use uuid::Uuid;
use crate::cluster::node::{InternalKnownNode, NodeAddr, ResolvedContactPoint};
use crate::errors::{
KeyspaceStrategyError, KeyspacesMetadataError, MetadataError, PeersMetadataError,
ProtocolError, TablesMetadataError, UdtMetadataError, ViewsMetadataError,
ProtocolError, RequestError, TablesMetadataError, UdtMetadataError, ViewsMetadataError,
};

/// Allows to read current metadata from the cluster
Expand Down Expand Up @@ -1770,7 +1770,15 @@ async fn query_table_partitioners(
// that we are only interested in the ones resulting from non-existent table
// system_schema.scylla_tables.
// For more information please refer to https://github.com/scylladb/scylla-rust-driver/pull/349#discussion_r762050262
Err(QueryError::DbError(DbError::Invalid, _)) => Ok(HashMap::new()),
// FIXME 2: The specific error we expect here should appear in QueryError::NextRowError. Currently
// leaving match against both variants. This will be fixed, once `MetadataError` is further adjusted
// in a follow-up PR. The goal is to return MetadataError from all functions related to metadata fetch.
Err(QueryError::DbError(DbError::Invalid, _))
| Err(QueryError::NextRowError(NextRowError::NextPageError(
NextPageError::RequestFailure(RequestError::LastAttemptError(
RequestAttemptError::DbError(DbError::Invalid, _),
)),
))) => Ok(HashMap::new()),
result => result,
}
}
Expand Down

0 comments on commit dc72120

Please sign in to comment.