Commit 64ddf12
committed
fix: prevent MVCC race in blockRunWithWaitpoint pending check
Split the CTE in blockRunWithWaitpoint so the pending waitpoint check
is a separate SQL statement. In READ COMMITTED isolation, each statement
gets its own snapshot, so a separate SELECT sees the latest committed
state from concurrent completeWaitpoint calls.
Previously, the CTE did INSERT + pending check in one statement (one
snapshot). If completeWaitpoint committed between the CTE start and
the SELECT, the SELECT would still see PENDING due to the stale
snapshot. Neither side would enqueue continueRunIfUnblocked, leaving
the run stuck forever.1 parent 921285c commit 64ddf12
File tree
1 file changed
+17
-6
lines changed- internal-packages/run-engine/src/engine/systems
1 file changed
+17
-6
lines changedLines changed: 17 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
400 | | - | |
401 | | - | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
402 | 404 | | |
403 | 405 | | |
404 | 406 | | |
| |||
423 | 425 | | |
424 | 426 | | |
425 | 427 | | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
426 | 436 | | |
427 | | - | |
428 | | - | |
429 | | - | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
430 | 441 | | |
431 | | - | |
| 442 | + | |
432 | 443 | | |
433 | 444 | | |
434 | 445 | | |
| |||
0 commit comments