-
Notifications
You must be signed in to change notification settings - Fork 1.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
Add support for posix_madvise to Java 21 MMapDirectory #13196
Merged
Merged
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
670b06c
Add support for posix_madvise to Java 21 MMapDirectory
uschindler 1ca24fe
Cleanup and retrieve page size on linux; TODO: the constant seems sys…
uschindler 7cec218
fix bug in warning
uschindler 9a6faca
Remove page size retrieval again and use a safe boundary (2 MiB)
uschindler 4d9a442
fix logger name
uschindler d311b97
static final MH
ChrisHegarty 5873d7c
Add IOContext.randomAccess (#3)
ChrisHegarty 9ed1da7
Revert "static final MH"
uschindler 242e5e9
Make merge context always win
uschindler a729f02
Cleanup code and move IOContext mapping to Posix, as the constants we…
uschindler 1e4c5c3
Set randomAccess=true on LOAD. (#4)
jpountz c9e5ae4
Another run at static final
ChrisHegarty 3dcf7c9
Remove NoopNativeAccess and use an Optional
uschindler 6b19c3a
Merge branch 'dev/posix_madvise' of https://github.com/uschindler/luc…
uschindler 135a8d2
Merge remote-tracking branch 'uwe/dev/posix_madvise' into dev/posix_m…
ChrisHegarty 0d0aeb1
optional
ChrisHegarty 4430a76
javadoc
ChrisHegarty 5c97ca0
remove logger and uppercase MH
ChrisHegarty 20fd5a1
Add getter on MMapDirectory to make madvise status queryable
uschindler e6485b8
Merge branch 'dev/posix_madvise' of https://github.com/uschindler/luc…
uschindler cab9014
add minimal test with input IOContext.RANDOM to ensure basic code pat…
ChrisHegarty 1bdad0f
typo
ChrisHegarty 86bfdc6
Add more Javadocs, improve instructions when native access is misisng…
uschindler 648f578
fix typo
uschindler 265c82b
Merge branch 'main' into dev/posix_madvise
ChrisHegarty 94073e1
Merge branch 'main' of https://gitbox.apache.org/repos/asf/lucene int…
uschindler 3919323
add CHANGES.txt
uschindler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
39 changes: 39 additions & 0 deletions
39
lucene/core/src/java21/org/apache/lucene/store/NativeAccess.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.lucene.store; | ||
|
||
import java.io.IOException; | ||
import java.lang.foreign.MemorySegment; | ||
import java.util.Optional; | ||
import org.apache.lucene.util.Constants; | ||
|
||
@SuppressWarnings("preview") | ||
abstract class NativeAccess { | ||
|
||
/** Invoke the {@code madvise} call for the given {@link MemorySegment}. */ | ||
public abstract void madvise(MemorySegment segment, IOContext context) throws IOException; | ||
|
||
/** | ||
* Return the NativeAccess instance for this platform. At moment we only support Linux and MacOS | ||
*/ | ||
public static Optional<NativeAccess> getImplementation() { | ||
if (Constants.LINUX || Constants.MAC_OS_X) { | ||
ChrisHegarty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return PosixNativeAccess.getInstance(); | ||
} | ||
return Optional.empty(); | ||
} | ||
} |
Oops, something went wrong.
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.
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.
👍
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.
🙏