Skip to content

Commit 92afe8b

Browse files
committed
Update to rand 0.9.2
1 parent c0cdf39 commit 92afe8b

File tree

46 files changed

+204
-185
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+204
-185
lines changed

Cargo.lock

Lines changed: 20 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/adapter/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ opentelemetry = { version = "0.24.0", features = ["trace"] }
7777
prometheus = { version = "0.14.0", default-features = false }
7878
prost = { version = "0.13.5", features = ["no-recursion-limit"] }
7979
qcell = "0.5"
80-
rand = "0.8.5"
81-
rand_chacha = "0.3"
80+
rand = "0.9.2"
8281
semver = "1.0.27"
8382
serde = "1.0.219"
8483
serde_json = "1.0.145"

src/adapter/src/coord/message_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ impl Coordinator {
314314
EpochMillis::try_from(self.storage_usage_collection_interval.as_millis())
315315
.expect("storage usage collection interval must fit into u64");
316316
let offset =
317-
rngs::SmallRng::from_seed(seed).gen_range(0..storage_usage_collection_interval_ms);
317+
rngs::SmallRng::from_seed(seed).random_range(0..storage_usage_collection_interval_ms);
318318
let now_ts: EpochMillis = self.peek_local_write_ts().await.into();
319319

320320
// 2) Determine the amount of ms between now and the next collection time.

src/adapter/src/coord/statement_logging.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ use mz_sql_parser::ast::{StatementKind, statement_kind_label_value};
2626
use mz_storage_client::controller::IntrospectionType;
2727
use qcell::QCell;
2828
use rand::SeedableRng;
29-
use rand::{distributions::Bernoulli, prelude::Distribution, thread_rng};
29+
use rand::distr::{Bernoulli, Distribution};
30+
use rand::rngs::SmallRng;
3031
use sha2::{Digest, Sha256};
3132
use tokio::time::MissedTickBehavior;
3233
use tracing::debug;
@@ -138,9 +139,9 @@ pub(crate) struct StatementLogging {
138139
unlogged_sessions: BTreeMap<Uuid, SessionHistoryEvent>,
139140

140141
/// A reproducible RNG for deciding whether to sample statement executions.
141-
/// Only used by tests; otherwise, `rand::thread_rng()` is used.
142+
/// Only used by tests; otherwise, `rand::rng()` is used.
142143
/// Controlled by the system var `statement_logging_use_reproducible_rng`.
143-
reproducible_rng: rand_chacha::ChaCha8Rng,
144+
reproducible_rng: SmallRng,
144145

145146
pending_statement_execution_events: Vec<(Row, Diff)>,
146147
pending_prepared_statement_events: Vec<PreparedStatementEvent>,
@@ -165,7 +166,7 @@ impl StatementLogging {
165166
Self {
166167
executions_begun: BTreeMap::new(),
167168
unlogged_sessions: BTreeMap::new(),
168-
reproducible_rng: rand_chacha::ChaCha8Rng::seed_from_u64(42),
169+
reproducible_rng: SmallRng::seed_from_u64(42),
169170
pending_statement_execution_events: Vec::new(),
170171
pending_prepared_statement_events: Vec::new(),
171172
pending_session_events: Vec::new(),
@@ -697,7 +698,7 @@ impl Coordinator {
697698
{
698699
distribution.sample(&mut self.statement_logging.reproducible_rng)
699700
} else {
700-
distribution.sample(&mut thread_rng())
701+
distribution.sample(&mut rand::rng())
701702
};
702703

703704
// Track how many statements we're recording.

src/adapter/src/session.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ use mz_sql_parser::ast::TransactionIsolationLevel;
4747
use mz_storage_client::client::TableData;
4848
use mz_storage_types::sources::Timeline;
4949
use qcell::{QCell, QCellOwner};
50-
use rand::Rng;
5150
use tokio::sync::mpsc::{self, UnboundedReceiver, UnboundedSender};
5251
use tokio::sync::watch;
5352
use uuid::Uuid;
@@ -346,7 +345,7 @@ impl<T: TimestampManipulation> Session<T> {
346345
notices_tx,
347346
notices_rx,
348347
next_transaction_id: 0,
349-
secret_key: rand::thread_rng().r#gen(),
348+
secret_key: rand::random(),
350349
external_metadata_rx,
351350
qcell_owner: QCellOwner::new(),
352351
session_oracles: BTreeMap::new(),

src/avro/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ enum-kinds = "0.5.1"
2424
flate2 = "1.1.5"
2525
itertools = "0.14.0"
2626
mz-ore = { path = "../ore", features = ["test"] }
27-
rand = "0.8.5"
27+
rand = "0.9.2"
2828
regex = "1.12.2"
2929
serde = { version = "1.0.219", features = ["derive"] }
3030
serde_json = "1.0.145"

src/catalog/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ prometheus = { version = "0.14.0", default-features = false }
5656
proptest = { version = "1.7.0", default-features = false, features = ["std"] }
5757
proptest-derive = { version = "0.5.1", features = ["boxed_union"] }
5858
prost = "0.13.5"
59-
rand = "0.8.5"
59+
rand = "0.9.2"
6060
semver = { version = "1.0.27" }
6161
serde = "1.0.219"
6262
serde_json = "1.0.145"

src/cloud-resources/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ k8s-openapi = { version = "0.26.0", features = ["schemars", "v1_31"] }
1717
kube = { version = "2.0.1", default-features = false, features = ["client", "derive", "openssl-tls", "ws", "runtime"] }
1818
mz-ore = { path = "../ore", default-features = false, features = ["async"] }
1919
mz-server-core = { path = "../server-core", default-features = false }
20-
rand = "0.8.5"
20+
rand = "0.9.2"
2121
schemars = { version = "1.0.4", features = ["uuid1"] }
2222
semver = "1.0.27"
2323
serde = "1.0.219"

src/cloud-resources/src/crd/materialize.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use k8s_openapi::{
1818
};
1919
use kube::{CustomResource, Resource, ResourceExt, api::ObjectMeta};
2020
use rand::Rng;
21-
use rand::distributions::Uniform;
21+
use rand::distr::Uniform;
2222
use schemars::JsonSchema;
2323
use semver::Version;
2424
use serde::{Deserialize, Serialize};
@@ -491,8 +491,8 @@ pub mod v1alpha1 {
491491
// built-in Alphanumeric distribution from rand, which
492492
// includes both upper and lowercase letters.
493493
const CHARSET: &[u8] = b"abcdefghijklmnopqrstuvwxyz0123456789";
494-
status.resource_id = rand::thread_rng()
495-
.sample_iter(Uniform::new(0, CHARSET.len()))
494+
status.resource_id = rand::rng()
495+
.sample_iter(Uniform::new(0, CHARSET.len()).expect("valid range"))
496496
.take(10)
497497
.map(|i| char::from(CHARSET[i]))
498498
.collect();

src/cluster/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ lgalloc = "0.6.0"
1919
mz-cluster-client = { path = "../cluster-client" }
2020
mz-ore = { path = "../ore", features = ["async", "process", "tracing"] }
2121
mz-service = { path = "../service" }
22-
rand = "0.8.5"
22+
rand = "0.9.2"
2323
regex = "1.12.2"
2424
timely = "0.25.1"
2525
tokio = { version = "1.44.1", features = ["fs", "rt", "sync", "net"] }

0 commit comments

Comments
 (0)