-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework FileSystem::OpenFile
call, and add FILE_FLAGS_NULL_IF_NOT_EXISTS
#11297
Merged
Conversation
This file contains 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
…ith RemoveFile that ignores ENOEXIST errors
…penFile with FILE_FLAGS_NULL_IF_NOT_EXISTS
… calling FileExists when in read-only mode
github-actions bot
pushed a commit
to duckdb/duckdb-r
that referenced
this pull request
Mar 22, 2024
Merge pull request duckdb/duckdb#11297 from Mytherin/tryopenfile2
krlmlr
added a commit
to duckdb/duckdb-r
that referenced
this pull request
Mar 23, 2024
Merge pull request duckdb/duckdb#11297 from Mytherin/tryopenfile2
github-actions bot
pushed a commit
to duckdb/duckdb-r
that referenced
this pull request
Mar 28, 2024
Merge pull request duckdb/duckdb#11297 from Mytherin/tryopenfile2
yajirobee
added a commit
to yajirobee/duckdb_msgpack_extension
that referenced
this pull request
Apr 19, 2024
yajirobee
added a commit
to yajirobee/duckdb_msgpack_extension
that referenced
this pull request
Apr 23, 2024
* bump duckdb version to 0.10.2 * follow duckdb/duckdb#11297
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.
Follow-up from #11259
This PR reworks the
FileSystem::OpenFile
call to take a singleFileOpenFlags
object, instead of the previous three parameters (uint8_t flags, FileLockType lock, FileCompressionType compression
). TheFileOpenFlags
holds all this information and is more future-proof.The
FileOpenFlags
can be bitwise or-d together similar to the previous flags, and it can also be bitwise or-ed with theFileLockType
andFileCompressionType
, i.e. this now works:Instead of doing bitwise operations, there are now methods that can be used to access various properties, e.g.
flags.OpenForWriting()
instead offlags & FileFlags::FILE_FLAGS_WRITE
.FILE_FLAGS_NULL_IF_NOT_EXISTS
This PR adds a new flag to
OpenFile
-FILE_FLAGS_NULL_IF_NOT_EXISTS
. When this is passed intoOpenFile
, anullptr
is returned when the file cannot be opened because it does not exist, instead of throwing an exception. This allows for this pattern:To be replaced with this pattern:
This has the following benefits:
FileExists
->OpenFile
has an obvious race where the file can be removed in between calls)FileExists
is very expensive for HTTPFS/S3FS/etc.Using this new pattern for the write-ahead log fixes #9342, which was caused by precisely such a race (where
FileExists
would return true, followed byOpenFile
failing because the file did not exist).