Skip to content

Commit

Permalink
Merge branch 'fix-get-tso-hang' into trace-scan
Browse files Browse the repository at this point in the history
Signed-off-by: Ping Yu <[email protected]>
  • Loading branch information
pingyu committed Nov 6, 2023
2 parents 1d3d074 + 7ba5f55 commit 81058ee
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/pd/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,13 @@ async fn run_tso(
let _enter = span.enter();
debug!("got response: {:?}", resp);

let mut pending_requests = pending_requests.lock().await;

// Wake up the sending future blocked by too many pending requests as we are consuming
// some of them here.
if pending_requests.len() == MAX_PENDING_COUNT {
sending_future_waker.wake();
{
let mut pending_requests = pending_requests.lock().await;
allocate_timestamps(&resp, &mut pending_requests)?;
}

allocate_timestamps(&resp, &mut pending_requests)?;
// Wake up the sending future blocked by too many pending requests or locked.
sending_future_waker.wake();
}
// TODO: distinguish between unexpected stream termination and expected end of test
info!("TSO stream terminated");
Expand Down Expand Up @@ -148,6 +146,7 @@ impl Stream for TsoRequestStream {
{
pending_requests
} else {
this.self_waker.register(cx.waker());
return Poll::Pending;
};
let mut requests = Vec::new();
Expand Down

0 comments on commit 81058ee

Please sign in to comment.