SpacetimeDB
SpacetimeDB copied to clipboard
commitlog: Fix open flags for read-only offset index
For some reason, we've been opening the read-only index file with
.read(true).append(true).
This translates to O_RDWR | O_APPEND on *nix, but something weird on
Windows. A shared memory map requires O_RDWR (or equivalent) on either
platform, though, meaning that we'd always fail to mmap the index on
Windows.
Open with .read(true).write(true) instead to fix.
Expected complexity level and risk
1
The impact of this bug is also small, because the offset index is not crucial for standalone use. Who says, though, that Windows will never become a viable server platform for SpacetimeDB?
Testing
Extends the tests to open an index using all three variants and perform lookups.