fix(storage): propagate VikingFS.mkdir backend errors instead of swallowing them - #3731
Open
hobostay wants to merge 1 commit into
Open
fix(storage): propagate VikingFS.mkdir backend errors instead of swallowing them#3731hobostay wants to merge 1 commit into
hobostay wants to merge 1 commit into
Conversation
…lowing them The except block in VikingFS.mkdir() had no re-raise, so any backend failure that was not an already-exists error (permission denied, quota exceeded, I/O errors, lock-lease violations) — and even already-exists errors with exist_ok=False — was silently discarded and mkdir() returned as if the directory had been created. Callers on the write hot path (ovpack import, parsers, session, privacy) then write into a directory that may not exist, and the original actionable error is lost. Re-raise the original exception unless it is an already-exists error tolerated by exist_ok=True. Also update tests/misc/test_mkdir.py, which still mocked fs.agfs.mkdir even though mkdir() now goes through the AsyncAGFSClient wrapper (self._async_agfs) — the swallowed-attribute-error made the stale tests pass/fail for the wrong reasons. Add regression tests covering error propagation for both exist_ok values.
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
VikingFS.mkdir()(openviking/storage/viking_fs.py) catches every exception from the backendmkdircall, but theexceptblock has no re-raise:Any failure that is not an already-exists error tolerated by
exist_ok=True— permission denied, quota/resource-exhausted, I/O errors, lock-lease violations, and even already-exists errors with the defaultexist_ok=False— is silently swallowed, andmkdir()returns as if the directory had been created.mkdiris on the write hot path (ovpack import, parsers, session, privacy service, andmv's internal copy). Callers reasonably assume a returnedmkdirmeans the directory exists; downstream writes then fail later with confusing secondary errors, and the original, actionable error is lost.Fix
Re-raise the original exception unless it is an already-exists error tolerated by
exist_ok=True:One-line change; no behavior change for the already-exists +
exist_ok=Truepath.Tests
tests/misc/test_mkdir.pywas stale: it mockedfs.agfs.mkdir, butmkdir()goes through theAsyncAGFSClientwrapper (self._async_agfs). Four of its five tests failed onmain, and the fifth passed only because the swallowedAttributeErrorfrom the missing mock mademkdir()return early — the very bug this PR fixes._async_agfs.mkdirand to match the current create-then-tolerate-exists semantics.exist_ok=Falseandexist_ok=True(non-exists errors), andexist_ok=Falsesurfaces already-exists errors.Full
tests/storage,tests/misc, andtests/serviceruns show no new failures versusmain(the only delta is the 4 previously-failing stale mkdir tests now passing).