Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
253 changes: 236 additions & 17 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ progenitor = "0.13.0"
progenitor-client = "0.13.0"
proptest = "1.9.0"
rayon = "1.11.0"
rand = { version = "0.9.2", features = [ "small_rng"] }
rand_chacha = "0.9.0"
rand = "0.10.0"
rand_chacha = "0.10.0"
reedline = "0.43.0"
rangemap = "1.7.0"
reqwest = { version = "0.13", features = ["default", "blocking", "json", "stream"] }
Expand Down
4 changes: 2 additions & 2 deletions crutest/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ async fn rand_write(
/*
* TODO: Allow the user to specify a seed here.
*/
let mut rng = rand_chacha::ChaCha8Rng::from_os_rng();
let mut rng = rand::make_rng::<rand_chacha::ChaCha8Rng>();

/*
* Once we have our IO size, decide where the starting offset should
Expand Down Expand Up @@ -913,7 +913,7 @@ async fn process_cli_command(
}
CliMessage::RandRead => {
if let Some(di) = di_option {
let mut rng = rand_chacha::ChaCha8Rng::from_os_rng();
let mut rng = rand::make_rng::<rand_chacha::ChaCha8Rng>();
let size = 1;
let block_max = di.volume_info.total_blocks() - size + 1;
let offset = rng.random_range(0..block_max);
Expand Down
25 changes: 12 additions & 13 deletions crutest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use human_bytes::human_bytes;
use indicatif::{ProgressBar, ProgressStyle};
use oximeter::types::ProducerRegistry;
use rand::prelude::*;
use rand_chacha::rand_core::SeedableRng;
use serde::{Deserialize, Serialize};
use signal_hook::consts::signal::*;
use signal_hook_tokio::Signals;
Expand Down Expand Up @@ -2021,7 +2020,7 @@ async fn fill_sparse_workload(
volume: &Volume,
di: &mut DiskInfo,
) -> Result<()> {
let mut rng = rand_chacha::ChaCha8Rng::from_os_rng();
let mut rng = rand::make_rng::<rand_chacha::ChaCha8Rng>();

let mut extent_block_start = 0;
// We loop over all sub volumes, doing one write to each extent.
Expand Down Expand Up @@ -2073,7 +2072,7 @@ async fn generic_workload(
/*
* TODO: Allow the user to specify a seed here.
*/
let mut rng = rand_chacha::ChaCha8Rng::from_os_rng();
let mut rng = rand::make_rng::<rand_chacha::ChaCha8Rng>();

let count_width = match wtq {
WhenToQuit::Count { count } => count.to_string().len(),
Expand Down Expand Up @@ -2249,7 +2248,7 @@ async fn yolo_workload(
range: bool,
) -> Result<()> {
// TODO: Allow the user to specify a seed here.
let mut rng = rand_chacha::ChaCha8Rng::from_os_rng();
let mut rng = rand::make_rng::<rand_chacha::ChaCha8Rng>();

let total_blocks = di.volume_info.total_blocks();

Expand Down Expand Up @@ -2418,7 +2417,7 @@ async fn replay_workload(
dsc_client: Client,
ds_count: u32,
) -> Result<()> {
let mut rng = rand_chacha::ChaCha8Rng::from_os_rng();
let mut rng = rand::make_rng::<rand_chacha::ChaCha8Rng>();
let mut generic_wtq = WhenToQuit::Count { count: 300 };

for c in 1.. {
Expand Down Expand Up @@ -3013,7 +3012,7 @@ async fn dirty_workload(
/*
* TODO: Allow the user to specify a seed here.
*/
let mut rng = rand_chacha::ChaCha8Rng::from_os_rng();
let mut rng = rand::make_rng::<rand_chacha::ChaCha8Rng>();

/*
* To store our write requests
Expand Down Expand Up @@ -3150,7 +3149,7 @@ async fn rand_read_write_workload(
RandReadWriteMode::Write => {
let mut buf = BytesMut::new();
buf.resize(cfg.blocks_per_io * block_size, 0u8);
let mut rng = rand_chacha::ChaCha8Rng::from_os_rng();
let mut rng = rand::make_rng::<rand_chacha::ChaCha8Rng>();
rng.fill_bytes(&mut buf);
while !stop.load(Ordering::Acquire) {
let offset = rng
Expand All @@ -3164,7 +3163,7 @@ async fn rand_read_write_workload(
}
RandReadWriteMode::Read => {
let mut buf = Buffer::new(cfg.blocks_per_io, block_size);
let mut rng = rand_chacha::ChaCha8Rng::from_os_rng();
let mut rng = rand::make_rng::<rand_chacha::ChaCha8Rng>();
while !stop.load(Ordering::Acquire) {
let offset = rng
.random_range(0..=total_blocks - cfg.blocks_per_io);
Expand Down Expand Up @@ -3314,7 +3313,7 @@ async fn bufferbloat_workload(
let handle = tokio::spawn(async move {
let mut buf = BytesMut::new();
buf.resize(cfg.blocks_per_io * block_size, 0u8);
let mut rng = rand_chacha::ChaCha8Rng::from_os_rng();
let mut rng = rand::make_rng::<rand_chacha::ChaCha8Rng>();
rng.fill_bytes(&mut buf);
while !stop.load(Ordering::Acquire) {
let offset =
Expand Down Expand Up @@ -3391,7 +3390,7 @@ async fn one_workload(volume: &Volume, di: &mut DiskInfo) -> Result<()> {
/*
* TODO: Allow the user to specify a seed here.
*/
let mut rng = rand_chacha::ChaCha8Rng::from_os_rng();
let mut rng = rand::make_rng::<rand_chacha::ChaCha8Rng>();

/*
* Once we have our IO size, decide where the starting offset should
Expand Down Expand Up @@ -3525,7 +3524,7 @@ async fn write_flush_read_workload(
/*
* TODO: Allow the user to specify a seed here.
*/
let mut rng = rand_chacha::ChaCha8Rng::from_os_rng();
let mut rng = rand::make_rng::<rand_chacha::ChaCha8Rng>();

let count_width = count.to_string().len();
let block_size = di.volume_info.block_size;
Expand Down Expand Up @@ -3650,7 +3649,7 @@ async fn repair_workload(
di: &mut DiskInfo,
) -> Result<()> {
// TODO: Allow the user to specify a seed here.
let mut rng = rand_chacha::ChaCha8Rng::from_os_rng();
let mut rng = rand::make_rng::<rand_chacha::ChaCha8Rng>();

// TODO: Allow user to request r/w/f percentage (how???)
// We want at least one write, otherwise there will be nothing to
Expand Down Expand Up @@ -3761,7 +3760,7 @@ async fn demo_workload(
di: &mut DiskInfo,
) -> Result<()> {
// TODO: Allow the user to specify a seed here.
let mut rng = rand_chacha::ChaCha8Rng::from_os_rng();
let mut rng = rand::make_rng::<rand_chacha::ChaCha8Rng>();

// Because this workload issues a bunch of IO all at the same time,
// we can't be sure the order will be preserved for our IOs.
Expand Down
2 changes: 1 addition & 1 deletion downstairs/src/dynamometer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub fn dynamometer(

// Fill test: write bytes in whole region

let mut rng = SmallRng::from_os_rng();
let mut rng: SmallRng = rand::make_rng();

'outer: loop {
let block = (0..ddef.block_size() as usize)
Expand Down
2 changes: 1 addition & 1 deletion downstairs/src/extent_inner_sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ mod test {
use super::*;
use bytes::{Bytes, BytesMut};
use crucible_common::BlockOffset;
use rand::RngCore;
use rand::Rng;
use tempfile::tempdir;

const IOV_MAX_TEST: usize = 1000;
Expand Down
8 changes: 4 additions & 4 deletions downstairs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5253,7 +5253,7 @@ mod test {
let mut random_data = vec![0; total_bytes as usize];
random_data.resize(total_bytes as usize, 0);

let mut rng = ChaCha20Rng::from_os_rng();
let mut rng = rand::make_rng::<ChaCha20Rng>();
rng.fill_bytes(&mut random_data);

// write random_data to file
Expand Down Expand Up @@ -5321,7 +5321,7 @@ mod test {
let mut random_data = vec![0; total_bytes as usize];
random_data.resize(total_bytes as usize, 0);

let mut rng = ChaCha20Rng::from_os_rng();
let mut rng = rand::make_rng::<ChaCha20Rng>();
rng.fill_bytes(&mut random_data);

// write random_data to file
Expand Down Expand Up @@ -5403,7 +5403,7 @@ mod test {
let mut random_data = vec![0; total_bytes as usize];
random_data.resize(total_bytes as usize, 0);

let mut rng = ChaCha20Rng::from_os_rng();
let mut rng = rand::make_rng::<ChaCha20Rng>();
rng.fill_bytes(&mut random_data);

// write random_data to file
Expand Down Expand Up @@ -5486,7 +5486,7 @@ mod test {
let mut random_data = vec![0u8; total_bytes as usize];
random_data.resize(total_bytes as usize, 0u8);

let mut rng = ChaCha20Rng::from_os_rng();
let mut rng = rand::make_rng::<ChaCha20Rng>();
rng.fill_bytes(&mut random_data);

// write random_data to file
Expand Down
2 changes: 1 addition & 1 deletion downstairs/src/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,7 @@ pub(crate) mod test {
use std::fs::rename;
use std::path::PathBuf;

use rand::RngCore;
use rand::Rng;
use tempfile::tempdir;
use uuid::Uuid;

Expand Down
4 changes: 2 additions & 2 deletions dsc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ async fn do_dsc_work(
work: DscCmd,
action_tx_list: &[mpsc::Sender<DownstairsAction>],
) {
let mut rng = rand_chacha::ChaCha8Rng::from_os_rng();
let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(rand::random());

match work {
DscCmd::Start(cid) => {
Expand Down Expand Up @@ -979,7 +979,7 @@ async fn start_dsc(
}
}

let mut rng = rand_chacha::ChaCha8Rng::from_os_rng();
let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(rand::random());
let mut timeout_deadline = Instant::now() + Duration::from_secs(5);
let mut shutdown_sent = false;
let mut random_restart = false;
Expand Down
2 changes: 1 addition & 1 deletion hammer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ async fn main() -> Result<()> {
cpfs.push(crucible::CruciblePseudoFile::from(guest)?);
}

use rand::Rng;
use rand::RngExt;
let mut rng = rand::rng();

let rounds = 1500;
Expand Down
2 changes: 1 addition & 1 deletion measure_iops/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::sync::Arc;

use anyhow::{Result, bail};
use clap::Parser;
use rand::Rng;
use rand::RngExt;
use tokio::time::{Duration, Instant};
use uuid::Uuid;

Expand Down
2 changes: 1 addition & 1 deletion upstairs/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ impl UninitializedBuffer {
#[cfg(test)]
mod test {
use super::*;
use rand::RngCore;
use rand::Rng;

#[test]
fn test_buffer_sane() {
Expand Down
2 changes: 1 addition & 1 deletion upstairs/src/pseudo_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ impl<T: BlockIO> CruciblePseudoFile<T> {
#[cfg(test)]
mod test {
use super::*;
use rand::Rng;
use rand::RngExt;

#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_pseudo_file_sane() -> Result<()> {
Expand Down