-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Constant time attach path lookup and locking to ensure unique file handles #9671
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
Conversation
Just one small note, maybe the ":memory:" should live in this list instead: // NOTE: there is a copy of this in the Postgres' parser grammar (gram.y)
#define DEFAULT_SCHEMA "main"
#define INVALID_SCHEMA ""
#define INVALID_CATALOG ""
#define SYSTEM_CATALOG "system"
#define TEMP_CATALOG "temp" (constants.hpp) |
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 for the PR! Looks great - good results. Some comments:
@Mytherin, what about this? |
Maybe move it to the define for consistency and we can figure out a cleaner way of doing it later |
…ires the file handle
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 for the fixes! Looks great, some more minor comments:
Thanks! |
Merge pull request duckdb/duckdb#9671 from taniabogatsch/profile-attach
This PR addresses two issues concerning
ATTACH
.map<path, name>
to look up the path, and we can also use the name to retrieve the matching catalog entry in constant time.map<path, name>
to ensure that we never have more than a single file handle to a file.I also noticed that the
":memory:"
string crept into our code at many places, so I added a constantDConstants::IN_MEMORY_PATH
for it and replaced all occurrences in thesrc
subdirectories.Here are some timings on my machine for five runs of attaching 30_000 files with 32 threads attaching simultaneously. To run this, the test
test_attach.cpp
included in this PR can be modified to run with higher file and thread counts.