-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add setting to control the maximum swap space #10978
Merged
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
…ectory size beyond the max
maybe the default should be 90% of available capacity on the drive to allow for some other stuff to happen as well |
Tishj
commented
Mar 8, 2024
Tishj
commented
Mar 8, 2024
Tishj
commented
Mar 8, 2024
…nnection, add test for the behavior
… left empty before
… so we disable it
Mytherin
reviewed
Apr 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks good - one more minor comment
…r be made if the path is empty
Mytherin
reviewed
Apr 12, 2024
Thanks! LGTM |
github-actions bot
pushed a commit
to duckdb/duckdb-r
that referenced
this pull request
May 1, 2024
Merge pull request duckdb/duckdb#10978 from Tishj/maximum_swap_space
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.
This PR fixes https://github.com/duckdblabs/duckdb-internal/issues/1371
As the title says, this PR adds a setting to control maximum swap space.
Using the
temp_directory
setting, a directory can be assigned to use by DuckDB to offload temporary intermediate data, to evict buffers that can not be processed yet but are taking up room required by other buffers, we store them on disk."Disk is full" issue
The problem this solves is that this can grow unbounded, in the worst case eventually flooding the entire disk, making it unusable.
To prevent this issue, we will instead abort the query if the
max_temp_directory_size
is reachedmax_temp_directory_size
The setting defaults to 0 when
temp_directory
is not set.If
temp_directory
is set to an existing directory, it will default to the available disk space on that drive.If
temp_directory
is set to a non-existent directory, it will default to 0. When the directory gets created by us, we'll update it to the available disk space on that drive.When the setting is set explicitly by the user, it will not be influenced by the
temp_directory
setting at all.(see
test/sql/storage/max_swap_space.test
for examples of this)When the value is "none", "null" or the value starts with
-
then the swap limit is set to unlimited.Future work
Maybe in the future, instead of aborting the query, we can let the task block instead, to be rescheduled later when enough disk space is available
(realizing this might be a more general use for blocking tasks, rather than assigning a special event that is responsible for unblocking events, maybe we want to have a generic system that periodically checks a callback to detect if a task should be unblocked)
Other changes
FileSystem
now has a static methodGetAvailableDiskSpace
which takes a path and retrieves the disk space info from it.DatabaseInstance::Initialize
no longer modifies the DBConfig passed in by the user, these modifications are now done directly to the internal config insideDatabaseInstance::Configure