-
Notifications
You must be signed in to change notification settings - Fork 204
Store tester stability #2060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Store tester stability #2060
Changes from all commits
b39b709
1d802c3
ed8f5d7
f2c36b6
a243223
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -332,7 +332,7 @@ impl RedisStore { | |
| async fn get_client(&'_ self) -> Result<ClientWithPermit<'_>, Error> { | ||
| let client = self.client_pool.next(); | ||
| let config = client.client_config(); | ||
| if config.mocks.is_none() { | ||
| if config.mocks.is_none() && !client.is_connected() { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This means Fred isn't logging every time we call this |
||
| client.wait_for_connect().await.err_tip(|| | ||
| format!( | ||
| "Connection issue connecting to redis server with hosts: {:?}, username: {}, database: {}", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| use core::sync::atomic::{AtomicUsize, Ordering}; | ||
| use std::borrow::Cow; | ||
| use std::env; | ||
| use std::sync::{Arc, RwLock}; | ||
| use std::{env, thread, usize}; | ||
|
|
||
| use bytes::Bytes; | ||
| use nativelink_config::stores::RedisSpec; | ||
|
|
@@ -86,11 +86,20 @@ fn main() -> Result<(), Box<dyn core::error::Error>> { | |
| .unwrap_or_else(|_| "2000000".to_string()) | ||
| .parse()?; | ||
|
|
||
| // Cap the max threads at 1/2 of the system max allowed, so Redis still has some | ||
| // CPU available. Make sure we've got at least one available! | ||
| let max_threads = { | ||
| let raw = thread::available_parallelism()?; | ||
| let halved = raw.get() / 2; | ||
| halved.clamp(1, usize::MAX) | ||
| }; | ||
|
|
||
| #[expect( | ||
| clippy::disallowed_methods, | ||
| reason = "`We need `tokio::runtime::Runtime::block_on` so we can get errors _after_ threads finished" | ||
| )] | ||
| tokio::runtime::Builder::new_multi_thread() | ||
| .worker_threads(max_threads) | ||
| .enable_all() | ||
| .build() | ||
| .unwrap() | ||
|
|
@@ -100,6 +109,8 @@ fn main() -> Result<(), Box<dyn core::error::Error>> { | |
| .await? | ||
| .expect("Init tracing should work"); | ||
|
|
||
| info!(max_threads, "Starting runner"); | ||
|
|
||
| let spec = RedisSpec { | ||
| addresses: vec![format!("redis://{redis_host}:6379/")], | ||
| connection_timeout_ms: 1000, | ||
|
|
@@ -174,7 +185,7 @@ fn main() -> Result<(), Box<dyn core::error::Error>> { | |
|
|
||
| let res = store_clone.get_and_decode(data.clone()).await?; | ||
| if let Some(existing_data) = res { | ||
| data.version = existing_data.version + 1; | ||
| data.version = existing_data.version; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't realize we tried to hack optimistic locking here. This change should prevent race conditions if the version was already up to date. Have you verified that this does not break the update logic of your tester? |
||
| } | ||
|
|
||
| store_clone.update_data(data).await?; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?