Skip to content

Commit c9fd537

Browse files
committed
SE: No new fibers after exhausted plan
Execution plan is shared between fibers. That means if one fiber declares the plan was exhausted, any new spawned fiber will do the same. Because of that, there is no need to spawn new fibers in this situation. The way to do that is setting remaining speculative retries to 0. We can't return immediately - we still have to wait for remaining running fibers.
1 parent 668f4e1 commit c9fd537

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

scylla/src/policies/speculative_execution.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ where
180180
} else {
181181
last_error = Some(r)
182182
}
183+
} else {
184+
// The only case where None is returned is when execution plan was exhausted.
185+
// If so, there is no reason to start any more fibers.
186+
// We can't always return - there may still be fibers running.
187+
retries_remaining = 0;
183188
}
184189
if async_tasks.is_empty() && retries_remaining == 0 {
185190
return last_error.unwrap_or({

0 commit comments

Comments
 (0)