Repository navigation
[kyo-system, kyo-system-doltfs] hold every write backend to the host's placement and creation rules - #2203
Open
DamianReeves wants to merge 2 commits into
Open
[kyo-system, kyo-system-doltfs] hold every write backend to the host's placement and creation rules#2203DamianReeves wants to merge 2 commits into
DamianReeves wants to merge 2 commits into
Conversation
fwbrasil
reviewed
Nov 9, 2026
|
|
||
| /** Every read failure is also a write failure, so a lookup's failure passes through a write unchanged. */ | ||
| private def writing[A, S](v: A < (S & Abort[FileReadException]))(using Frame): A < (S & Abort[FileWriteException]) = | ||
| Abort.recover[FileReadException] { case e: FileWriteException => Abort.fail(e) }(v) |
Collaborator
There was a problem hiding this comment.
I don't get the point of the recover here
fwbrasil
approved these changes
Nov 9, 2026
…s placement and creation rules The write tier gains laws the host already met and the Dolt filesystem did not. Each new law failed against Dolt before this change. Dolt filesystem: - A write beneath a regular file created an entry under it. It now fails as the host does, with an I/O failure naming the entry. - Writes did not follow links. A write through a linked directory landed beside the link, where reads never look, and a write to a link replaced it with a file. Content operations now follow every link, and entry operations follow the links in the parent path. - Create-new checked, then wrote, so concurrent openers all succeeded. Creation is now one insert keyed by the path, so exactly one wins. - A move cleared the target and placed the source in separate statements, so a reader saw no target in between. It now runs in one transaction. Its checks report failures as values, since the pool discards a session that a failure crosses. - A replacing move or copy deleted a directory with entries. It now fails with FileDirectoryNotEmptyException. - A move or copy of an entry onto itself deleted it. It is now a no-op. Host: - A move or copy refused by its target named the source. It now names the target. - Scala Native's move and copy did not apply the JDK's rule for a directory target, and Node's error for it varies by operating system. All hosts now refuse a directory with entries and replace an empty one, except under required atomicity.
…rom one row A read ran two statements: one for the node, which carries the length, and one for the bytes. A replacement that committed between them gave the reader the start of the new content cut to the old length. `readBytes`, `copy` and a channel's `readAt` all had this shape. The atomic move law saw it in one round of twenty, the only round where the content grew by a byte, and failed about one run in five. `DoltVfsStore.readAll` and `readRange` now read the length and the bytes in one statement and answer Absent when the row is gone. `copy` sizes each file from the row it reads, and fails with FileNotFoundException when a file it listed is removed before it is read. A channel read of a removed file fails with FileNotFoundException where it answered no bytes. The conformance suite gains two laws and the atomic move law changes the length of the content in every round, so each of the three fails on every run against the two statement read: - never shows a required atomic move half done (each round changes the length) - never copies a source half replaced - never reads a channel's file half replaced The scaladoc for `copyBytes` sat above `hexOf`. It is back on `copyBytes`.
DamianReeves
force-pushed
the
dolt-filesystem-contract
branch
from
November 17, 2026 16:01
ccded6e to
ce0faff
Compare
This branch has not been deployed
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.
Problem
DoltFileSystem(#1956) passed the write tier ofkyo-system-conformance, but the tier did not test several rules the host already follows. Against those rules, Dolt had six defects:WriteOpen.CreateNewchecked for the file, then wrote it, so several concurrent openers all succeeded.Atomicity.Required.The host also had smaller gaps:
Files.moveandFiles.copydo not apply the JDK's rule for a directory target. Node's error for that case varies by operating system.Solution
The write tier gains these laws, so every backend is held to them:
FileAlreadyExistsException.FileDirectoryNotEmptyExceptionnaming that directory. An empty directory is replaced.FileAlreadyExistsException.Each law failed against Dolt before this change, and the host passes all of them.
Dolt:
mkDir,mkFile,symlink, remove, and the move or copy target) follow the links in the parent path and act on the entry itself. Create-new does not follow a link at the path, matching an exclusive host open.FileIOExceptionnaming the entry.moveruns in one transaction. Every check runs before the first write and reports failure as a value, because the pool discards a session that a non-engine failure crosses. Over an in-memory DoltLite database, that would discard the database.Host:
moveandcopyname the target when the target is what refused them.Atomicity.Requiredit does not remove a directory first, since that would split the replacement in two.Notes
The
FileSystemstack ([kyo-system] make a write survive a crash #1868 through [kyo-system] add the overlay filesystem and stage writes over any backend #1799) is independent of this PR. I applied these laws to the top of that stack and ran them:durableReplacein [kyo-system] make a write survive a crash #1868 adds the sameDoltVfsStore.atomicallyhelper. Whichever lands second drops its copy.Validation, run locally on macOS:
The kyo-system and kyo-system-doltfs README doctests pass.