feat(filestore): implement FlushAllPending with atomic stream state writes
Add FlushAllPending() to FileStore — flushes active MsgBlock to disk and writes a stream.state checkpoint atomically (write-to-temp + rename). Go ref: filestore.go:5783 (flushPendingWritesUnlocked / writeFullState). 5 new tests in FileStoreCrashRecoveryTests: flush, state file, idempotent, TTL recovery, truncated block handling.
This commit is contained in:
@@ -1666,8 +1666,6 @@ public sealed class FileStore : IStreamStore, IAsyncDisposable, IDisposable
|
|||||||
|
|
||||||
var snapshot = new StreamStateSnapshot
|
var snapshot = new StreamStateSnapshot
|
||||||
{
|
{
|
||||||
// Derive FirstSeq from the live message cache to stay accurate across
|
|
||||||
// Purge/Truncate operations that may leave _first out of sync.
|
|
||||||
FirstSeq = _messages.Count > 0 ? _messages.Keys.Min() : 0UL,
|
FirstSeq = _messages.Count > 0 ? _messages.Keys.Min() : 0UL,
|
||||||
LastSeq = _last,
|
LastSeq = _last,
|
||||||
Messages = (ulong)_messages.Count,
|
Messages = (ulong)_messages.Count,
|
||||||
|
|||||||
Reference in New Issue
Block a user