提交 4028ae7d 编写于 作者: D Dhruba Borthakur

Do not cache readahead-pages in the OS cache.

Summary:
When posix_fadvise(offset, offset) is usedm it frees up only those
pages in that specified range. But the filesystem could have done some
read-aheads and those get cached in the OS cache.

Do not cache readahead-pages in the OS cache.

Test Plan: run db_bench benchmark.

Reviewers: vamsi, heyongqiang

Reviewed By: heyongqiang

Differential Revision: https://reviews.facebook.net/D5379
上级 7ecc5d4a
......@@ -94,7 +94,9 @@ class PosixRandomAccessFile: public RandomAccessFile {
s = IOError(filename_, errno);
}
if (!useOsBuffer) {
posix_fadvise(fd_, offset, n, POSIX_FADV_DONTNEED); // free OS pages
// we need to fadvise away the entire range of pages because
// we do not want readahead pages to be cached.
posix_fadvise(fd_, 0, 0, POSIX_FADV_DONTNEED); // free OS pages
}
return s;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册