Skip to content

Commit

Permalink
Fix last batch of data sometimes getting dropped by logging client
Browse files Browse the repository at this point in the history
  • Loading branch information
cswinter committed May 12, 2024
1 parent 4d3a0c6 commit f16aff3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/logging_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ impl BackgroundWorker {
}
loop {
self.flush().await;
if self.request_data.lock().unwrap().is_none() {
if self.request_data.lock().unwrap().is_none() && self.events.lock().unwrap().tables.is_empty() {
break;
}
}
Expand Down
5 changes: 3 additions & 2 deletions tests/ingestion_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ async fn test_persist_meta_tables() {

#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_many_concurrent_requests() {
let timeout_duration = Duration::from_secs(30);
let timeout_duration = Duration::from_secs(120);
let _ = env_logger::builder().is_test(true).try_init();

let db_path: PathBuf = tempdir().unwrap().path().into();
Expand All @@ -324,6 +324,7 @@ async fn test_many_concurrent_requests() {
let port = 8891;
let (_, _handle) = create_locustdb(&opts, port);

// Some prior issued reproduced more consistently with tread_count=50
let thread_count = 20;
let value_count = 20000;
let sum = (0..value_count).map(|i| i as f64).sum::<f64>();
Expand Down Expand Up @@ -376,7 +377,7 @@ async fn test_many_concurrent_requests() {
log::info!("[query {}] Query result is correct", tid);
break;
} else if last_log_time.elapsed() > Duration::from_secs(5) {
log::info!("[query {}] Query result is incorrect: {:?}", tid, vec);
log::info!("[query {}] Query result is incorrect: {:?}, expected [{}]", tid, vec, sum);
last_log_time = Instant::now();
if last_sum != vec[0] {
last_sum = vec[0];
Expand Down

0 comments on commit f16aff3

Please sign in to comment.