westonpace commented on a change in pull request #12150:
URL: https://github.com/apache/arrow/pull/12150#discussion_r785084565
##########
File path: cpp/src/arrow/io/test_common.cc
##########
@@ -48,6 +52,28 @@ void AssertFileContents(const std::string& path, const
std::string& contents) {
bool FileExists(const std::string& path) { return
std::ifstream(path.c_str()).good(); }
+Status PurgeLocalFileFromOsCache(const std::string& path) {
+#ifdef _WIN32
+ return Status::NotImplemented("Cannot yet purge files from cache on
Windows");
+#else
+ int fd = open(path.c_str(), O_WRONLY);
+ if (fd < 0) {
+ return IOErrorFromErrno(errno, "open on ", path,
+ " to clear from cache did not succeed.");
+ }
+ int err = posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED);
Review comment:
Good catch. I looked at file.cc and realized we are using:
```
#if defined(POSIX_FADV_WILLNEED)
```
which seems much better. I can't use that #if in the benchmark itself
though (unless I want to import fcntl.h which wouldn't be the worst thing) so I
changed it to SkipWithError.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]