Skip to content

Commit 9634a0f

Browse files
authored
Merge pull request #966 from Lorak-mmk/fix-tracing-defaults
session_test: Increase tracing info timeout
2 parents cf0b1cd + c70faec commit 9634a0f

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

scylla/src/transport/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ impl SessionConfig {
329329
#[cfg(feature = "cloud")]
330330
cloud_config: None,
331331
enable_write_coalescing: true,
332-
tracing_info_fetch_attempts: NonZeroU32::new(5).unwrap(),
332+
tracing_info_fetch_attempts: NonZeroU32::new(10).unwrap(),
333333
tracing_info_fetch_interval: Duration::from_millis(3),
334334
tracing_info_fetch_consistency: Consistency::One,
335335
cluster_metadata_refresh_interval: Duration::from_secs(60),

scylla/src/transport/session_builder.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,10 @@ impl<K: SessionBuilderKind> GenericSessionBuilder<K> {
816816
/// Tracing info might not be available immediately on queried node - that's why
817817
/// the driver performs a few attempts with sleeps in between.
818818
///
819+
/// Cassandra users may want to increase this value - the default is good
820+
/// for Scylla, but Cassandra sometimes needs more time for the data to
821+
/// appear in tracing table.
822+
///
819823
/// # Example
820824
/// ```
821825
/// # use scylla::{Session, SessionBuilder};
@@ -841,6 +845,10 @@ impl<K: SessionBuilderKind> GenericSessionBuilder<K> {
841845
/// Tracing info might not be available immediately on queried node - that's why
842846
/// the driver performs a few attempts with sleeps in between.
843847
///
848+
/// Cassandra users may want to increase this value - the default is good
849+
/// for Scylla, but Cassandra sometimes needs more time for the data to
850+
/// appear in tracing table.
851+
///
844852
/// # Example
845853
/// ```
846854
/// # use scylla::{Session, SessionBuilder};

scylla/src/transport/session_test.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,11 @@ async fn assert_in_tracing_table(session: &Session, tracing_uuid: Uuid) {
10541054
// Tracing info might not be immediately available
10551055
// If rows are empty perform 8 retries with a 32ms wait in between
10561056

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

10701074
// Otherwise retry
1071-
tokio::time::sleep(std::time::Duration::from_millis(32)).await;
1075+
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
10721076
}
10731077

10741078
// If all retries failed panic with an error

scylla/src/utils/test_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ pub fn create_new_session_builder() -> GenericSessionBuilder<impl SessionBuilder
8989
// However, as Scylla usually gets TracingInfo ready really fast (our default interval is hence 3ms),
9090
// we stick to a not-so-much-terribly-long interval here.
9191
session_builder
92-
.tracing_info_fetch_attempts(NonZeroU32::new(50).unwrap())
93-
.tracing_info_fetch_interval(Duration::from_millis(200))
92+
.tracing_info_fetch_attempts(NonZeroU32::new(200).unwrap())
93+
.tracing_info_fetch_interval(Duration::from_millis(50))
9494
}
9595

9696
#[cfg(test)]

0 commit comments

Comments
 (0)