Skip to content

Conversation

wprzytula
Copy link
Collaborator

This adds a new API function to the driver: cass_cluster_set_metadata_request_serverside_timeout. This function allows users to set a server-side timeout for metadata queries, which is particularly useful for large schemas where the default timeout may be too tight. The default timeout is set to 2 seconds (as in Rust Driver), and users can pass 0 to use the cluster's default timeout. This simply exposes the existing Rust Driver's API.

Fixes: #172

Pre-review checklist

  • I have split my patch into logically separate commits.
  • All commit messages clearly explain what they change and why.
  • PR description sums up the changes and reasons why they should be introduced.
  • [ ] I have implemented Rust unit tests for the features/changes introduced.
  • [ ] I have enabled appropriate tests in Makefile in {SCYLLA,CASSANDRA}_(NO_VALGRIND_)TEST_FILTER.
  • I added appropriate Fixes: annotations to PR description.

@wprzytula wprzytula self-assigned this Jul 29, 2025
@wprzytula wprzytula requested review from Copilot and Lorak-mmk July 29, 2025 08:44
@wprzytula wprzytula added this to the 1.0.0 milestone Jul 29, 2025
@wprzytula wprzytula changed the title implement API to specify metadata request timeout add API to specify metadata request timeout Jul 29, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a new API function to allow users to configure server-side timeouts for metadata queries in the Cassandra driver. This addresses issues with large schemas where the default timeout may be too restrictive.

  • Adds cass_cluster_set_metadata_request_serverside_timeout function to configure metadata query timeouts
  • Exposes existing Rust driver functionality through the C API
  • Sets default timeout to 2 seconds with option to use cluster default by passing 0

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
include/cassandra.h Adds public API declaration with documentation for the new timeout function
scylla-rust-wrapper/src/cluster.rs Implements the C function that sets metadata request timeout on the cluster configuration
scylla-rust-wrapper/src/api.rs Exports the new function in the public API module
Comments suppressed due to low confidence (1)

@wprzytula wprzytula force-pushed the expose-api-for-metadata-request-timeouts branch 2 times, most recently from 6cf974a to f3581c5 Compare July 29, 2025 08:51
Comment on lines +3100 to +3146
/**
* 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);


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.

This commit adds a new API function to the driver:
`cass_cluster_set_metadata_request_serverside_timeout`.
This function allows users to set a server-side timeout for metadata
queries, which is particularly useful for large schemas where the
default timeout may be too tight. The default timeout is set to
2 seconds (as in Rust Driver), and users can pass 0 to use the cluster's
default timeout. This simply exposes the existing Rust Driver's API.

Fixes: scylladb#172
@wprzytula wprzytula force-pushed the expose-api-for-metadata-request-timeouts branch from f3581c5 to 59a11f6 Compare August 5, 2025 15:15
@wprzytula wprzytula requested a review from Lorak-mmk August 5, 2025 15:15
@wprzytula wprzytula merged commit fa3f7d7 into scylladb:master Aug 5, 2025
8 of 9 checks passed
@wprzytula wprzytula deleted the expose-api-for-metadata-request-timeouts branch August 5, 2025 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Decouple schema fetch queries from server-side timeouts
2 participants