Repository navigation
Conversation
archlemon
force-pushed
the
windows
branch
6 times, most recently
from
November 3, 2026 15:51
794b8a1 to
9e8846d
Compare
The store's Unix-only file calls now live in a small platform module with a Unix and a Windows version of each: positioned reads and writes, the writer lock, file identity, a read-only open's sync, the parent directory sync and copying the owner of a new generation. Unix keeps exactly what it did before. On Windows, positioned I/O loops over seek_read and seek_write. The writer lock is LockFileEx on one byte at offset 2^62 rather than File::lock, because std locks the whole file and Windows byte-range locks are mandatory, which would stop every read-only open from reading beside a writer. File identity is the file index from GetFileInformationByHandle. A read-only open that must flush frames a dead writer left reopens the file with write access through ReOpenFile, since FlushFileBuffers refuses a read-only handle. Windows cannot sync a directory, so the file at the path is flushed instead, which forces the NTFS journal through the create or rename. A cycle's rename over the open old generation relies on every handle sharing delete, the std default, and on std::fs::rename falling back to POSIX rename semantics. Refs #23
Test files that interpose libc symbols through dlsym, run a child under sh with ulimit, or abort a child process now compile only on Unix, as do the two SIGKILL tests in process.rs and the symlink and mode tests in reclaim.rs. The bulk test corrupts its file with a seek and a write instead of the Unix write_all_at, and the reclamation crash replay takes the original file's id from the first write in its trace instead of reading the inode, so both run on Windows too. Refs #23
A windows-latest job runs the ferro crate's tests in release mode on the same toolchain as the Linux job. It turns off autocrlf before checkout so the working tree matches the repository byte for byte. Refs #23
DESIGN.md gains a Windows section covering positioned I/O, why the writer lock is a single byte rather than File::lock, file identity, what FlushFileBuffers gives, the read-only flush, the file flush that stands in for a directory sync, and how a cycle renames over the open old generation, with the conditions under which that fails safely. The README's Limitations entry now says the library runs on Unix and Windows and what Windows needs. Refs #23
A read-only open that scans past a dead writer's superblock has to flush what it accepted, and on Windows a read-only handle cannot, so it reopened its own file with ReOpenFile and write access. When the reader opened the path just before a cycle's swap and took the shared lock just after the writer retired the old generation, that file had already lost its name, and Windows refuses every new handle to such a file with access denied. Readers following a writer through cycles failed to open intermittently. The reader now checks whether the path still names its file. If it does, it opens the path for writing and flushes that. If the path names another file, a cycle replaced this one after its rename was durable, so there is nothing to sync and the reader keeps the old view until its next refresh. Refs #23
…rectly A cycle's swap and offline compaction used std::fs::rename, which on Windows first tries MoveFileExW. That always fails here, because the old generation is still open, and std then retries with POSIX rename semantics. The swap depended on that fallback, which std documents may change. On Windows ferro now opens the new file with DELETE access and calls SetFileInformationByHandle with FileRenameInfoEx and the REPLACE_IF_EXISTS and POSIX_SEMANTICS flags itself. It falls back to std::fs::rename only when the file system refuses the call as unsupported. Unix still uses rename(2). Refs #23
The tables benchmark reads an instruction counter through perf_event_open and thread CPU time through clock_gettime, neither of which exists on Windows, so the workspace stopped building there. Elsewhere the counter now reads zero, as it already did when perf was unavailable, and CPU time reads zero off Unix. Refs #23
The Windows job now runs clippy over the whole workspace before the library tests, the same check the Linux job runs, so code behind cfg(windows) is linted and a crate that stops building on Windows fails CI. Its time limit rises to 90 minutes to make room. Refs #23
The test that admin reads close the file after a failure counted descriptors in /proc/self/fd, which exists only on Linux, so it failed on Windows. On Windows it now opens the file with no sharing, which succeeds only when no other handle is open. The test runs on Linux and Windows. Refs #23
On Windows an open of the database path can land on the old generation in the instant a cycle's rename replaces it. The old file is then waiting to be deleted, so CreateFile fails with access denied, and canonicalize, which asks the handle for its name afterwards, fails with not found. A reader opening in a loop beside cycles failed this way in about one CI run in two. Every open of the path and the canonicalize in Db::open now retry those two errors up to 20 times a millisecond apart on Windows, after which the path names the new file. Unix opens are unchanged. Refs #23
The delta benchmark reads instruction counts through perf_event_open, thread CPU time through clock_gettime and frames through the Unix positioned read, so the workspace stopped building on Windows. It now seeks and reads, and off Linux and Unix the counter and CPU time read zero, as in the tables benchmark. Refs #23
The test that a swap reports a damaged branch table flipped one byte with the Unix positioned write, so the fuzz tests stopped building on Windows. It now seeks and writes through the same handle. Refs #23
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Runs ferro on Windows, with platform helpers in
ferro/src/platform.rs, Unix-only tests gated and awindows-latestCI job. Opened as a draft so CI can try Windows before this reaches main.Refs #23