-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Move shared cache pre-allocation and support macOS #70285
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
Move shared cache pre-allocation and support macOS #70285
Conversation
This commit moves the shared cache pre-allocation code out of bootstrap, and instead to the searchable snapshots code. We got out of our way to only grant permissions to a specific library used for the pre-allocation. Additionally, to ensure our interfaces are sound, we add a macOS implementation based on fcntl and ftruncate.
The main purpose of this relocation is to keep this plugin-specific code out of bootstrap. Additionally, for some complicated reasons, we can't touch the roles until after plugins are done being loaded. This means that we can't make the validation fo these settings dependent on the node roles unless we relocate these settings out of bootstrap so that they are not touched until after plugins are done being loaded. This gives us a second reason to move this code, so we take those steps now. |
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.
The plugin+security policy side LGTM.
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.
I've done a first pass, and pushed a commit to fix precommit (as best I could).
I'm wondering if there's some test we can add to make sure this actually works on MacOS / Linux besides manual testing.
...src/main/java/org/elasticsearch/xpack/searchablesnapshots/preallocate/MacOsPreallocator.java
Outdated
Show resolved
Hide resolved
@ywelsch Thanks for making a pass, and especially for addressing precommit. 🙏 I took your suggestion to first attempt to allocate contiguously on macOS. I agree on adding testing, I'll do that in a follow-up. |
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.
LGTM
fst.fst_length = new NativeLong(fileSize); | ||
// first, try allocating contiguously | ||
if (Natives.fcntl(fd, Natives.Fcntl.F_PREALLOCATE, fst) != 0) { | ||
// that failed, so let us try allocating non-contigulsouly |
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.
nit: non-contiguously
Pinging @elastic/es-distributed (Team:Distributed) |
Pinging @elastic/es-core-infra (Team:Core/Infra) |
This commit moves the shared cache pre-allocation code out of bootstrap, and instead to the searchable snapshots code. We go out of our way to only grant permissions to a specific library used for the pre-allocation. Additionally, to ensure our interfaces are sound, we add a macOS implementation based on fcntl and ftruncate. Co-authored-by: Yannick Welsch <[email protected]>
This commit moves the shared cache pre-allocation code out of bootstrap, and instead to the searchable snapshots code. We go out of our way to only grant permissions to a specific library used for the pre-allocation. Additionally, to ensure our interfaces are sound, we add a macOS implementation based on fcntl and ftruncate. Co-authored-by: Yannick Welsch <[email protected]>
This commit moves the shared cache pre-allocation code out of bootstrap, and instead to the searchable snapshots code. We got out of our way to only grant permissions to a specific library used for the pre-allocation.
Additionally, to ensure our interfaces are sound, we add a macOS implementation based on fcntl and ftruncate.
Relates #68858