summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-11-14 18:59:56 +0100
committerHenning Baldersheim <balder@oath.com>2018-11-14 21:06:49 +0100
commit7ee677bbef541862328ff9f9acf8e3fb2d7c4300 (patch)
tree27338c06e984aba806e14f5b679c11cae624df72 /searchlib
parent53a44efd14c23410adec85f2a069d5e14c2e3a4b (diff)
Actually set configured fadvise options.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.h2
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/diskindex.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/diskindex.h4
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/pagedict4randread.cpp11
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/zcposting.cpp16
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/zcpostingiterators.cpp10
7 files changed, 29 insertions, 24 deletions
diff --git a/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp b/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp
index 0e8538386a0..b898405be07 100644
--- a/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp
+++ b/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp
@@ -21,7 +21,7 @@ BitVectorDictionary::BitVectorDictionary()
BitVectorDictionary::~BitVectorDictionary()
{
- if (_datFile.get() != nullptr) {
+ if (_datFile) {
_datFile->Close();
}
}
@@ -62,7 +62,9 @@ BitVectorDictionary::open(const vespalib::string &pathPrefix,
idxFile.Close();
_vectorSize = BitVector::getFileBytes(_docIdLimit);
- _datFile.reset(new FastOS_File());
+ _datFile = std::make_unique<FastOS_File>();
+ _datFile->setFAdviseOptions(tuneFileRead.getAdvise());
+
if (tuneFileRead.getWantMemoryMap()) {
_datFile->enableMemoryMap(tuneFileRead.getMemoryMapFlags());
} else if (tuneFileRead.getWantDirectIO()) {
diff --git a/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.h b/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.h
index 32a30ba6361..79c892c6ed7 100644
--- a/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.h
+++ b/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.h
@@ -51,7 +51,7 @@ public:
* bit vector if found.
*
* @param wordNum the word number to lookup a bit vector for.
- * @return the loaded bit vector or NULL if not found.
+ * @return the loaded bit vector or nullptr if not found.
**/
BitVector::UP lookup(uint64_t wordNum);
diff --git a/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp b/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp
index 4b163ee07d2..9a6144e9635 100644
--- a/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp
+++ b/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp
@@ -299,7 +299,7 @@ DiskIndex::readPostingList(const LookupResult &lookupRes) const
handle->_bitLength = lookupRes.counts._bitLength;
SchemaUtil::IndexIterator it(_schema, lookupRes.indexId);
handle->_file = _postingFiles[it.getIndex()].get();
- if (handle->_file == NULL) {
+ if (handle->_file == nullptr) {
return PostingListHandle::UP();
}
const uint32_t firstSegment = 0;
@@ -317,7 +317,7 @@ DiskIndex::readBitVector(const LookupResult &lookupRes) const
{
SchemaUtil::IndexIterator it(_schema, lookupRes.indexId);
BitVectorDictionary * dict = _bitVectorDicts[it.getIndex()].get();
- if (dict == NULL) {
+ if (dict == nullptr) {
return BitVector::UP();
}
return dict->lookup(lookupRes.wordNum);
diff --git a/searchlib/src/vespa/searchlib/diskindex/diskindex.h b/searchlib/src/vespa/searchlib/diskindex/diskindex.h
index 382f04ffdbd..4bef53a3030 100644
--- a/searchlib/src/vespa/searchlib/diskindex/diskindex.h
+++ b/searchlib/src/vespa/searchlib/diskindex/diskindex.h
@@ -106,7 +106,7 @@ public:
* @param indexId the id of the field to
* perform lookup for.
* @param word the word to lookup.
- * @return the lookup result or NULL if the word is not found.
+ * @return the lookup result or nullptr if the word is not found.
**/
LookupResult::UP lookup(uint32_t indexId, vespalib::stringref word);
LookupResultVector lookup(const std::vector<uint32_t> & indexes, vespalib::stringref word);
@@ -124,7 +124,7 @@ public:
* Read the bit vector corresponding to the given lookup result.
*
* @param lookupRes the result of the previous dictionary lookup.
- * @return the bit vector or NULL if no bit vector exists for the
+ * @return the bit vector or nullptr if no bit vector exists for the
* word in the lookup result.
**/
BitVector::UP readBitVector(const LookupResult &lookupRes) const;
diff --git a/searchlib/src/vespa/searchlib/diskindex/pagedict4randread.cpp b/searchlib/src/vespa/searchlib/diskindex/pagedict4randread.cpp
index 0ae141fd827..4ee37470e1d 100644
--- a/searchlib/src/vespa/searchlib/diskindex/pagedict4randread.cpp
+++ b/searchlib/src/vespa/searchlib/diskindex/pagedict4randread.cpp
@@ -25,9 +25,9 @@ PageDict4RandRead::PageDict4RandRead()
_ssReader(),
_ssd(),
_ssReadContext(_ssd),
- _ssfile(new FastOS_File()),
- _spfile(new FastOS_File()),
- _pfile(new FastOS_File()),
+ _ssfile(std::make_unique<FastOS_File>()),
+ _spfile(std::make_unique<FastOS_File>()),
+ _pfile(std::make_unique<FastOS_File>()),
_ssFileBitSize(0u),
_spFileBitSize(0u),
_pFileBitSize(0u),
@@ -210,6 +210,10 @@ PageDict4RandRead::open(const vespalib::string &name,
_spfile->enableMemoryMap(mmapFlags);
_pfile->enableMemoryMap(mmapFlags);
+ int fadvise = tuneFileRead.getAdvise();
+ _ssfile->setFAdviseOptions(fadvise);
+ _spfile->setFAdviseOptions(fadvise);
+ _pfile->setFAdviseOptions(fadvise);
if (!_ssfile->OpenReadOnly(ssname.c_str())) {
LOG(error, "could not open %s: %s", _ssfile->GetFileName(), getLastErrorString().c_str());
@@ -257,7 +261,6 @@ PageDict4RandRead::close()
return true;
}
-
uint64_t
PageDict4RandRead::getNumWordIds() const
{
diff --git a/searchlib/src/vespa/searchlib/diskindex/zcposting.cpp b/searchlib/src/vespa/searchlib/diskindex/zcposting.cpp
index 688e3ef59e1..d51a592bf2b 100644
--- a/searchlib/src/vespa/searchlib/diskindex/zcposting.cpp
+++ b/searchlib/src/vespa/searchlib/diskindex/zcposting.cpp
@@ -78,7 +78,7 @@ Zc4PostingSeqRead(PostingListCountFileSeqRead *countFile)
_wordStart(0),
_residue(0)
{
- if (_countFile != NULL) {
+ if (_countFile != nullptr) {
PostingListParams params;
_countFile->getParams(params);
params.get("docIdLimit", _docIdLimit);
@@ -492,7 +492,7 @@ Zc4PostingSeqRead::close()
{
_readContext.dropComprBuf();
_file.Close();
- _readContext.setFile(NULL);
+ _readContext.setFile(nullptr);
return true;
}
@@ -500,7 +500,7 @@ Zc4PostingSeqRead::close()
void
Zc4PostingSeqRead::getParams(PostingListParams &params)
{
- if (_countFile != NULL) {
+ if (_countFile != nullptr) {
PostingListParams countParams;
_countFile->getParams(countParams);
params = countParams;
@@ -614,7 +614,7 @@ Zc4PostingSeqWrite(PostingListCountFileSeqWrite *countFile)
_minSkipDocs(64),
_docIdLimit(10000000),
_docIds(),
- _encodeFeatures(NULL),
+ _encodeFeatures(nullptr),
_featureOffset(0),
_featureWriteContext(sizeof(uint64_t)),
_writePos(0),
@@ -630,7 +630,7 @@ Zc4PostingSeqWrite(PostingListCountFileSeqWrite *countFile)
{
_encodeContext.setWriteContext(&_writeContext);
- if (_countFile != NULL) {
+ if (_countFile != nullptr) {
PostingListParams params;
_countFile->getParams(params);
params.get("docIdLimit", _docIdLimit);
@@ -874,7 +874,7 @@ Zc4PostingSeqWrite::close()
_writeContext.dropComprBuf();
_file.Sync();
_file.Close();
- _writeContext.setFile(NULL);
+ _writeContext.setFile(nullptr);
updateHeader();
return true;
}
@@ -885,7 +885,7 @@ void
Zc4PostingSeqWrite::
setParams(const PostingListParams &params)
{
- if (_countFile != NULL)
+ if (_countFile != nullptr)
_countFile->setParams(params);
params.get("docIdLimit", _docIdLimit);
params.get("minChunkDocs", _minChunkDocs);
@@ -897,7 +897,7 @@ void
Zc4PostingSeqWrite::
getParams(PostingListParams &params)
{
- if (_countFile != NULL) {
+ if (_countFile != nullptr) {
PostingListParams countParams;
_countFile->getParams(countParams);
params = countParams;
diff --git a/searchlib/src/vespa/searchlib/diskindex/zcpostingiterators.cpp b/searchlib/src/vespa/searchlib/diskindex/zcpostingiterators.cpp
index c3261878b45..513f39c47f8 100644
--- a/searchlib/src/vespa/searchlib/diskindex/zcpostingiterators.cpp
+++ b/searchlib/src/vespa/searchlib/diskindex/zcpostingiterators.cpp
@@ -37,7 +37,7 @@ template <bool bigEndian>
Zc4RareWordPostingIterator<bigEndian>::
Zc4RareWordPostingIterator(const TermFieldMatchDataArray &matchData, Position start, uint32_t docIdLimit)
: ZcIteratorBase(matchData, start, docIdLimit),
- _decodeContext(NULL),
+ _decodeContext(nullptr),
_residue(0),
_prevDocId(0),
_numDocs(0)
@@ -204,8 +204,8 @@ ZcRareWordPostingIterator<bigEndian>::readWordStart(uint32_t docIdLimit)
ZcPostingIteratorBase::ZcPostingIteratorBase(const TermFieldMatchDataArray &matchData, Position start, uint32_t docIdLimit)
: ZcIteratorBase(matchData, start, docIdLimit),
- _valI(NULL),
- _valIBase(NULL),
+ _valI(nullptr),
+ _valIBase(nullptr),
_featureSeekPos(0),
_l1(),
_l2(),
@@ -226,12 +226,12 @@ ZcPostingIterator(uint32_t minChunkDocs,
const search::fef::TermFieldMatchDataArray &matchData,
Position start, uint32_t docIdLimit)
: ZcPostingIteratorBase(matchData, start, docIdLimit),
- _decodeContext(NULL),
+ _decodeContext(nullptr),
_minChunkDocs(minChunkDocs),
_docIdK(0),
_dynamicK(dynamicK),
_numDocs(0),
- _featuresValI(NULL),
+ _featuresValI(nullptr),
_featuresBitOffset(0),
_counts(counts)
{ }