diff options
Diffstat (limited to 'searchlib')
5 files changed, 19 insertions, 20 deletions
diff --git a/searchlib/src/vespa/searchlib/docstore/filechunk.cpp b/searchlib/src/vespa/searchlib/docstore/filechunk.cpp index d21278e2f84..84d64954e40 100644 --- a/searchlib/src/vespa/searchlib/docstore/filechunk.cpp +++ b/searchlib/src/vespa/searchlib/docstore/filechunk.cpp @@ -104,7 +104,7 @@ FileChunk::FileChunk(FileId fileId, NameId nameId, const vespalib::string & base } } -FileChunk::~FileChunk() { } +FileChunk::~FileChunk() = default; void FileChunk::addNumBuckets(size_t numBucketsInChunk) @@ -255,20 +255,20 @@ FileChunk::enableRead() { if (_tune._randRead.getWantDirectIO()) { LOG(debug, "enableRead(): DirectIORandRead: file='%s'", _dataFileName.c_str()); - _file.reset(new DirectIORandRead(_dataFileName)); + _file = std::make_unique<DirectIORandRead>(_dataFileName); } else if (_tune._randRead.getWantMemoryMap()) { const int mmapFlags(_tune._randRead.getMemoryMapFlags()); const int fadviseOptions(_tune._randRead.getAdvise()); if (frozen()) { LOG(debug, "enableRead(): MMapRandRead: file='%s'", _dataFileName.c_str()); - _file.reset(new MMapRandRead(_dataFileName, mmapFlags, fadviseOptions)); + _file = std::make_unique<MMapRandRead>(_dataFileName, mmapFlags, fadviseOptions); } else { LOG(debug, "enableRead(): MMapRandReadDynamic: file='%s'", _dataFileName.c_str()); - _file.reset(new MMapRandReadDynamic(_dataFileName, mmapFlags, fadviseOptions)); + _file = std::make_unique<MMapRandReadDynamic>(_dataFileName, mmapFlags, fadviseOptions); } } else { LOG(debug, "enableRead(): NormalRandRead: file='%s'", _dataFileName.c_str()); - _file.reset(new NormalRandRead(_dataFileName)); + _file = std::make_unique<NormalRandRead>(_dataFileName); } _dataHeaderLen = readDataHeader(*_file); if (_dataHeaderLen == 0u) { @@ -326,7 +326,7 @@ appendChunks(FixedParams * args, Chunk::UP chunk) } } } - if (args->visitorProgress != NULL) { + if (args->visitorProgress != nullptr) { args->visitorProgress->updateProgress(); } } @@ -554,7 +554,6 @@ FileChunk::isIdxFileEmpty(const vespalib::string & name) } else { throw SummaryException("Failed opening idx file readonly ", idxFile, VESPA_STRLOC); } - return false; } void diff --git a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp index 8fd5dc8ec24..91de6ba4276 100644 --- a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp +++ b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp @@ -53,7 +53,7 @@ LogDataStore::Config::operator == (const Config & rhs) const { LogDataStore::LogDataStore(vespalib::ThreadExecutor &executor, const vespalib::string &dirName, const Config &config, const GrowStrategy &growStrategy, const TuneFileSummary &tune, const FileHeaderContext &fileHeaderContext, transactionlog::SyncProxy &tlSyncer, - const IBucketizer::SP & bucketizer, bool readOnly) + IBucketizer::SP bucketizer, bool readOnly) : IDataStore(dirName), _config(config), _tune(tune), @@ -70,7 +70,7 @@ LogDataStore::LogDataStore(vespalib::ThreadExecutor &executor, const vespalib::s _executor(executor), _initFlushSyncToken(0), _tlSyncer(tlSyncer), - _bucketizer(bucketizer), + _bucketizer(std::move(bucketizer)), _currentlyCompacting(), _compactLidSpaceGeneration() { @@ -182,7 +182,7 @@ LogDataStore::write(uint64_t serialNum, uint32_t lid, const void * buffer, size_ void LogDataStore::write(LockGuard guard, FileId destinationFileId, uint32_t lid, const void * buffer, size_t len) { - WriteableFileChunk & destination = static_cast<WriteableFileChunk &>(*_fileChunks[destinationFileId.getId()]); + auto & destination = static_cast<WriteableFileChunk &>(*_fileChunks[destinationFileId.getId()]); write(std::move(guard), destination, destination.getSerialNum(), lid, buffer, len); } @@ -474,10 +474,10 @@ void LogDataStore::compactFile(FileId fileId) setNewFileChunk(guard, createWritableFile(destinationFileId, fc->getLastPersistedSerialNum(), fc->getNameId().next())); } size_t numSignificantBucketBits = computeNumberOfSignificantBucketIdBits(*_bucketizer, fc->getFileId()); - compacter.reset(new BucketCompacter(numSignificantBucketBits, _config.compactCompression(), *this, _executor, - *_bucketizer, fc->getFileId(), destinationFileId)); + compacter = std::make_unique<BucketCompacter>(numSignificantBucketBits, _config.compactCompression(), *this, _executor, + *_bucketizer, fc->getFileId(), destinationFileId); } else { - compacter.reset(new docstore::Compacter(*this)); + compacter = std::make_unique<docstore::Compacter>(*this); } fc->appendTo(_executor, *this, *compacter, fc->getNumChunks(), nullptr); @@ -486,7 +486,7 @@ void LogDataStore::compactFile(FileId fileId) flushActiveAndWait(0); } else { LockGuard guard(_updateLock); - WriteableFileChunk & compactTo = dynamic_cast<WriteableFileChunk &>(*_fileChunks[destinationFileId.getId()]); + auto & compactTo = dynamic_cast<WriteableFileChunk &>(*_fileChunks[destinationFileId.getId()]); flushFileAndWait(std::move(guard), compactTo, 0); compactTo.freeze(); } @@ -515,7 +515,7 @@ void LogDataStore::compactFile(FileId fileId) * Wait for requireSpace() and flush() methods to leave chunk * alone. */ - std::this_thread::sleep_for(1s);; + std::this_thread::sleep_for(1s); } toDie->erase(); LockGuard guard(_updateLock); diff --git a/searchlib/src/vespa/searchlib/docstore/logdatastore.h b/searchlib/src/vespa/searchlib/docstore/logdatastore.h index 6217576172c..39b2c2b7100 100644 --- a/searchlib/src/vespa/searchlib/docstore/logdatastore.h +++ b/searchlib/src/vespa/searchlib/docstore/logdatastore.h @@ -87,7 +87,7 @@ public: LogDataStore(vespalib::ThreadExecutor &executor, const vespalib::string &dirName, const Config & config, const GrowStrategy &growStrategy, const TuneFileSummary &tune, const search::common::FileHeaderContext &fileHeaderContext, - transactionlog::SyncProxy &tlSyncer, const IBucketizer::SP & bucketizer, bool readOnly = false); + transactionlog::SyncProxy &tlSyncer, IBucketizer::SP bucketizer, bool readOnly = false); ~LogDataStore() override; diff --git a/searchlib/src/vespa/searchlib/docstore/logdocumentstore.cpp b/searchlib/src/vespa/searchlib/docstore/logdocumentstore.cpp index c285d4323c2..38be9733cfb 100644 --- a/searchlib/src/vespa/searchlib/docstore/logdocumentstore.cpp +++ b/searchlib/src/vespa/searchlib/docstore/logdocumentstore.cpp @@ -20,10 +20,10 @@ LogDocumentStore::LogDocumentStore(vespalib::ThreadExecutor & executor, const TuneFileSummary & tuneFileSummary, const FileHeaderContext &fileHeaderContext, transactionlog::SyncProxy &tlSyncer, - const IBucketizer::SP & bucketizer) + IBucketizer::SP bucketizer) : DocumentStore(config, _backingStore), _backingStore(executor, baseDir, config.getLogConfig(), growStrategy, - tuneFileSummary, fileHeaderContext, tlSyncer, bucketizer) + tuneFileSummary, fileHeaderContext, tlSyncer, std::move(bucketizer)) {} LogDocumentStore::~LogDocumentStore() = default; diff --git a/searchlib/src/vespa/searchlib/docstore/logdocumentstore.h b/searchlib/src/vespa/searchlib/docstore/logdocumentstore.h index 3c9aefc9934..46e60d9245f 100644 --- a/searchlib/src/vespa/searchlib/docstore/logdocumentstore.h +++ b/searchlib/src/vespa/searchlib/docstore/logdocumentstore.h @@ -47,8 +47,8 @@ public: LogDocumentStore(vespalib::ThreadExecutor & executor, const vespalib::string & baseDir, const Config & config, const GrowStrategy & growStrategy, const TuneFileSummary &tuneFileSummary, const common::FileHeaderContext &fileHeaderContext, - transactionlog::SyncProxy &tlSyncer, const IBucketizer::SP & bucketizer); - ~LogDocumentStore(); + transactionlog::SyncProxy &tlSyncer, IBucketizer::SP bucketizer); + ~LogDocumentStore() override; void reconfigure(const Config & config); private: void compact(uint64_t syncToken) override { _backingStore.compact(syncToken); } |