Files
natsdotnet/tests/NATS.Server.Tests/JetStream/Storage
Joseph Doherty 7434844a39 feat: optimize FilteredState and LoadMsg with block-aware search (Gap 1.10)
Add NumFiltered with generation-based result caching, block-range binary
search helpers (FindFirstBlockAtOrAfter, FindBlockForSequence), and
CheckSkipFirstBlock optimization. FilteredState uses the block index to
skip sealed blocks below the requested start sequence. LoadMsg gains an
O(log n) block fallback for cases where _messages does not hold the
sequence. Generation counter incremented on every write/delete/purge to
invalidate NumFiltered cache entries.

Add 18 tests in FileStoreFilterQueryTests covering literal and wildcard
FilteredState, start-sequence filtering across multiple blocks, NumFiltered
basic counts and cache invalidation, LoadMsg block search, and
CheckSkipFirstBlock behaviour.

Also fix pre-existing slopwatch violations in WriteCacheTests.cs: replace
Task.Delay(150)/Task.Delay(5) with TrackWriteAt using explicit past
timestamps, and restructure Dispose to avoid empty catch blocks.

Reference: golang/nats-server/server/filestore.go:3191 (FilteredState),
           golang/nats-server/server/filestore.go:8308 (LoadMsg).
2026-02-25 08:13:52 -05:00
..