* volume: count leveldb writes only once the .idx row lands
A Put or Delete whose .idx append failed still bumped the file and
deletion counters, so they drifted from what a recount of .idx gives.
The redb map already counts after the write succeeds.
* volume: track the largest needle end on leveldb and redb writes
Only the load walk set it, so it went stale as soon as a volume took
writes. Keep it current so it can be carried across a restart.
* volume: save needle counters on close instead of recounting .idx on load
Every load walked the whole .idx to rebuild the file and deletion
counters, which dominates restart time on servers with large indexes.
A clean close now stores them in the .ldb / .rdb tagged with the .idx
size (and mtime on Go) they describe; the next load takes them and
deletes them, so a crash or an .idx changed while closed falls back to
the full walk.
* volume: save no counters while .idx holds a partial row
A failed append can leave bytes past the last whole row that the
counters never saw. Tagging the counters with that size let the next
open take them and append from a misaligned offset.
* volume: prove reopen takes the saved counters, not a recount
A recount gives the same numbers, so the tests passed even when close
saved nothing. Skew the saved file count and expect it back.
* volume: test saved counters dropped when only the .idx mtime changed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>