aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-02-13 15:50:12 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-02-13 15:50:12 +0000
commit8464c3678aac538a5bd1cc052681d419d6bfcac6 (patch)
treea5a8174ae86f8a73502378da7146f511d301c9ad
parente2b02d3b7978d831293d88bc3c75c6582ef9418b (diff)
Less asserts in header files.
-rw-r--r--searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/feedoperation/lidvectorcontext.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp33
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/memoryconfigstore.cpp7
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/memoryconfigstore.h22
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.cpp1
-rw-r--r--searchlib/src/apps/docstore/create-idx-from-dat.cpp1
-rw-r--r--searchlib/src/tests/bitvector/bitvectorbenchmark.cpp1
-rw-r--r--searchlib/src/tests/sortresults/sorttest.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/common/bitvector.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/common/bitvectorcache.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/common/condensedbitvectors.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/common/growablebitvector.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/common/resultset.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/bitvectorfile.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/bitvectoridxfile.cpp11
-rw-r--r--searchlib/src/vespa/searchlib/docstore/logdatastore.cpp31
-rw-r--r--searchlib/src/vespa/searchlib/docstore/logdatastore.h29
-rw-r--r--searchlib/src/vespa/searchlib/memoryindex/field_index_collection.cpp9
-rw-r--r--searchlib/src/vespa/searchlib/memoryindex/field_index_collection.h2
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/hitcollector.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/iterator_pack.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/tensor/hnsw_graph.cpp17
-rw-r--r--searchlib/src/vespa/searchlib/tensor/hnsw_graph.h15
-rw-r--r--staging_vespalib/src/vespa/vespalib/stllike/lrucache_map.hpp1
-rw-r--r--vespalib/src/vespa/vespalib/datastore/allocator.hpp1
-rw-r--r--vespalib/src/vespa/vespalib/datastore/bufferstate.cpp9
-rw-r--r--vespalib/src/vespa/vespalib/datastore/bufferstate.h5
-rw-r--r--vespalib/src/vespa/vespalib/datastore/datastorebase.cpp4
-rw-r--r--vespalib/src/vespa/vespalib/util/generationhandler.cpp66
-rw-r--r--vespalib/src/vespa/vespalib/util/generationhandler.h79
-rw-r--r--vespalib/src/vespa/vespalib/util/generationholder.cpp3
-rw-r--r--vespalib/src/vespa/vespalib/util/rcuvector.hpp1
41 files changed, 191 insertions, 179 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.cpp
index 53c8bbc8ae4..b971d3eb430 100644
--- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.cpp
+++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_hold_list.cpp
@@ -2,6 +2,7 @@
#include "lid_hold_list.h"
#include "lidstatevector.h"
+#include <cassert>
namespace proton {
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.cpp
index d2490985e77..05b1cecd84e 100644
--- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.cpp
+++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lidstatevector.cpp
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "lidstatevector.h"
+#include <cassert>
namespace proton {
diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/lidvectorcontext.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/lidvectorcontext.cpp
index 9a1d993aada..1dc823a6b04 100644
--- a/searchcore/src/vespa/searchcore/proton/feedoperation/lidvectorcontext.cpp
+++ b/searchcore/src/vespa/searchcore/proton/feedoperation/lidvectorcontext.cpp
@@ -3,6 +3,7 @@
#include "lidvectorcontext.h"
#include <vespa/searchlib/common/bitvector.h>
#include <vespa/vespalib/objects/nbostream.h>
+#include <cassert>
#include <vespa/log/log.h>
LOG_SETUP(".proton.feedoperation.lidvectorcontext");
diff --git a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp
index baf89a55ae3..c643c338856 100644
--- a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp
@@ -7,7 +7,7 @@
#include <vespa/config-bucketspaces.h>
#include <vespa/searchlib/common/tunefileinfo.hpp>
#include <vespa/vespalib/io/fileutil.h>
-
+#include <cassert>
#include <vespa/log/log.h>
LOG_SETUP(".proton.server.bootstrapconfigmanager");
@@ -31,7 +31,7 @@ BootstrapConfigManager::BootstrapConfigManager(const vespalib::string & configId
_pendingConfigMutex()
{ }
-BootstrapConfigManager::~BootstrapConfigManager() { }
+BootstrapConfigManager::~BootstrapConfigManager() = default;
const ConfigKeySet
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp
index 2c9249c0049..fbdff698b9b 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp
@@ -21,6 +21,7 @@
#include <vespa/searchsummary/config/config-juniperrc.h>
#include <vespa/vespalib/time/time_box.h>
#include <thread>
+#include <cassert>
#include <vespa/log/log.h>
LOG_SETUP(".proton.server.documentdbconfigmanager");
diff --git a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp
index c9333cde0a8..47a379b0647 100644
--- a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp
@@ -22,6 +22,7 @@
#include <vespa/searchlib/transactionlog/client_session.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/util/lambdatask.h>
+#include <cassert>
#include <unistd.h>
#include <vespa/log/log.h>
diff --git a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp
index e66043aa422..9f67058a2d7 100644
--- a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp
@@ -19,6 +19,7 @@
#include <vespa/searchsummary/config/config-juniperrc.h>
#include <vespa/config/helper/configgetter.hpp>
#include <sstream>
+#include <cassert>
#include <fcntl.h>
#include <vespa/log/log.h>
@@ -56,7 +57,6 @@ makeSnapDirBaseName(SerialNum serialNum)
return os.str();
}
-
void
fsyncFile(const vespalib::string &fileName)
{
@@ -93,7 +93,6 @@ save(const vespalib::string &snapDir, const Config &config)
saveHelper(snapDir, config.defName(), config);
}
-
class ConfigFile
{
typedef std::shared_ptr<ConfigFile> SP;
@@ -110,13 +109,10 @@ public:
const vespalib::string &fullName);
nbostream &serialize(nbostream &stream) const;
-
nbostream &deserialize(nbostream &stream);
-
void save(const vespalib::string &snapDir) const;
};
-
ConfigFile::ConfigFile()
: _name(),
_modTime(0),
@@ -124,8 +120,7 @@ ConfigFile::ConfigFile()
{
}
-ConfigFile::~ConfigFile() {}
-
+ConfigFile::~ConfigFile() = default;
ConfigFile::ConfigFile(const vespalib::string &name,
const vespalib::string &fullName)
@@ -144,7 +139,6 @@ ConfigFile::ConfigFile(const vespalib::string &name,
file.Close();
}
-
nbostream &
ConfigFile::serialize(nbostream &stream) const
{
@@ -157,7 +151,6 @@ ConfigFile::serialize(nbostream &stream) const
return stream;
}
-
nbostream &
ConfigFile::deserialize(nbostream &stream)
{
@@ -175,7 +168,6 @@ ConfigFile::deserialize(nbostream &stream)
return stream;
}
-
void
ConfigFile::save(const vespalib::string &snapDir) const
{
@@ -193,21 +185,18 @@ ConfigFile::save(const vespalib::string &snapDir) const
fsyncFile(fullName);
}
-
nbostream &
operator<<(nbostream &stream, const ConfigFile &configFile)
{
return configFile.serialize(stream);
}
-
nbostream &
operator>>(nbostream &stream, ConfigFile &configFile)
{
return configFile.deserialize(stream);
}
-
std::vector<vespalib::string>
getFileList(const vespalib::string &snapDir)
{
@@ -223,7 +212,6 @@ getFileList(const vespalib::string &snapDir)
return res;
}
-
}
FileConfigManager::FileConfigManager(const vespalib::string &baseDir,
@@ -243,11 +231,7 @@ FileConfigManager::FileConfigManager(const vespalib::string &baseDir,
_protonConfig.reset(new ProtonConfig());
}
-
-FileConfigManager::~FileConfigManager()
-{
-}
-
+FileConfigManager::~FileConfigManager() = default;
SerialNum
FileConfigManager::getBestSerialNum() const
@@ -256,7 +240,6 @@ FileConfigManager::getBestSerialNum() const
return snap.valid ? snap.syncToken : UINT64_C(0);
}
-
SerialNum
FileConfigManager::getOldestSerialNum() const
{
@@ -271,7 +254,6 @@ FileConfigManager::getOldestSerialNum() const
return res;
}
-
void
FileConfigManager::saveConfig(const DocumentDBConfig &snapshot,
SerialNum serialNum)
@@ -389,7 +371,6 @@ FileConfigManager::loadConfig(const DocumentDBConfig &currentSnapshot,
loadedSnapshot->setConfigId(_configId);
}
-
void
FileConfigManager::removeInvalid()
{
@@ -422,7 +403,6 @@ FileConfigManager::removeInvalid()
(void) saveRemInvalidSnap;
}
-
void
FileConfigManager::prune(SerialNum serialNum)
{
@@ -448,7 +428,6 @@ FileConfigManager::prune(SerialNum serialNum)
removeInvalid();
}
-
bool
FileConfigManager::hasValidSerial(SerialNum serialNum) const
{
@@ -456,7 +435,6 @@ FileConfigManager::hasValidSerial(SerialNum serialNum) const
return snap.valid;
}
-
SerialNum
FileConfigManager::getPrevValidSerial(SerialNum serialNum) const
{
@@ -471,7 +449,6 @@ FileConfigManager::getPrevValidSerial(SerialNum serialNum) const
return res;
}
-
void
FileConfigManager::serializeConfig(SerialNum serialNum, nbostream &stream)
{
@@ -490,7 +467,6 @@ FileConfigManager::serializeConfig(SerialNum serialNum, nbostream &stream)
}
}
-
void
FileConfigManager::deserializeConfig(SerialNum serialNum, nbostream &stream)
{
@@ -525,13 +501,10 @@ FileConfigManager::deserializeConfig(SerialNum serialNum, nbostream &stream)
}
}
-
void
FileConfigManager::setProtonConfig(const ProtonConfigSP &protonConfig)
{
_protonConfig = protonConfig;
}
-
-
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/memoryconfigstore.cpp b/searchcore/src/vespa/searchcore/proton/server/memoryconfigstore.cpp
index 2cf8d3c113c..6f536aa4952 100644
--- a/searchcore/src/vespa/searchcore/proton/server/memoryconfigstore.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/memoryconfigstore.cpp
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "memoryconfigstore.h"
+#include <cassert>
#include <vespa/log/log.h>
LOG_SETUP(".proton.server.memoryconfigstore");
@@ -9,7 +10,7 @@ namespace proton {
MemoryConfigStore::MemoryConfigStore() : _maps(new ConfigMaps) {}
MemoryConfigStore::MemoryConfigStore(ConfigMaps::SP maps) : _maps(maps) {}
-MemoryConfigStore::~MemoryConfigStore() { }
+MemoryConfigStore::~MemoryConfigStore() = default;
ConfigStore::SerialNum
MemoryConfigStore::getBestSerialNum() const {
@@ -77,8 +78,8 @@ MemoryConfigStore::deserializeConfig(SerialNum, vespalib::nbostream &) {
void
MemoryConfigStore::setProtonConfig(const ProtonConfigSP &) { }
-MemoryConfigStores::MemoryConfigStores() { }
-MemoryConfigStores::~MemoryConfigStores() { }
+MemoryConfigStores::MemoryConfigStores() = default;
+MemoryConfigStores::~MemoryConfigStores() = default;
ConfigStore::UP
MemoryConfigStores::getConfigStore(const std::string &type) {
diff --git a/searchcore/src/vespa/searchcore/proton/server/memoryconfigstore.h b/searchcore/src/vespa/searchcore/proton/server/memoryconfigstore.h
index f826c19d341..02c7ebe2d0c 100644
--- a/searchcore/src/vespa/searchcore/proton/server/memoryconfigstore.h
+++ b/searchcore/src/vespa/searchcore/proton/server/memoryconfigstore.h
@@ -26,19 +26,17 @@ public:
MemoryConfigStore(ConfigMaps::SP maps);
~MemoryConfigStore();
- virtual SerialNum getBestSerialNum() const override;
- virtual SerialNum getOldestSerialNum() const override;
- virtual bool hasValidSerial(SerialNum serial) const override;
- virtual SerialNum getPrevValidSerial(SerialNum serial) const override;
- virtual void saveConfig(const DocumentDBConfig &config,
- SerialNum serial) override;
- virtual void loadConfig(const DocumentDBConfig &, SerialNum serial,
- DocumentDBConfig::SP &loaded_config) override;
- virtual void removeInvalid() override;
+ SerialNum getBestSerialNum() const override;
+ SerialNum getOldestSerialNum() const override;
+ bool hasValidSerial(SerialNum serial) const override;
+ SerialNum getPrevValidSerial(SerialNum serial) const override;
+ void saveConfig(const DocumentDBConfig &config, SerialNum serial) override;
+ void loadConfig(const DocumentDBConfig &, SerialNum serial, DocumentDBConfig::SP &loaded_config) override;
+ void removeInvalid() override;
void prune(SerialNum serial) override;
- virtual void serializeConfig(SerialNum, vespalib::nbostream &) override;
- virtual void deserializeConfig(SerialNum, vespalib::nbostream &) override;
- virtual void setProtonConfig(const ProtonConfigSP &) override;
+ void serializeConfig(SerialNum, vespalib::nbostream &) override;
+ void deserializeConfig(SerialNum, vespalib::nbostream &) override;
+ void setProtonConfig(const ProtonConfigSP &) override;
};
// Holds the state of a set of MemoryConfigStore objects, making stored
diff --git a/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.cpp b/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.cpp
index 2108327a422..8820602d816 100644
--- a/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.cpp
@@ -7,6 +7,7 @@
#include <vespa/config/common/exceptions.h>
#include <vespa/vespalib/util/exceptions.h>
#include <thread>
+#include <cassert>
#include <vespa/log/log.h>
LOG_SETUP(".proton.server.proton_config_fetcher");
diff --git a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.cpp
index b776e32e0db..08209f8b2d5 100644
--- a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.cpp
@@ -5,6 +5,7 @@
#include <vespa/searchlib/transactionlog/translogclient.h>
#include <vespa/searchcore/proton/common/eventlogger.h>
#include <vespa/vespalib/util/exceptions.h>
+#include <cassert>
#include <vespa/log/log.h>
LOG_SETUP(".proton.server.transactionlogmanager");
diff --git a/searchlib/src/apps/docstore/create-idx-from-dat.cpp b/searchlib/src/apps/docstore/create-idx-from-dat.cpp
index 46aca14325f..f58b5f20ea9 100644
--- a/searchlib/src/apps/docstore/create-idx-from-dat.cpp
+++ b/searchlib/src/apps/docstore/create-idx-from-dat.cpp
@@ -7,6 +7,7 @@
#include <vespa/fastos/app.h>
#include <vespa/vespalib/util/exception.h>
#include <cinttypes>
+#include <cassert>
using namespace search;
diff --git a/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp b/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp
index 842c42d4189..17300125ed4 100644
--- a/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp
+++ b/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp
@@ -5,6 +5,7 @@
#include <iostream>
#include <string>
#include <vector>
+#include <cassert>
LOG_SETUP("bitvectorbenchmark");
diff --git a/searchlib/src/tests/sortresults/sorttest.cpp b/searchlib/src/tests/sortresults/sorttest.cpp
index 6bcdca6b2af..d6794637351 100644
--- a/searchlib/src/tests/sortresults/sorttest.cpp
+++ b/searchlib/src/tests/sortresults/sorttest.cpp
@@ -2,6 +2,7 @@
#include <vespa/searchlib/common/bitvector.h>
#include <vespa/searchlib/common/sortresults.h>
+#include <cassert>
using search::RankedHit;
diff --git a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.cpp b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.cpp
index 552c542b3f7..b8378b059f6 100644
--- a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping_base.cpp
@@ -2,6 +2,7 @@
#include "multi_value_mapping_base.h"
#include <vespa/searchcommon/common/compaction_strategy.h>
+#include <cassert>
namespace search::attribute {
diff --git a/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp b/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp
index 659e3718a13..6e340615305 100644
--- a/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp
+++ b/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp
@@ -2,6 +2,7 @@
#include "allocatedbitvector.h"
#include <cstring>
+#include <cassert>
namespace search {
diff --git a/searchlib/src/vespa/searchlib/common/bitvector.cpp b/searchlib/src/vespa/searchlib/common/bitvector.cpp
index 0a33e23de72..8953710e8c7 100644
--- a/searchlib/src/vespa/searchlib/common/bitvector.cpp
+++ b/searchlib/src/vespa/searchlib/common/bitvector.cpp
@@ -8,6 +8,7 @@
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/fastos/file.h>
+#include <cassert>
#include <vespa/log/log.h>
LOG_SETUP(".searchlib.common.bitvector");
diff --git a/searchlib/src/vespa/searchlib/common/bitvectorcache.cpp b/searchlib/src/vespa/searchlib/common/bitvectorcache.cpp
index 4b5fc8a06c9..6b873d8a7c1 100644
--- a/searchlib/src/vespa/searchlib/common/bitvectorcache.cpp
+++ b/searchlib/src/vespa/searchlib/common/bitvectorcache.cpp
@@ -2,6 +2,7 @@
#include "bitvectorcache.h"
#include <vespa/vespalib/stllike/hash_map.hpp>
#include <algorithm>
+#include <cassert>
#include <vespa/log/log.h>
LOG_SETUP(".searchlib.common.bitvectorcache");
diff --git a/searchlib/src/vespa/searchlib/common/condensedbitvectors.cpp b/searchlib/src/vespa/searchlib/common/condensedbitvectors.cpp
index 00b1620903f..d6efc4fddc2 100644
--- a/searchlib/src/vespa/searchlib/common/condensedbitvectors.cpp
+++ b/searchlib/src/vespa/searchlib/common/condensedbitvectors.cpp
@@ -2,6 +2,7 @@
#include "condensedbitvectors.h"
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/util/rcuvector.h>
+#include <cassert>
using vespalib::IllegalArgumentException;
using vespalib::make_string;
diff --git a/searchlib/src/vespa/searchlib/common/growablebitvector.cpp b/searchlib/src/vespa/searchlib/common/growablebitvector.cpp
index 5062bb78e79..cf53b202a42 100644
--- a/searchlib/src/vespa/searchlib/common/growablebitvector.cpp
+++ b/searchlib/src/vespa/searchlib/common/growablebitvector.cpp
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "growablebitvector.h"
+#include <cassert>
/////////////////////////////////
namespace search {
diff --git a/searchlib/src/vespa/searchlib/common/resultset.cpp b/searchlib/src/vespa/searchlib/common/resultset.cpp
index f30a11f7c56..969e19f2a4b 100644
--- a/searchlib/src/vespa/searchlib/common/resultset.cpp
+++ b/searchlib/src/vespa/searchlib/common/resultset.cpp
@@ -4,6 +4,7 @@
#include "bitvector.h"
#include "sortresults.h"
#include <cstring>
+#include <cassert>
using vespalib::alloc::Alloc;
diff --git a/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp b/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp
index 9c17c998c28..9770be19597 100644
--- a/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp
+++ b/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp
@@ -3,6 +3,7 @@
#include "bitvectordictionary.h"
#include <vespa/vespalib/data/fileheader.h>
#include <vespa/fastos/file.h>
+#include <cassert>
#include <vespa/log/log.h>
LOG_SETUP(".diskindex.bitvectordictionary");
diff --git a/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.cpp b/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.cpp
index fa924895342..33c3b76f1e8 100644
--- a/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.cpp
+++ b/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.cpp
@@ -5,6 +5,7 @@
#include <vespa/searchlib/common/bitvector.h>
#include <vespa/searchlib/common/fileheadercontext.h>
#include <vespa/vespalib/data/fileheader.h>
+#include <cassert>
namespace search::diskindex {
diff --git a/searchlib/src/vespa/searchlib/diskindex/bitvectoridxfile.cpp b/searchlib/src/vespa/searchlib/diskindex/bitvectoridxfile.cpp
index 398a08da490..3b778725389 100644
--- a/searchlib/src/vespa/searchlib/diskindex/bitvectoridxfile.cpp
+++ b/searchlib/src/vespa/searchlib/diskindex/bitvectoridxfile.cpp
@@ -5,6 +5,7 @@
#include <vespa/searchlib/common/bitvector.h>
#include <vespa/searchlib/common/fileheadercontext.h>
#include <vespa/vespalib/data/fileheader.h>
+#include <cassert>
namespace search::diskindex {
@@ -35,10 +36,8 @@ BitVectorIdxFileWrite::BitVectorIdxFileWrite(BitVectorKeyScope scope)
{
}
-
BitVectorIdxFileWrite::~BitVectorIdxFileWrite() = default;
-
uint64_t
BitVectorIdxFileWrite::idxSize() const
{
@@ -46,7 +45,6 @@ BitVectorIdxFileWrite::idxSize() const
static_cast<int64_t>(_numKeys) * sizeof(BitVectorWordSingleKey);
}
-
void
BitVectorIdxFileWrite::open(const vespalib::string &name,
uint32_t docIdLimit,
@@ -88,7 +86,6 @@ BitVectorIdxFileWrite::open(const vespalib::string &name,
assert(pos == _idxFile->GetPosition());
}
-
void
BitVectorIdxFileWrite::makeIdxHeader(const FileHeaderContext &fileHeaderContext)
{
@@ -107,7 +104,6 @@ BitVectorIdxFileWrite::makeIdxHeader(const FileHeaderContext &fileHeaderContext)
_idxFile->Flush();
}
-
void
BitVectorIdxFileWrite::updateIdxHeader(uint64_t fileBitSize)
{
@@ -129,7 +125,6 @@ BitVectorIdxFileWrite::updateIdxHeader(uint64_t fileBitSize)
_idxFile->Sync();
}
-
void
BitVectorIdxFileWrite::addWordSingle(uint64_t wordNum, uint32_t numDocs)
{
@@ -140,7 +135,6 @@ BitVectorIdxFileWrite::addWordSingle(uint64_t wordNum, uint32_t numDocs)
++_numKeys;
}
-
void
BitVectorIdxFileWrite::flush()
{
@@ -151,14 +145,12 @@ BitVectorIdxFileWrite::flush()
(void) pos;
}
-
void
BitVectorIdxFileWrite::syncCommon()
{
_idxFile->Sync();
}
-
void
BitVectorIdxFileWrite::sync()
{
@@ -166,7 +158,6 @@ BitVectorIdxFileWrite::sync()
syncCommon();
}
-
void
BitVectorIdxFileWrite::close()
{
diff --git a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp
index 76c672b0d9a..b00b35b4d00 100644
--- a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp
+++ b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp
@@ -1244,4 +1244,35 @@ LogDataStore::shrinkLidSpace()
incGeneration();
}
+FileChunk::FileId
+LogDataStore::getActiveFileId(const MonitorGuard & guard) const {
+ assert(hasUpdateLock(guard));
+ (void) guard;
+ return _active;
+}
+
+WriteableFileChunk &
+LogDataStore::getActive(const MonitorGuard & guard) {
+ assert(hasUpdateLock(guard));
+ return static_cast<WriteableFileChunk &>(*_fileChunks[_active.getId()]);
+}
+
+const WriteableFileChunk &
+LogDataStore::getActive(const MonitorGuard & guard) const {
+ assert(hasUpdateLock(guard));
+ return static_cast<const WriteableFileChunk &>(*_fileChunks[_active.getId()]);
+}
+
+const FileChunk *
+LogDataStore::getPrevActive(const MonitorGuard & guard) const {
+ assert(hasUpdateLock(guard));
+ return ( !_prevActive.isActive() ) ? _fileChunks[_prevActive.getId()].get() : nullptr;
+}
+void
+LogDataStore::setActive(const MonitorGuard & guard, FileId fileId) {
+ assert(hasUpdateLock(guard));
+ _prevActive = _active;
+ _active = fileId;
+}
+
} // namespace search
diff --git a/searchlib/src/vespa/searchlib/docstore/logdatastore.h b/searchlib/src/vespa/searchlib/docstore/logdatastore.h
index 4d737801c22..7de8ebb4794 100644
--- a/searchlib/src/vespa/searchlib/docstore/logdatastore.h
+++ b/searchlib/src/vespa/searchlib/docstore/logdatastore.h
@@ -160,11 +160,7 @@ public:
return LidInfo();
}
}
- FileId getActiveFileId(const MonitorGuard & guard) const {
- assert(hasUpdateLock(guard));
- (void) guard;
- return _active;
- }
+ FileId getActiveFileId(const MonitorGuard & guard) const;
bool hasUpdateLock(const MonitorGuard & guard) const {
return (guard.mutex() == &_updateLock) && guard.owns_lock();
}
@@ -213,25 +209,10 @@ private:
void setNewFileChunk(const MonitorGuard & guard, FileChunk::UP fileChunk);
vespalib::string ls(const NameIdSet & partList);
- WriteableFileChunk & getActive(const MonitorGuard & guard) {
- assert(hasUpdateLock(guard));
- return static_cast<WriteableFileChunk &>(*_fileChunks[_active.getId()]);
- }
-
- const WriteableFileChunk & getActive(const MonitorGuard & guard) const {
- assert(hasUpdateLock(guard));
- return static_cast<const WriteableFileChunk &>(*_fileChunks[_active.getId()]);
- }
-
- const FileChunk * getPrevActive(const MonitorGuard & guard) const {
- assert(hasUpdateLock(guard));
- return ( !_prevActive.isActive() ) ? _fileChunks[_prevActive.getId()].get() : nullptr;
- }
- void setActive(const MonitorGuard & guard, FileId fileId) {
- assert(hasUpdateLock(guard));
- _prevActive = _active;
- _active = fileId;
- }
+ WriteableFileChunk & getActive(const MonitorGuard & guard);
+ const WriteableFileChunk & getActive(const MonitorGuard & guard) const;
+ const FileChunk * getPrevActive(const MonitorGuard & guard) const;
+ void setActive(const MonitorGuard & guard, FileId fileId);
double getMaxBucketSpread() const;
diff --git a/searchlib/src/vespa/searchlib/memoryindex/field_index_collection.cpp b/searchlib/src/vespa/searchlib/memoryindex/field_index_collection.cpp
index fcbe406e9ac..ea67ede77c2 100644
--- a/searchlib/src/vespa/searchlib/memoryindex/field_index_collection.cpp
+++ b/searchlib/src/vespa/searchlib/memoryindex/field_index_collection.cpp
@@ -13,11 +13,6 @@
#include <vespa/vespalib/btree/btreeroot.hpp>
#include <vespa/vespalib/btree/btreestore.hpp>
#include <vespa/vespalib/util/exceptions.h>
-#include <vespa/vespalib/util/stringfmt.h>
-
-#include <vespa/log/log.h>
-LOG_SETUP(".searchlib.memoryindex.field_index_collection");
-
namespace search {
@@ -44,9 +39,7 @@ FieldIndexCollection::FieldIndexCollection(const Schema& schema, const IFieldLen
}
}
-FieldIndexCollection::~FieldIndexCollection()
-{
-}
+FieldIndexCollection::~FieldIndexCollection() = default;
void
FieldIndexCollection::dump(search::index::IndexBuilder &indexBuilder)
diff --git a/searchlib/src/vespa/searchlib/memoryindex/field_index_collection.h b/searchlib/src/vespa/searchlib/memoryindex/field_index_collection.h
index a737175d346..f64735cc8ad 100644
--- a/searchlib/src/vespa/searchlib/memoryindex/field_index_collection.h
+++ b/searchlib/src/vespa/searchlib/memoryindex/field_index_collection.h
@@ -32,7 +32,7 @@ private:
public:
FieldIndexCollection(const index::Schema& schema, const index::IFieldLengthInspector& inspector);
- ~FieldIndexCollection();
+ ~FieldIndexCollection() override;
uint64_t getNumUniqueWords() const {
uint64_t numUniqueWords = 0;
diff --git a/searchlib/src/vespa/searchlib/queryeval/hitcollector.cpp b/searchlib/src/vespa/searchlib/queryeval/hitcollector.cpp
index 3f41dc3553b..a0e6d89645c 100644
--- a/searchlib/src/vespa/searchlib/queryeval/hitcollector.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/hitcollector.cpp
@@ -3,6 +3,7 @@
#include "hitcollector.h"
#include <vespa/searchlib/common/bitvector.h>
#include <vespa/searchlib/common/sort.h>
+#include <cassert>
namespace search::queryeval {
diff --git a/searchlib/src/vespa/searchlib/queryeval/iterator_pack.cpp b/searchlib/src/vespa/searchlib/queryeval/iterator_pack.cpp
index 87ab0b57c45..6e8473d8f24 100644
--- a/searchlib/src/vespa/searchlib/queryeval/iterator_pack.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/iterator_pack.cpp
@@ -3,6 +3,7 @@
#include "iterator_pack.h"
#include "termwise_helper.h"
#include <vespa/searchlib/fef/matchdata.h>
+#include <cassert>
namespace search::queryeval {
diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_graph.cpp b/searchlib/src/vespa/searchlib/tensor/hnsw_graph.cpp
index 564676a2d44..b1545d587b8 100644
--- a/searchlib/src/vespa/searchlib/tensor/hnsw_graph.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/hnsw_graph.cpp
@@ -18,7 +18,7 @@ HnswGraph::HnswGraph()
set_entry_node(entry);
}
-HnswGraph::~HnswGraph() {}
+HnswGraph::~HnswGraph() = default;
HnswGraph::NodeRef
HnswGraph::make_node_for_document(uint32_t docid, uint32_t num_levels)
@@ -92,6 +92,21 @@ HnswGraph::histograms() const
return result;
}
+void
+HnswGraph::set_entry_node(EntryNode node) {
+ uint64_t value = node.level;
+ value <<= 32;
+ value |= node.docid;
+ if (node.node_ref.valid()) {
+ assert(node.level >= 0);
+ assert(node.docid > 0);
+ } else {
+ assert(node.level == -1);
+ assert(node.docid == 0);
+ }
+ entry_docid_and_level.store(value, std::memory_order_release);
+}
+
} // namespace
namespace vespalib {
diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_graph.h b/searchlib/src/vespa/searchlib/tensor/hnsw_graph.h
index 8b40eb87bae..ce2bc172752 100644
--- a/searchlib/src/vespa/searchlib/tensor/hnsw_graph.h
+++ b/searchlib/src/vespa/searchlib/tensor/hnsw_graph.h
@@ -43,7 +43,6 @@ struct HnswGraph {
std::atomic<uint64_t> entry_docid_and_level;
HnswGraph();
-
~HnswGraph();
NodeRef make_node_for_document(uint32_t docid, uint32_t num_levels);
@@ -108,19 +107,7 @@ struct HnswGraph {
{}
};
- void set_entry_node(EntryNode node) {
- uint64_t value = node.level;
- value <<= 32;
- value |= node.docid;
- if (node.node_ref.valid()) {
- assert(node.level >= 0);
- assert(node.docid > 0);
- } else {
- assert(node.level == -1);
- assert(node.docid == 0);
- }
- entry_docid_and_level.store(value, std::memory_order_release);
- }
+ void set_entry_node(EntryNode node);
uint64_t get_entry_atomic() const {
return entry_docid_and_level.load(std::memory_order_acquire);
diff --git a/staging_vespalib/src/vespa/vespalib/stllike/lrucache_map.hpp b/staging_vespalib/src/vespa/vespalib/stllike/lrucache_map.hpp
index 839a93cc5ca..e2ecdac7269 100644
--- a/staging_vespalib/src/vespa/vespalib/stllike/lrucache_map.hpp
+++ b/staging_vespalib/src/vespa/vespalib/stllike/lrucache_map.hpp
@@ -3,6 +3,7 @@
#include "lrucache_map.h"
#include <vespa/vespalib/stllike/hashtable.hpp>
+#include <cassert>
namespace vespalib {
diff --git a/vespalib/src/vespa/vespalib/datastore/allocator.hpp b/vespalib/src/vespa/vespalib/datastore/allocator.hpp
index 5f84d70e62f..e038f4a39d5 100644
--- a/vespalib/src/vespa/vespalib/datastore/allocator.hpp
+++ b/vespalib/src/vespa/vespalib/datastore/allocator.hpp
@@ -4,6 +4,7 @@
#include "allocator.h"
#include "bufferstate.h"
+#include <cassert>
namespace vespalib::datastore {
diff --git a/vespalib/src/vespa/vespalib/datastore/bufferstate.cpp b/vespalib/src/vespa/vespalib/datastore/bufferstate.cpp
index 19b7cdf8181..76e706435cf 100644
--- a/vespalib/src/vespa/vespalib/datastore/bufferstate.cpp
+++ b/vespalib/src/vespa/vespalib/datastore/bufferstate.cpp
@@ -2,6 +2,7 @@
#include "bufferstate.h"
#include <limits>
+#include <cassert>
using vespalib::alloc::Alloc;
using vespalib::alloc::MemoryAllocator;
@@ -13,7 +14,6 @@ BufferState::FreeListList::~FreeListList()
assert(_head == nullptr); // Owner should have disabled free lists
}
-
BufferState::BufferState()
: _usedElems(0),
_allocElems(0),
@@ -35,7 +35,6 @@ BufferState::BufferState()
{
}
-
BufferState::~BufferState()
{
assert(_state == FREE);
@@ -46,6 +45,12 @@ BufferState::~BufferState()
assert(isFreeListEmpty());
}
+void
+BufferState::decHoldElems(size_t value) {
+ assert(_holdElems >= value);
+ _holdElems -= value;
+}
+
namespace {
struct AllocResult {
diff --git a/vespalib/src/vespa/vespalib/datastore/bufferstate.h b/vespalib/src/vespa/vespalib/datastore/bufferstate.h
index ca9c6dd39ba..da03a150b40 100644
--- a/vespalib/src/vespa/vespalib/datastore/bufferstate.h
+++ b/vespalib/src/vespa/vespalib/datastore/bufferstate.h
@@ -176,10 +176,7 @@ public:
void incDeadElems(size_t value) { _deadElems += value; }
void incHoldElems(size_t value) { _holdElems += value; }
- void decHoldElems(size_t value) {
- assert(_holdElems >= value);
- _holdElems -= value;
- }
+ void decHoldElems(size_t value);
void incExtraUsedBytes(size_t value) { _extraUsedBytes += value; }
void incExtraHoldBytes(size_t value) {
_extraHoldBytes += value;
diff --git a/vespalib/src/vespa/vespalib/datastore/datastorebase.cpp b/vespalib/src/vespa/vespalib/datastore/datastorebase.cpp
index ac6252bf514..4b1349d8801 100644
--- a/vespalib/src/vespa/vespalib/datastore/datastorebase.cpp
+++ b/vespalib/src/vespa/vespalib/datastore/datastorebase.cpp
@@ -3,6 +3,7 @@
#include "datastore.h"
#include <vespa/vespalib/util/array.hpp>
#include <limits>
+#include <cassert>
#include <vespa/log/log.h>
LOG_SETUP(".searchlib.datastore.datastorebase");
@@ -109,8 +110,7 @@ DataStoreBase::switchActiveBuffer(uint32_t typeId, size_t elemsNeeded)
}
}
if (!_states[activeBufferId].isFree()) {
- LOG(error, "did not find free buffer");
- abort();
+ LOG_ABORT("did not find free buffer");
}
onActive(activeBufferId, typeId, elemsNeeded);
_activeBufferIds[typeId] = activeBufferId;
diff --git a/vespalib/src/vespa/vespalib/util/generationhandler.cpp b/vespalib/src/vespa/vespalib/util/generationhandler.cpp
index 5fee6fa5c16..60195659eb9 100644
--- a/vespalib/src/vespa/vespalib/util/generationhandler.cpp
+++ b/vespalib/src/vespa/vespalib/util/generationhandler.cpp
@@ -1,9 +1,68 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "generationhandler.h"
+#include <cassert>
namespace vespalib {
+GenerationHandler::GenerationHold::GenerationHold(void)
+ : _refCount(1),
+ _generation(0),
+ _next(0)
+{ }
+
+GenerationHandler::GenerationHold::~GenerationHold() {
+ assert(getRefCount() == 0);
+}
+
+void
+GenerationHandler::GenerationHold::setValid() {
+ assert(!valid(_refCount));
+ _refCount.fetch_sub(1);
+}
+
+bool
+GenerationHandler::GenerationHold::setInvalid() {
+ uint32_t refs = _refCount;
+ assert(valid(refs));
+ if (refs != 0) {
+ return false;
+ }
+ return _refCount.compare_exchange_strong(refs, 1, std::memory_order_seq_cst);
+}
+
+void
+GenerationHandler::GenerationHold::release() {
+ _refCount.fetch_sub(2);
+}
+
+GenerationHandler::GenerationHold *
+GenerationHandler::GenerationHold::acquire() {
+ if (valid(_refCount.fetch_add(2))) {
+ return this;
+ } else {
+ release();
+ return nullptr;
+ }
+}
+
+GenerationHandler::GenerationHold *
+GenerationHandler::GenerationHold::copy(GenerationHold *self) {
+ if (self == nullptr) {
+ return nullptr;
+ } else {
+ uint32_t oldRefCount = self->_refCount.fetch_add(2);
+ (void) oldRefCount;
+ assert(valid(oldRefCount));
+ return self;
+ }
+}
+
+uint32_t
+GenerationHandler::GenerationHold::getRefCount() const {
+ return _refCount / 2;
+}
+
GenerationHandler::Guard::Guard()
: _hold(nullptr)
{
@@ -51,7 +110,6 @@ GenerationHandler::Guard::operator=(Guard &&rhs)
return *this;
}
-
void
GenerationHandler::updateFirstUsedGeneration()
{
@@ -73,7 +131,6 @@ GenerationHandler::updateFirstUsedGeneration()
_firstUsedGeneration = _first->_generation;
}
-
GenerationHandler::GenerationHandler()
: _generation(0),
_firstUsedGeneration(0),
@@ -88,10 +145,8 @@ GenerationHandler::GenerationHandler()
_last->setValid();
}
-
GenerationHandler::~GenerationHandler(void)
{
-
updateFirstUsedGeneration();
assert(_first == _last);
while (_free != nullptr) {
@@ -164,7 +219,6 @@ GenerationHandler::incGeneration()
updateFirstUsedGeneration();
}
-
uint32_t
GenerationHandler::getGenerationRefCount(generation_t gen) const
{
@@ -179,7 +233,6 @@ GenerationHandler::getGenerationRefCount(generation_t gen) const
return 0u;
}
-
uint64_t
GenerationHandler::getGenerationRefCount(void) const
{
@@ -190,7 +243,6 @@ GenerationHandler::getGenerationRefCount(void) const
return ret;
}
-
bool
GenerationHandler::hasReaders(void) const
{
diff --git a/vespalib/src/vespa/vespalib/util/generationhandler.h b/vespalib/src/vespa/vespalib/util/generationhandler.h
index d8af7f39c3e..1ba1baa7210 100644
--- a/vespalib/src/vespa/vespalib/util/generationhandler.h
+++ b/vespalib/src/vespa/vespalib/util/generationhandler.h
@@ -2,9 +2,8 @@
#pragma once
-#include <stdint.h>
+#include <cstdint>
#include <atomic>
-#include <cassert>
namespace vespalib {
@@ -16,8 +15,8 @@ namespace vespalib {
**/
class GenerationHandler {
public:
- typedef uint64_t generation_t;
- typedef int64_t sgeneration_t;
+ using generation_t = uint64_t;
+ using sgeneration_t = int64_t ;
/*
* This must be type stable memory, and cannot be freed before the
@@ -34,50 +33,15 @@ public:
generation_t _generation;
GenerationHold *_next; // next free element or next newer element.
- GenerationHold(void)
- : _refCount(1),
- _generation(0),
- _next(0)
- { }
+ GenerationHold();
+ ~GenerationHold();
- ~GenerationHold()
- {
- assert(getRefCount() == 0);
- }
-
- void setValid() {
- assert(!valid(_refCount));
- _refCount.fetch_sub(1);
- }
- bool setInvalid() {
- uint32_t refs = _refCount;
- assert(valid(refs));
- if (refs != 0) {
- return false;
- }
- return _refCount.compare_exchange_strong(refs, 1,
- std::memory_order_seq_cst);
- }
- void release() { _refCount.fetch_sub(2); }
- GenerationHold *acquire() {
- if (valid(_refCount.fetch_add(2))) {
- return this;
- } else {
- release();
- return nullptr;
- }
- }
- static GenerationHold *copy(GenerationHold *self) {
- if (self == nullptr) {
- return nullptr;
- } else {
- uint32_t oldRefCount = self->_refCount.fetch_add(2);
- (void) oldRefCount;
- assert(valid(oldRefCount));
- return self;
- }
- }
- uint32_t getRefCount() const { return _refCount / 2; }
+ void setValid();
+ bool setInvalid();
+ void release();
+ GenerationHold *acquire();
+ static GenerationHold *copy(GenerationHold *self);
+ uint32_t getRefCount() const;
};
/**
@@ -101,26 +65,25 @@ public:
Guard & operator=(const Guard & rhs);
Guard & operator=(Guard &&rhs);
- bool valid(void) const {
+ bool valid() const {
return _hold != nullptr;
}
generation_t getGeneration() const { return _hold->_generation; }
};
private:
- generation_t _generation;
- generation_t _firstUsedGeneration;
- GenerationHold *_last; // Points to "current generation" entry
- GenerationHold *_first; // Points to "firstUsedGeneration" entry
- GenerationHold *_free; // List of free entries
- uint32_t _numHolds; // Number of allocated generation hold entries
+ generation_t _generation;
+ generation_t _firstUsedGeneration;
+ GenerationHold *_last; // Points to "current generation" entry
+ GenerationHold *_first; // Points to "firstUsedGeneration" entry
+ GenerationHold *_free; // List of free entries
+ uint32_t _numHolds; // Number of allocated generation hold entries
public:
/**
* Creates a new generation handler.
**/
GenerationHandler();
-
~GenerationHandler();
/**
@@ -156,7 +119,7 @@ public:
return _generation;
}
- generation_t getNextGeneration(void) const {
+ generation_t getNextGeneration() const {
return _generation + 1;
}
@@ -170,14 +133,14 @@ public:
* Returns the number of readers holding a generation guard.
* Should be called by the writer thread.
*/
- uint64_t getGenerationRefCount(void) const;
+ uint64_t getGenerationRefCount() const;
/**
* Returns true if we still have readers. False positives and
* negatives are possible if readers come and go while writer
* updates generations.
*/
- bool hasReaders(void) const;
+ bool hasReaders() const;
};
}
diff --git a/vespalib/src/vespa/vespalib/util/generationholder.cpp b/vespalib/src/vespa/vespalib/util/generationholder.cpp
index 1927adb9846..136b392971c 100644
--- a/vespalib/src/vespa/vespalib/util/generationholder.cpp
+++ b/vespalib/src/vespa/vespalib/util/generationholder.cpp
@@ -1,10 +1,11 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "generationholder.h"
+#include <cassert>
namespace vespalib {
-GenerationHeldBase::~GenerationHeldBase() { }
+GenerationHeldBase::~GenerationHeldBase() = default;
GenerationHolder::GenerationHolder()
: _hold1List(),
diff --git a/vespalib/src/vespa/vespalib/util/rcuvector.hpp b/vespalib/src/vespa/vespalib/util/rcuvector.hpp
index f2324c654a4..8a5a828cfcb 100644
--- a/vespalib/src/vespa/vespalib/util/rcuvector.hpp
+++ b/vespalib/src/vespa/vespalib/util/rcuvector.hpp
@@ -4,6 +4,7 @@
#include "rcuvector.h"
#include <vespa/vespalib/util/array.hpp>
+#include <cassert>
namespace vespalib {