mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Support --bufferedio=[0,1] from db_bench. If bufferedio = 0, then the read code path clears the OS page cache after the IO is completed. The default remains as bufferedio=1
Summary: Task ID: # Blame Rev: Test Plan: Revert Plan: Differential Revision: https://reviews.facebook.net/D3429
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
#include "util/logging.h"
|
||||
#include "util/posix_logger.h"
|
||||
|
||||
bool useOsBuffer = 1; // cache data in OS buffers
|
||||
|
||||
namespace leveldb {
|
||||
|
||||
namespace {
|
||||
@@ -86,6 +88,9 @@ class PosixRandomAccessFile: public RandomAccessFile {
|
||||
// An error: return a non-ok status
|
||||
s = IOError(filename_, errno);
|
||||
}
|
||||
if (!useOsBuffer) {
|
||||
posix_fadvise(fd_, offset, n, POSIX_FADV_DONTNEED); // free OS pages
|
||||
}
|
||||
return s;
|
||||
}
|
||||
};
|
||||
@@ -329,7 +334,7 @@ class PosixEnv : public Env {
|
||||
int fd = open(fname.c_str(), O_RDONLY);
|
||||
if (fd < 0) {
|
||||
s = IOError(fname, errno);
|
||||
} else if (sizeof(void*) >= 8) {
|
||||
} else if (useOsBuffer && sizeof(void*) >= 8) {
|
||||
// Use mmap when virtual address-space is plentiful.
|
||||
uint64_t size;
|
||||
s = GetFileSize(fname, &size);
|
||||
|
||||
Reference in New Issue
Block a user