summaryrefslogtreecommitdiffstats
path: root/storage/src
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-02-02 16:04:20 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-02-02 16:14:53 +0000
commitd3a171fc3f64eb3fee389d0eff7856ac911b798c (patch)
tree0434968c427cad386bd5e87d094653f81963b55a /storage/src
parentd1daad830a576f9147b709523670635420fd49d3 (diff)
Add noexcept and some other minor code health.
Diffstat (limited to 'storage/src')
-rw-r--r--storage/src/vespa/storage/bucketdb/bucketcopy.h44
-rw-r--r--storage/src/vespa/storage/bucketdb/bucketmanager.cpp8
-rw-r--r--storage/src/vespa/storage/distributor/pending_bucket_space_db_transition_entry.h2
-rw-r--r--storage/src/vespa/storage/distributor/pendingmessagetracker.h12
4 files changed, 26 insertions, 40 deletions
diff --git a/storage/src/vespa/storage/bucketdb/bucketcopy.h b/storage/src/vespa/storage/bucketdb/bucketcopy.h
index 94a1e63e53e..3e93e4594a6 100644
--- a/storage/src/vespa/storage/bucketdb/bucketcopy.h
+++ b/storage/src/vespa/storage/bucketdb/bucketcopy.h
@@ -28,9 +28,9 @@ public:
{
}
- bool trusted() const { return _flags & TRUSTED; }
+ bool trusted() const noexcept { return _flags & TRUSTED; }
- BucketCopy& setTrusted(bool val = true) {
+ BucketCopy& setTrusted(bool val = true) noexcept {
if (!val) {
clearTrusted();
} else {
@@ -40,46 +40,44 @@ public:
return *this;
}
- void clearTrusted() { _flags &= ~TRUSTED; }
+ void clearTrusted() noexcept { _flags &= ~TRUSTED; }
- bool valid() const { return getBucketInfo().valid(); }
- bool empty() const { return getBucketInfo().empty(); }
- bool wasRecentlyCreated() const {
+ bool valid() const noexcept { return getBucketInfo().valid(); }
+ bool empty() const noexcept { return getBucketInfo().empty(); }
+ bool wasRecentlyCreated() const noexcept {
return (getChecksum() == 1
&& getDocumentCount() == 0
&& getTotalDocumentSize() == 0);
}
- static BucketCopy recentlyCreatedCopy(uint64_t timestamp, uint16_t nodeIdx)
- {
+ static BucketCopy recentlyCreatedCopy(uint64_t timestamp, uint16_t nodeIdx) noexcept {
return BucketCopy(timestamp, nodeIdx, api::BucketInfo(1, 0, 0, 0, 0));
}
- uint16_t getNode() const { return _node; }
- uint64_t getTimestamp() const { return _timestamp; }
+ uint16_t getNode() const noexcept { return _node; }
+ uint64_t getTimestamp() const noexcept { return _timestamp; }
- uint32_t getChecksum() const { return _info.getChecksum(); }
- uint32_t getDocumentCount() const { return _info.getDocumentCount(); }
- uint32_t getTotalDocumentSize() const
- { return _info.getTotalDocumentSize(); }
- uint32_t getMetaCount() const { return _info.getMetaCount(); }
- uint32_t getUsedFileSize() const { return _info.getUsedFileSize(); }
- bool active() const { return _info.isActive(); }
- bool ready() const { return _info.isReady(); }
+ uint32_t getChecksum() const noexcept { return _info.getChecksum(); }
+ uint32_t getDocumentCount() const noexcept { return _info.getDocumentCount(); }
+ uint32_t getTotalDocumentSize() const noexcept { return _info.getTotalDocumentSize(); }
+ uint32_t getMetaCount() const noexcept { return _info.getMetaCount(); }
+ uint32_t getUsedFileSize() const noexcept { return _info.getUsedFileSize(); }
+ bool active() const noexcept { return _info.isActive(); }
+ bool ready() const noexcept { return _info.isReady(); }
- const api::BucketInfo& getBucketInfo() const { return _info; }
+ const api::BucketInfo& getBucketInfo() const noexcept { return _info; }
- void setBucketInfo(uint64_t timestamp, const api::BucketInfo& bInfo) {
+ void setBucketInfo(uint64_t timestamp, const api::BucketInfo& bInfo) noexcept {
_info = bInfo;
_timestamp = timestamp;
}
- void setActive(bool setactive) {
+ void setActive(bool setactive) noexcept {
_info.setActive(setactive);
}
bool consistentWith(const BucketCopy& other,
- bool countInvalidAsConsistent = false) const
+ bool countInvalidAsConsistent = false) const noexcept
{
// If both are valid, check checksum and doc count.
if (valid() && other.valid()) {
@@ -94,7 +92,7 @@ public:
std::string toString() const;
- bool operator==(const BucketCopy& other) const {
+ bool operator==(const BucketCopy& other) const noexcept {
return
getBucketInfo() == other.getBucketInfo() &&
_flags == other._flags;
diff --git a/storage/src/vespa/storage/bucketdb/bucketmanager.cpp b/storage/src/vespa/storage/bucketdb/bucketmanager.cpp
index 5be6f310c71..2d70ee8d3ba 100644
--- a/storage/src/vespa/storage/bucketdb/bucketmanager.cpp
+++ b/storage/src/vespa/storage/bucketdb/bucketmanager.cpp
@@ -166,17 +166,17 @@ namespace {
uint64_t active;
uint64_t ready;
- Count() : docs(0), bytes(0), buckets(0), active(0), ready(0) {}
+ Count() noexcept : docs(0), bytes(0), buckets(0), active(0), ready(0) {}
};
Count count;
uint32_t lowestUsedBit;
- MetricsUpdater()
+ MetricsUpdater() noexcept
: count(), lowestUsedBit(58) {}
void operator()(document::BucketId::Type bucketId,
- const StorBucketDatabase::Entry& data)
+ const StorBucketDatabase::Entry& data) noexcept
{
document::BucketId bucket(
document::BucketId::keyToBucketId(bucketId));
@@ -198,7 +198,7 @@ namespace {
}
};
- void add(const MetricsUpdater& rhs) {
+ void add(const MetricsUpdater& rhs) noexcept {
auto& d = count;
auto& s = rhs.count;
d.buckets += s.buckets;
diff --git a/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition_entry.h b/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition_entry.h
index 124ee1bdf45..785419e78cf 100644
--- a/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition_entry.h
+++ b/storage/src/vespa/storage/distributor/pending_bucket_space_db_transition_entry.h
@@ -8,7 +8,7 @@ namespace storage::distributor::dbtransition {
struct Entry {
Entry(const document::BucketId& bid,
- const BucketCopy& copy_)
+ const BucketCopy& copy_) noexcept
: bucket_key(bid.toKey()),
copy(copy_)
{}
diff --git a/storage/src/vespa/storage/distributor/pendingmessagetracker.h b/storage/src/vespa/storage/distributor/pendingmessagetracker.h
index 51971a276b4..13d83157150 100644
--- a/storage/src/vespa/storage/distributor/pendingmessagetracker.h
+++ b/storage/src/vespa/storage/distributor/pendingmessagetracker.h
@@ -196,18 +196,6 @@ private:
// to be present for that exact purpose.
mutable std::mutex _lock;
- /**
- * Increment latency and operation count stats for the node the message
- * was sent towards based on the registered send time and the current time.
- *
- * In the event that system time has moved backwards across sending a
- * command and reciving its reply, the latency will not be recorded but
- * the total number of messages will increase.
- *
- * _lock MUST be held upon invocation.
- */
- void updateNodeStatsOnReply(const MessageEntry& entry);
-
void getStatusStartPage(std::ostream& out) const;
void getStatusPerNode(std::ostream& out) const;
void getStatusPerBucket(std::ostream& out) const;