Skip to content

Commit f5e564f

Browse files
committed
default_policy: debug print fixed seed
It sometimes happens that a test with a random seed fails (especially in the CI). With this debug print and previous commits enabling tracing capturing, debugging such a case should be easier now.
1 parent f836723 commit f5e564f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

scylla/src/transport/load_balancing/default.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rand::{prelude::SliceRandom, thread_rng, Rng};
1111
use rand_pcg::Pcg32;
1212
use scylla_cql::{errors::QueryError, frame::types::SerialConsistency, Consistency};
1313
use std::{fmt, sync::Arc, time::Duration};
14-
use tracing::warn;
14+
use tracing::{debug, warn};
1515

1616
#[derive(Clone, Copy)]
1717
enum NodeLocationCriteria<'a> {
@@ -735,7 +735,11 @@ impl DefaultPolicyBuilder {
735735
permit_dc_failover: self.permit_dc_failover,
736736
pick_predicate,
737737
latency_awareness,
738-
fixed_seed: (!self.enable_replica_shuffle).then(rand::random),
738+
fixed_seed: (!self.enable_replica_shuffle).then(|| {
739+
let seed = rand::random();
740+
debug!("DefaultPolicy: setting fixed seed to {}", seed);
741+
seed
742+
}),
739743
})
740744
}
741745

0 commit comments

Comments
 (0)