uschindler commented on code in PR #13570: URL: https://github.com/apache/lucene/pull/13570#discussion_r1679005037
########## lucene/core/src/java21/org/apache/lucene/store/MemorySegmentIndexInputProvider.java: ########## @@ -125,4 +134,31 @@ private final MemorySegment[] map( } return segments; } + + public ConcurrentHashMap<String, RefCountedSharedArena> attachment() { + return new ConcurrentHashMap<>(); + } + + /** + * Gets an arena for the give path, potentially aggregating files from the same segment into a + * single ref counted shared arena. A ref counted shared arena, if created will be added to the + * given arenas map. + */ + static Arena getSharedArena(Path p, ConcurrentHashMap<String, RefCountedSharedArena> arenas) { + String filename = p.getFileName().toString(); + String segmentName = IndexFileNames.parseSegmentName(filename); + if (filename.length() == segmentName.length()) { + // no segment found; just use a shared segment + return Arena.ofShared(); Review Comment: I think we should make sure to read the segments file with READONCE. The other code here is fine. All unknown index files are opened with a separate shared Arena, like before. So no need to change anything here. Just the one thing: Make sure we open the segments file with READONCE. -- 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