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
21 changes: 21 additions & 0 deletions include/cassandra.h
Original file line number Diff line number Diff line change
Expand Up @@ -3124,6 +3124,27 @@ CASS_EXPORT void
cass_cluster_set_compression(CassCluster* cluster,
CassCompressionType compression_type);

/**
* Sets the server-side timeout for metadata queries.
*
* It means that all metadata queries will be set the given timeout
* no matter what timeout is set as a cluster default.
* This prevents timeouts of schema queries when the schema is large
* and the default timeout is configured as tight.
*
* <b>Default:</b> 2 seconds.
*
* @public @memberof CassCluster
*
* @param[in] cluster
* @param[in] timeout_ms Request timeout in milliseconds. Pass 0 to use cluster default timeout.
*/
CASS_EXPORT void
cass_cluster_set_metadata_request_serverside_timeout(CassCluster* cluster,
cass_duration_t timeout_ms);


Comment on lines +3127 to +3146
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a dedicated setting for metadata client-side timeout?
If so, can we make it that:

  • Default for server-side timeout is client-side timeout (perhaps with a slight reduction)
  • There is a warning if users sets server-side higher than client-side?

If not, what client-side timeout is used? Can the above points apply to it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is there a dedicated setting for metadata client-side timeout?

No.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If not, what client-side timeout is used?

As with the other settings configured on execution profiles and on statements directly, the hierarchy is as follows:

statement > execution profile > cluster

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can the above points apply to it?

I'm not sure I understand.


/***********************************************************************************
*
* Session
Expand Down
3 changes: 2 additions & 1 deletion scylla-rust-wrapper/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ pub mod cluster {
// cass_cluster_set_max_connections_per_host, UNIMPLEMENTED
// cass_cluster_set_max_requests_per_flush, UNIMPLEMENTED
// cass_cluster_set_max_reusable_write_objects, UNIMPLEMENTED
// cass_cluster_set_monitor_reporting_interval, UNIMPLEMENTED
cass_cluster_set_max_schema_wait_time,
cass_cluster_set_metadata_request_serverside_timeout,
// cass_cluster_set_monitor_reporting_interval, UNIMPLEMENTED
// cass_cluster_set_new_request_ratio, UNIMPLEMENTED
// cass_cluster_set_no_compact, UNIMPLEMENTED
cass_cluster_set_no_speculative_execution_policy,
Expand Down
20 changes: 20 additions & 0 deletions scylla-rust-wrapper/src/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1570,6 +1570,26 @@ pub unsafe extern "C" fn cass_cluster_set_num_threads_io(
CassError::CASS_OK
}

#[unsafe(no_mangle)]
pub unsafe extern "C" fn cass_cluster_set_metadata_request_serverside_timeout(
cluster: CassBorrowedExclusivePtr<CassCluster, CMut>,
timeout_ms: cass_duration_t,
) {
let Some(cluster_from_raw) = BoxFFI::as_mut_ref(cluster) else {
tracing::error!(
"Provided null cluster pointer to cass_cluster_set_metadata_request_serverside_timeout!"
);
return;
};

let metadata_request_timeout = (timeout_ms > 0).then(|| Duration::from_millis(timeout_ms));

cluster_from_raw
.session_builder
.config
.metadata_request_serverside_timeout = metadata_request_timeout;
}

#[cfg(test)]
mod tests {
use crate::testing::{assert_cass_error_eq, setup_tracing};
Expand Down
Loading