Repository navigation
Commit 99c3bb4
committed
fix(store): report a failed COUNT read instead of returning zero
cbm_store_count_nodes and cbm_store_count_edges treat every sqlite3_step
result other than SQLITE_ROW as a count of zero. A read that failed —
SQLITE_CORRUPT, SQLITE_BUSY, SQLITE_IOERR — is therefore indistinguishable
from a project that genuinely holds no rows, and index_status renders it
as the positive assertion status "empty". A user or agent reading that
concludes the repository was never indexed and starts a multi-minute
re-index, while the corruption itself is never surfaced.
Both functions already have an error channel: each returns CBM_STORE_ERR
when prepare_cached fails. Only the step result was not reported through
it. index_status is already written for that value — it sets degraded on
a negative node count and clamps a negative edge count — so the guard
existed and simply never fired.
Initialise count to CBM_STORE_ERR so a non-row step is reported as a
failed read. A successful step still overwrites it with the real count,
so the healthy path is unchanged.
Closes DeusData#2012
Signed-off-by: kavish-19 <[email protected]>1 parent fe85a6b commit 99c3bb4
2 files changed
Lines changed: 41 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3069 | 3069 | | |
3070 | 3070 | | |
3071 | 3071 | | |
3072 | | - | |
| 3072 | + | |
| 3073 | + | |
| 3074 | + | |
| 3075 | + | |
| 3076 | + | |
3073 | 3077 | | |
3074 | 3078 | | |
3075 | 3079 | | |
| |||
3389 | 3393 | | |
3390 | 3394 | | |
3391 | 3395 | | |
3392 | | - | |
| 3396 | + | |
| 3397 | + | |
| 3398 | + | |
| 3399 | + | |
3393 | 3400 | | |
3394 | 3401 | | |
3395 | 3402 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2030 | 2030 | | |
2031 | 2031 | | |
2032 | 2032 | | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
2033 | 2064 | | |
2034 | 2065 | | |
2035 | 2066 | | |
| |||
2432 | 2463 | | |
2433 | 2464 | | |
2434 | 2465 | | |
| 2466 | + | |
2435 | 2467 | | |
0 commit comments