-
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
Introduce IOContext.LOAD #11930
Merged
Merged
Introduce IOContext.LOAD #11930
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
efb6297
Automatically preload index files that are both tiny and very hot.
jpountz 1386a16
Make preload a predicate.
jpountz f6ebdf4
Restore getter and add more docs.
jpountz ed5eb24
Remove `PRELOAD_` prefix.
jpountz 6a5ef89
Rename.
jpountz abf7f6f
Remove automatic preloading.
jpountz 408aae5
Remove MMapDirectory changes.
jpountz 76c8dd7
Merge branch 'main' into add_iocontext_load
jpountz 8244cac
iter
jpountz 7952bea
Improve docs.
jpountz 711116b
Merge remote-tracking branch 'origin/main' into add_iocontext_load
jpountz 5847693
Add back BASED_ON_LOAD_IO_CONTEXT.
jpountz 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,34 +41,47 @@ public enum Context { | |
|
||
public final FlushInfo flushInfo; | ||
|
||
/** This flag indicates that the file will be opened, then fully read sequentially then closed. */ | ||
public final boolean readOnce; | ||
|
||
/** | ||
* This flag is used for files that are a small fraction of the total index size and are expected | ||
* to be heavily accessed in random-access fashion. Some {@link Directory} implementations may | ||
* choose to load such files into physical memory (e.g. Java heap) as a way to provide stronger | ||
* guarantees on query latency. | ||
*/ | ||
public final boolean load; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This description looks good. |
||
|
||
public static final IOContext DEFAULT = new IOContext(Context.DEFAULT); | ||
|
||
public static final IOContext READONCE = new IOContext(true); | ||
public static final IOContext READONCE = new IOContext(true, false); | ||
|
||
public static final IOContext READ = new IOContext(false, false); | ||
|
||
public static final IOContext READ = new IOContext(false); | ||
public static final IOContext LOAD = new IOContext(false, true); | ||
|
||
public IOContext() { | ||
this(false); | ||
this(false, false); | ||
} | ||
|
||
public IOContext(FlushInfo flushInfo) { | ||
assert flushInfo != null; | ||
this.context = Context.FLUSH; | ||
this.mergeInfo = null; | ||
this.readOnce = false; | ||
this.load = false; | ||
this.flushInfo = flushInfo; | ||
} | ||
|
||
public IOContext(Context context) { | ||
this(context, null); | ||
} | ||
|
||
private IOContext(boolean readOnce) { | ||
private IOContext(boolean readOnce, boolean load) { | ||
this.context = Context.READ; | ||
this.mergeInfo = null; | ||
this.readOnce = readOnce; | ||
this.load = load; | ||
this.flushInfo = null; | ||
} | ||
|
||
|
@@ -82,6 +95,7 @@ private IOContext(Context context, MergeInfo mergeInfo) { | |
assert context != Context.FLUSH : "Use IOContext(FlushInfo) to create a FLUSH IOContext"; | ||
this.context = context; | ||
this.readOnce = false; | ||
this.load = false; | ||
this.mergeInfo = mergeInfo; | ||
this.flushInfo = null; | ||
} | ||
|
@@ -99,6 +113,7 @@ public IOContext(IOContext ctxt, boolean readOnce) { | |
this.mergeInfo = ctxt.mergeInfo; | ||
this.flushInfo = ctxt.flushInfo; | ||
this.readOnce = readOnce; | ||
this.load = false; | ||
} | ||
|
||
@Override | ||
|
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
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.
I was wondering about this earlier, but it is really nice you fixed this,too!