Commit 45e4887
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 a482153 commit 45e4887
1 file changed
Lines changed: 17 additions & 6 deletions
Lines changed: 17 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
402 | | - | |
403 | | - | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
404 | 406 | | |
405 | 407 | | |
406 | 408 | | |
| |||
425 | 427 | | |
426 | 428 | | |
427 | 429 | | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
428 | 438 | | |
429 | | - | |
430 | | - | |
431 | | - | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
432 | 443 | | |
433 | | - | |
| 444 | + | |
434 | 445 | | |
435 | 446 | | |
436 | 447 | | |
| |||
0 commit comments