jasperjiaguo commented on code in PR #13721: URL: https://github.com/apache/pinot/pull/13721#discussion_r1717575947
########## pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/memory/unsafe/MmapMemory.java: ########## @@ -137,6 +149,32 @@ public long getAddress() { public UnmapFun getUnmapFun() { return _unmapFun; } + + /** + * Call posix_madvise (if available) at the address aligned start of MapSection for size bytes + * + * Internally posix_madvise operates on pages, so unaligned size would affect all remaining bytes on the page. + * _address is expected to be page aligned. + * In the future, it may be helpful to expose this to upstream consumers as a "hint()" abstraction in cases where + * advice other than MADV_RANDOM perform better (particularly sequential reads on slow filesystems). + * + * Errors during advise are ignored since this is considered a nice-to-have step. + * + * @param size Size of the region to set advice for. + * @param advice Specific advice to apply (see the LibC interface for options) + */ + protected void madvise(long size, int advice) { + if (LIB_C != null) { + LIB_C.posix_madvise(_address, size, advice); Review Comment: Do we want to log error code if this fails? -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org