diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-06-08 08:55:04 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-06-08 08:55:04 +0200 |
commit | 97dc69305fe2ad57e90e0aeedc9006322a9c32ed (patch) | |
tree | 394c98e1c517f22403bdf91f95cc89be6c17ec96 /searchlib | |
parent | 1e6f90a6b89b20f346c44a176158ca99c10807ac (diff) |
Must wait until data are visible through the filesystem.
Diffstat (limited to 'searchlib')
-rw-r--r-- | searchlib/src/vespa/searchlib/docstore/randreaders.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/searchlib/src/vespa/searchlib/docstore/randreaders.cpp b/searchlib/src/vespa/searchlib/docstore/randreaders.cpp index 2d25efead56..426dbe11300 100644 --- a/searchlib/src/vespa/searchlib/docstore/randreaders.cpp +++ b/searchlib/src/vespa/searchlib/docstore/randreaders.cpp @@ -116,23 +116,18 @@ MMapRandReadDynamic::read(size_t offset, vespalib::DataBuffer & buffer, size_t s { FSP file(_holder.get()); const char * data(static_cast<const char *>(file->MemoryMapPtr(offset))); - if ((data == nullptr) || (file->MemoryMapPtr(offset+sz-1) == nullptr)) { + while ((data == nullptr) || (file->MemoryMapPtr(offset+sz-1) == nullptr)) { // Must check that both start and end of file is mapped in. - // Previous reopen could happend during a partial write of this buffer. - // This should fix bug 4630695. reopen(); file = _holder.get(); data = static_cast<const char *>(file->MemoryMapPtr(offset)); - assert(data != nullptr); - assert(file->MemoryMapPtr(offset+sz-1) != nullptr); } vespalib::DataBuffer(data, sz).swap(buffer); return file; } int64_t -MMapRandReadDynamic::getSize() -{ +MMapRandReadDynamic::getSize() { return _holder.get()->GetSize(); } |