uschindler commented on issue #758: LUCENE-8833: Add a #load() method to IndexInput to allow preloading file content into physical memory URL: https://github.com/apache/lucene-solr/pull/758#issuecomment-521674174 > I am still in review (have to feed my brain with all details, reading C++ source code of JVM and so on). > > Because of Adrien's comment you changed the slice building to also take the start position into account, so the slice method returns a byte buffer that is really only a view and a call to load() would not read data of the whole CFS file. > > As you changed this method to take care of the start offset/position, please fix the javadocs comment: > > ``` > /** Returns a sliced view from a set of already-existing buffers: > * the last buffer's limit() will be correct, but > * you must deal with offset separately (the first buffer will not be adjusted) */ > private ByteBuffer[] buildSlice(ByteBuffer[] buffers, long offset, long length) { > ``` I am not fully sure how the comment would look like. Currently it only fixes the start offset for single-buffer indexinputs. The code is horrible here, I still don't fully understand the code difference for single and multi buffer indexinputs. IMHO, we should change the code and make buildSlice always fix position() and limit() and build a buffer slice for the first and last buffer. How it's done currently is hard to understand. I cannot make any guarantees that the code behaves correctly after this patch and I am not sure if testing of all cases is fine. Maybe only apply to master first and let Jenkins test it.
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org