Skip to content

Commit

Permalink
Merge pull request scylladb#966 from Lorak-mmk/fix-tracing-defaults
Browse files Browse the repository at this point in the history
session_test: Increase tracing info timeout
  • Loading branch information
wprzytula authored Mar 19, 2024
2 parents cf0b1cd + c70faec commit 9634a0f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scylla/src/transport/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ impl SessionConfig {
#[cfg(feature = "cloud")]
cloud_config: None,
enable_write_coalescing: true,
tracing_info_fetch_attempts: NonZeroU32::new(5).unwrap(),
tracing_info_fetch_attempts: NonZeroU32::new(10).unwrap(),
tracing_info_fetch_interval: Duration::from_millis(3),
tracing_info_fetch_consistency: Consistency::One,
cluster_metadata_refresh_interval: Duration::from_secs(60),
Expand Down
8 changes: 8 additions & 0 deletions scylla/src/transport/session_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,10 @@ impl<K: SessionBuilderKind> GenericSessionBuilder<K> {
/// Tracing info might not be available immediately on queried node - that's why
/// the driver performs a few attempts with sleeps in between.
///
/// Cassandra users may want to increase this value - the default is good
/// for Scylla, but Cassandra sometimes needs more time for the data to
/// appear in tracing table.
///
/// # Example
/// ```
/// # use scylla::{Session, SessionBuilder};
Expand All @@ -841,6 +845,10 @@ impl<K: SessionBuilderKind> GenericSessionBuilder<K> {
/// Tracing info might not be available immediately on queried node - that's why
/// the driver performs a few attempts with sleeps in between.
///
/// Cassandra users may want to increase this value - the default is good
/// for Scylla, but Cassandra sometimes needs more time for the data to
/// appear in tracing table.
///
/// # Example
/// ```
/// # use scylla::{Session, SessionBuilder};
Expand Down
8 changes: 6 additions & 2 deletions scylla/src/transport/session_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,11 @@ async fn assert_in_tracing_table(session: &Session, tracing_uuid: Uuid) {
// Tracing info might not be immediately available
// If rows are empty perform 8 retries with a 32ms wait in between

for _ in 0..8 {
// The reason why we enable so long waiting for TracingInfo is... Cassandra. (Yes, again.)
// In Cassandra Java Driver, the wait time for tracing info is 10 seconds, so here we do the same.
// However, as Scylla usually gets TracingInfo ready really fast (our default interval is hence 3ms),
// we stick to a not-so-much-terribly-long interval here.
for _ in 0..200 {
let rows_num = session
.query(traces_query.clone(), (tracing_uuid,))
.await
Expand All @@ -1068,7 +1072,7 @@ async fn assert_in_tracing_table(session: &Session, tracing_uuid: Uuid) {
}

// Otherwise retry
tokio::time::sleep(std::time::Duration::from_millis(32)).await;
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
}

// If all retries failed panic with an error
Expand Down
4 changes: 2 additions & 2 deletions scylla/src/utils/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ pub fn create_new_session_builder() -> GenericSessionBuilder<impl SessionBuilder
// However, as Scylla usually gets TracingInfo ready really fast (our default interval is hence 3ms),
// we stick to a not-so-much-terribly-long interval here.
session_builder
.tracing_info_fetch_attempts(NonZeroU32::new(50).unwrap())
.tracing_info_fetch_interval(Duration::from_millis(200))
.tracing_info_fetch_attempts(NonZeroU32::new(200).unwrap())
.tracing_info_fetch_interval(Duration::from_millis(50))
}

#[cfg(test)]
Expand Down

0 comments on commit 9634a0f

Please sign in to comment.