Commit 60d859c
fix: add FOR UPDATE row locking to delete_metrics_splits
Mirror the CTE + FOR UPDATE pattern from delete_splits to prevent
stale-state races. Without row locking, a concurrent
mark_metrics_splits_for_deletion can commit between the state read
and the DELETE, causing spurious FailedPrecondition errors and retry
churn.
The new query locks the target rows before reading their state,
reports not-deletable (Staged/Published) and not-found splits
separately, and only deletes when all requested splits are in
MarkedForDeletion state.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 5582dcc commit 60d859c
File tree
1 file changed
+15
-7
lines changed- quickwit/quickwit-metastore/src/metastore/postgres
1 file changed
+15
-7
lines changedLines changed: 15 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2625 | 2625 | | |
2626 | 2626 | | |
2627 | 2627 | | |
| 2628 | + | |
2628 | 2629 | | |
2629 | 2630 | | |
2630 | 2631 | | |
2631 | 2632 | | |
2632 | 2633 | | |
2633 | 2634 | | |
2634 | 2635 | | |
2635 | | - | |
2636 | | - | |
2637 | | - | |
| 2636 | + | |
| 2637 | + | |
| 2638 | + | |
| 2639 | + | |
2638 | 2640 | | |
2639 | 2641 | | |
2640 | 2642 | | |
2641 | 2643 | | |
2642 | | - | |
2643 | | - | |
2644 | | - | |
| 2644 | + | |
| 2645 | + | |
| 2646 | + | |
| 2647 | + | |
| 2648 | + | |
| 2649 | + | |
| 2650 | + | |
| 2651 | + | |
| 2652 | + | |
2645 | 2653 | | |
2646 | 2654 | | |
2647 | 2655 | | |
| |||
2680 | 2688 | | |
2681 | 2689 | | |
2682 | 2690 | | |
2683 | | - | |
| 2691 | + | |
2684 | 2692 | | |
2685 | 2693 | | |
2686 | 2694 | | |
| |||
0 commit comments