Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/adapter/src/coord/peek.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ use crate::coord::timestamp_selection::TimestampDetermination;
use crate::optimize::OptimizerError;
use crate::statement_logging::WatchSetCreation;
use crate::statement_logging::{StatementEndedExecutionReason, StatementExecutionStrategy};
use crate::util::ResultExt;
use crate::{AdapterError, ExecuteContextGuard, ExecuteResponse};

/// A peek is a request to read data from a maintained arrangement.
Expand Down Expand Up @@ -851,7 +850,7 @@ impl crate::coord::Coordinator {
target_replica,
rows_tx,
)
.unwrap_or_terminate("cannot fail to peek");
.map_err(AdapterError::concurrent_dependency_drop_from_peek_error)?;

let duration_histogram = self.metrics.row_set_finishing_seconds();

Expand Down
35 changes: 28 additions & 7 deletions src/adapter/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use itertools::Itertools;
use mz_catalog::builtin::MZ_CATALOG_SERVER_CLUSTER;
use mz_compute_client::controller::error as compute_error;
use mz_compute_client::controller::error::{CollectionLookupError, InstanceMissing};
use mz_compute_client::controller::instance::PeekError;
use mz_compute_types::ComputeInstanceId;
use mz_expr::EvalError;
use mz_ore::error::ErrorExt;
Expand Down Expand Up @@ -719,21 +718,43 @@ impl AdapterError {
}
}

pub fn concurrent_dependency_drop_from_peek_error(
e: PeekError,
pub fn concurrent_dependency_drop_from_instance_peek_error(
e: mz_compute_client::controller::instance::PeekError,
Copy link
Contributor Author

@ggevay ggevay Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This one I just renamed and adjusted the imports, because now we have conversion functions for two different PeekError structs.)

compute_instance: ComputeInstanceId,
) -> AdapterError {
use mz_compute_client::controller::instance::PeekError::*;
match e {
PeekError::ReplicaMissing(id) => AdapterError::ConcurrentDependencyDrop {
ReplicaMissing(id) => AdapterError::ConcurrentDependencyDrop {
dependency_kind: "replica",
dependency_id: id.to_string(),
},
PeekError::InstanceShutDown => AdapterError::ConcurrentDependencyDrop {
InstanceShutDown => AdapterError::ConcurrentDependencyDrop {
dependency_kind: "cluster",
dependency_id: compute_instance.to_string(),
},
e @ PeekError::ReadHoldIdMismatch(_) => AdapterError::internal("peek error", e),
e @ PeekError::ReadHoldInsufficient(_) => AdapterError::internal("peek error", e),
e @ ReadHoldIdMismatch(_) => AdapterError::internal("instance peek error", e),
e @ ReadHoldInsufficient(_) => AdapterError::internal("instance peek error", e),
}
}

pub fn concurrent_dependency_drop_from_peek_error(
e: mz_compute_client::controller::error::PeekError,
) -> AdapterError {
use mz_compute_client::controller::error::PeekError::*;
match e {
InstanceMissing(id) => AdapterError::ConcurrentDependencyDrop {
dependency_kind: "cluster",
dependency_id: id.to_string(),
},
CollectionMissing(id) => AdapterError::ConcurrentDependencyDrop {
dependency_kind: "collection",
dependency_id: id.to_string(),
},
ReplicaMissing(id) => AdapterError::ConcurrentDependencyDrop {
dependency_kind: "replica",
dependency_id: id.to_string(),
},
e @ SinceViolation(_) => AdapterError::internal("peek error", e),
}
}

Expand Down
10 changes: 6 additions & 4 deletions src/adapter/src/peek_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,12 @@ impl PeekClient {
// The frontend will handle statement logging for the error.
self.call_coordinator(|tx| Command::UnregisterFrontendPeek { uuid, tx })
.await;
return Err(AdapterError::concurrent_dependency_drop_from_peek_error(
err,
compute_instance,
));
return Err(
AdapterError::concurrent_dependency_drop_from_instance_peek_error(
err,
compute_instance,
),
);
}

let peek_response_stream = Coordinator::create_peek_response_stream(
Expand Down