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 1 commit into
Open
[kyo-system, kyo-system-doltfs] hold every write backend to the host's placement and creation rules#2203DamianReeves wants to merge 1 commit into
DamianReeves wants to merge 1 commit into
Conversation
…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.
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.