thecoop commented on code in PR #14510: URL: https://github.com/apache/lucene/pull/14510#discussion_r2075387379
########## lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java: ########## @@ -277,6 +277,32 @@ public final long getMaxChunkSize() { return 1L << chunkSizePower; } + public static ReadAdvice toReadAdvice(IOContext context) { + if (context.context() == IOContext.Context.MERGE + || context.context() == IOContext.Context.FLUSH) { + return ReadAdvice.SEQUENTIAL; + } + + if (context.hints().contains(DataAccessHint.RANDOM)) { + return ReadAdvice.RANDOM; + } + if (context.hints().contains(DataAccessHint.SEQUENTIAL)) { + return ReadAdvice.SEQUENTIAL; + } + + if (context.hints().contains(FileTypeHint.DATA) + || context.hints().contains(FileTypeHint.INDEX)) { + return ReadAdvice.NORMAL; + } + // Postings have a forward-only access pattern, so pass ReadAdvice.NORMAL to perform + // readahead. + if (context.hints().contains(FileDataHint.POSTINGS)) { + return ReadAdvice.NORMAL; + } Review Comment: There's still `ReadAdvice.SEQUENTIAL`, with corresponding `DataAccessHint`, which is used for a few things - whilst we need to consolidate NORMAL vs SEQUENTIAL, I want to keep existing behaviour in this PR as much as as sensible, and modify it in subsequent PRs -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org