Symptom
SingleFileCompressionTests.DatabaseFactory_Compression_GrowingTable_ReopenSelectShouldSurvive fails intermittently on Linux/macOS/container runners:
SharpCoreDB.Tests.Storage.SingleFileCompressionTests.DatabaseFactory_Compression_GrowingTable_ReopenSelectShouldSurvive [FAIL]
Assert.Equal() Failure: Expected: 500, Actual: 499
Stack trace path /_/tests/... (container build)
Test behavior
Single-file (.scdb), Brotli compression. 500 INSERTs with auto-flush that repeatedly rewrites the row-cache block past the compression threshold, then Flush() + ForceSave() + reopen + SELECT * ORDER BY id expecting 500 rows. One row is missing after reopen.
Evidence it is environmental / not a regression
Suspected root-cause area
WriteBlockAsync enqueues and returns; the physical write happens in the write-behind worker/drain (ProcessWriteQueueAsync / FlushPendingWritesAsync). On slower macOS/container filesystems a reopen can observe the previous block version (499 rows) even though FlushAsync uses flushToDisk: true. There is prior art for this class of bug: the macOS-regression comment in SingleFileStorageProvider.cs (~line 1579: "data stays in OS cache without fsync ... expected 2 rows, got 1") and issue #345 (metadata/data write ordering).
Suggested investigation
- Reproduce on a failing runner by repeating this test 25-50x.
- Capture which row id is missing and whether the data block on disk actually holds 499 or 500 records (compare the block-registry entry length vs the parsed record count).
- Review the ordering guarantees between the write-behind drain, the block-registry flush and the FSM free/allocate (block grow path frees the old block and allocates a new offset on every flush past the page threshold).
Symptom
SingleFileCompressionTests.DatabaseFactory_Compression_GrowingTable_ReopenSelectShouldSurvivefails intermittently on Linux/macOS/container runners:Test behavior
Single-file (.scdb), Brotli compression. 500 INSERTs with auto-flush that repeatedly rewrites the row-cache block past the compression threshold, then
Flush()+ForceSave()+ reopen +SELECT * ORDER BY idexpecting 500 rows. One row is missing after reopen.Evidence it is environmental / not a regression
Suspected root-cause area
WriteBlockAsyncenqueues and returns; the physical write happens in the write-behind worker/drain (ProcessWriteQueueAsync/FlushPendingWritesAsync). On slower macOS/container filesystems a reopen can observe the previous block version (499 rows) even thoughFlushAsyncusesflushToDisk: true. There is prior art for this class of bug: the macOS-regression comment in SingleFileStorageProvider.cs (~line 1579: "data stays in OS cache without fsync ... expected 2 rows, got 1") and issue #345 (metadata/data write ordering).Suggested investigation