Repository navigation
Commit b5f10c2
committed
fix(mcp): give the over-budget error a retry value, and say the peak is not the requirement
v0.10.9 introduces Decision A: an over-budget index attempt fails whole with a
named error instead of thrashing. The error told the caller to "Raise
CBM_MEM_BUDGET_MB" but not to what, so the obvious next move is to read
peak_rss_mb and retry just above it.
That move fails, every time, by construction. The abort fires WHEN resident
memory crosses the budget, so peak_rss_mb is pinned just above the budget --
it is where indexing was stopped, not what the repository needs.
Measured on the linux kernel (94521 files, 43.1M LOC) while benching v0.10.9:
default budget 24576 MB -> aborted, peak_rss_mb 25622
completing the same index actually took 31.75 GB
So the reported peak understates the real requirement by 24%, and 1.32x the
budget was needed. A caller retrying at peak+10% would have burned another
30 seconds to fail again with a nearly identical message.
The response now carries suggested_budget_mb (1.5x the current budget, which
would have cleared the kernel case) and the hint says plainly that peak_rss_mb
is a floor, not a target. Computed as (3*b+1)/2 rather than b + b/2: integer
division makes the latter degenerate to b at b == 1, so the suggestion would
have repeated the budget that just failed -- the extended test caught exactly
that.
Not changed: the abort itself, the backpressure ladder, and worker cleanup. A
clean test confirmed workers do NOT survive the abort (process count 2 before,
2 after, both idle at 0% CPU), so there was nothing to fix there.
tests/test_mcp.c now pins both halves -- a concrete value strictly greater than
the budget, and the hint stating the peak is where indexing STOPPED. Verified
against the real pre-fix output captured during the bench, which contains
neither.
mcp suite 317 passed, 0 failed, 4 skipped; lint-ci clean.
Signed-off-by: Martin Vogel <[email protected]>1 parent 7fedfe8 commit b5f10c2
2 files changed
Lines changed: 38 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11228 | 11228 | | |
11229 | 11229 | | |
11230 | 11230 | | |
11231 | | - | |
11232 | | - | |
11233 | | - | |
11234 | | - | |
11235 | | - | |
| 11231 | + | |
| 11232 | + | |
| 11233 | + | |
| 11234 | + | |
| 11235 | + | |
| 11236 | + | |
| 11237 | + | |
| 11238 | + | |
| 11239 | + | |
| 11240 | + | |
| 11241 | + | |
| 11242 | + | |
| 11243 | + | |
| 11244 | + | |
| 11245 | + | |
| 11246 | + | |
| 11247 | + | |
| 11248 | + | |
| 11249 | + | |
| 11250 | + | |
| 11251 | + | |
| 11252 | + | |
| 11253 | + | |
| 11254 | + | |
| 11255 | + | |
| 11256 | + | |
| 11257 | + | |
| 11258 | + | |
11236 | 11259 | | |
11237 | 11260 | | |
11238 | 11261 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17773 | 17773 | | |
17774 | 17774 | | |
17775 | 17775 | | |
| 17776 | + | |
| 17777 | + | |
| 17778 | + | |
| 17779 | + | |
| 17780 | + | |
| 17781 | + | |
17776 | 17782 | | |
17777 | 17783 | | |
| 17784 | + | |
17778 | 17785 | | |
17779 | 17786 | | |
17780 | 17787 | | |
| |||
17817 | 17824 | | |
17818 | 17825 | | |
17819 | 17826 | | |
| 17827 | + | |
17820 | 17828 | | |
17821 | 17829 | | |
| 17830 | + | |
| 17831 | + | |
17822 | 17832 | | |
17823 | 17833 | | |
17824 | 17834 | | |
| |||
0 commit comments