Repository navigation
Conversation
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.
Which issue does this PR close?
Rationale for this change
DiskManagerBuilder::buildinDiskManagerMode::Directoriesmode creates adatafusion-*directory in every configured directory, and each one is removed again when theDiskManageris dropped. Engines that build aRuntimeEnvper query or per task pay those syscalls on every build, even when nothing spills (see the numbers from Comet in the issue).DiskManagerMode::OsTmpDirectoryalready creates its directory on the firstcreate_tmp_file.What changes are included in this PR?
DiskManagerkeeps the configured directories (configured_dirs) and starts with an emptylocal_dirsinDirectoriesmode, the same asOsTmpDirectory.create_tmp_file, it creates onedatafusion-*directory in each configured directory (using the existingcreate_local_dirs), or an OS temp directory when none were configured, as before. The directories are only stored once all of them were created, so a failure is returned to that caller and the next call tries again.DiskManagerMode::Directoriesandtemp_dir_pathsdescribe the new timing.What is the testing strategy for this PR?
New unit tests in
disk_manager.rs:lazy_configured_dir_creation: building inDirectoriesmode leaves the configured directories empty andtemp_dir_paths()empty; the first temp file creates onedatafusion-*directory per configured directory, later temp files reuse them, and they are removed after the files and theDiskManagerare dropped.unusable_configured_dir_fails_first_temp_file: a configured path that is a regular file now makes the firstcreate_tmp_filefail instead ofbuild().test_disk_manager_create_spill_foldernow checks that a missing configured directory is created together with the first temp file.I ran
cargo test -p datafusion-execution,cargo clippy -p datafusion-execution --all-targets --all-features -- -D warningsandcargo fmt. I did not run thedatafusioncore integration tests or sqllogictests locally.Are there any user-facing changes?
Yes, as described in the issue:
DiskManager::temp_dir_paths()returns an empty list until the first temp file is created. This also meansSHOW datafusion.runtime.temp_directory/information_schema.df_settingsshowNULLfor a configured temp directory until something spills.DiskManagerBuilder::build()/RuntimeEnvBuilder::build().No public API signatures change. I'm not sure whether the
temp_directorydisplay change is acceptable or whether you'd prefer it to show the configured paths before the first spill; happy to adjust.This PR was prepared with AI assistance (code and description); I reviewed the change and the tests.