pitrou commented on a change in pull request #7172:
URL: https://github.com/apache/arrow/pull/7172#discussion_r425166680
##########
File path: cpp/src/arrow/io/file.cc
##########
@@ -262,6 +266,27 @@ class ReadableFile::ReadableFileImpl : public OSFile {
return std::move(buffer);
}
+ Status WillNeed(const std::vector<ReadRange>& ranges) {
+ RETURN_NOT_OK(CheckClosed());
+ for (const auto& range : ranges) {
+ RETURN_NOT_OK(internal::ValidateRange(range.offset, range.length));
+#if defined(POSIX_FADV_WILLNEED)
+ if (posix_fadvise(fd_, range.offset, range.length, POSIX_FADV_WILLNEED))
{
+ return IOErrorFromErrno(errno, "posix_fadvise failed");
+ }
+#elif defined(F_RDADVISE) // macOS, BSD?
+ struct {
+ off_t ra_offset;
+ int ra_count;
+ } radvisory{range.offset, static_cast<int>(range.length)};
Review comment:
Not really important: it's just an advisory anyway. At worse the kernel
will readahead too little.
----------------------------------------------------------------
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:
[email protected]