summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-08-10 13:36:29 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-08-10 16:19:51 +0000
commitfdcb755aff2d29773914f50b1ce6cde59deb7956 (patch)
tree21688c5f09395ce7647d3496192615a33aa7bf77
parentdbd97587c91c31992ad4c4c9ac9731dffaebdae4 (diff)
GC unused default value countInvalidAsConsistent
-rw-r--r--storage/src/vespa/storage/bucketdb/bucketcopy.h20
-rw-r--r--storage/src/vespa/storage/bucketdb/bucketinfo.cpp33
-rw-r--r--storage/src/vespa/storage/bucketdb/bucketinfo.h13
-rw-r--r--storage/src/vespa/storage/bucketdb/bucketinfo.hpp5
4 files changed, 28 insertions, 43 deletions
diff --git a/storage/src/vespa/storage/bucketdb/bucketcopy.h b/storage/src/vespa/storage/bucketdb/bucketcopy.h
index e8d1db1d824..ca629a6cd8e 100644
--- a/storage/src/vespa/storage/bucketdb/bucketcopy.h
+++ b/storage/src/vespa/storage/bucketdb/bucketcopy.h
@@ -7,10 +7,10 @@ namespace storage {
class BucketCopy {
private:
- uint64_t _timestamp;
+ uint64_t _timestamp;
api::BucketInfo _info;
- uint16_t _flags;
- uint16_t _node;
+ uint16_t _flags;
+ uint16_t _node;
public:
static const int TRUSTED = 1;
@@ -18,9 +18,7 @@ public:
BucketCopy() noexcept
: _timestamp(0), _flags(0), _node(0xffff) {}
- BucketCopy(uint64_t timestamp,
- uint16_t nodeIdx,
- const api::BucketInfo& info) noexcept
+ BucketCopy(uint64_t timestamp, uint16_t nodeIdx, const api::BucketInfo& info) noexcept
: _timestamp(timestamp),
_info(info),
_flags(0),
@@ -76,16 +74,14 @@ public:
_info.setActive(setactive);
}
- bool consistentWith(const BucketCopy& other,
- bool countInvalidAsConsistent = false) const noexcept
- {
+ bool consistentWith(const BucketCopy& other) const noexcept {
// If both are valid, check checksum and doc count.
if (valid() && other.valid()) {
return (getChecksum() == other.getChecksum()
&& getDocumentCount() == other.getDocumentCount());
}
- return countInvalidAsConsistent;
+ return false;
}
void print(std::ostream&, bool verbose, const std::string& indent) const;
@@ -93,9 +89,7 @@ public:
std::string toString() const;
bool operator==(const BucketCopy& other) const noexcept {
- return
- getBucketInfo() == other.getBucketInfo() &&
- _flags == other._flags;
+ return (getBucketInfo() == other.getBucketInfo()) && (_flags == other._flags);
}
};
diff --git a/storage/src/vespa/storage/bucketdb/bucketinfo.cpp b/storage/src/vespa/storage/bucketdb/bucketinfo.cpp
index dcf49b4d022..a8c21efa793 100644
--- a/storage/src/vespa/storage/bucketdb/bucketinfo.cpp
+++ b/storage/src/vespa/storage/bucketdb/bucketinfo.cpp
@@ -9,9 +9,9 @@ namespace storage {
template class BucketInfoBase<std::vector<BucketCopy>>;
template class BucketInfoBase<vespalib::ConstArrayRef<BucketCopy>>;
-BucketInfo::BucketInfo() : BucketInfoBase() {}
+BucketInfo::BucketInfo() noexcept : BucketInfoBase() {}
-BucketInfo::BucketInfo(uint32_t lastGarbageCollection, std::vector<BucketCopy> nodes)
+BucketInfo::BucketInfo(uint32_t lastGarbageCollection, std::vector<BucketCopy> nodes) noexcept
: BucketInfoBase(lastGarbageCollection, std::move(nodes))
{}
@@ -23,7 +23,7 @@ BucketInfo::BucketInfo(BucketInfo&&) noexcept = default;
BucketInfo& BucketInfo::operator=(BucketInfo&&) noexcept = default;
void
-BucketInfo::updateTrusted() {
+BucketInfo::updateTrusted() noexcept {
if (validAndConsistent()) {
for (uint32_t i = 0; i < _nodes.size(); i++) {
_nodes[i].setTrusted();
@@ -51,7 +51,7 @@ BucketInfo::updateTrusted() {
}
void
-BucketInfo::resetTrusted() {
+BucketInfo::resetTrusted() noexcept {
for (uint32_t i = 0; i < _nodes.size(); i++) {
_nodes[i].clearTrusted();
}
@@ -63,10 +63,10 @@ namespace {
struct Sorter {
const std::vector<uint16_t>& _order;
- Sorter(const std::vector<uint16_t>& recommendedOrder) :
+ Sorter(const std::vector<uint16_t>& recommendedOrder) noexcept :
_order(recommendedOrder) {}
- bool operator() (const BucketCopy& a, const BucketCopy& b) {
+ bool operator() (const BucketCopy& a, const BucketCopy& b) noexcept {
int order_a = -1;
for (uint32_t i = 0; i < _order.size(); i++) {
if (_order[i] == a.getNode()) {
@@ -119,8 +119,7 @@ BucketInfo::addNodes(const std::vector<BucketCopy>& newCopies,
if (found) {
if (found->getTimestamp() < newCopies[i].getTimestamp()) {
- found->setBucketInfo(newCopies[i].getTimestamp(),
- newCopies[i].getBucketInfo());
+ found->setBucketInfo(newCopies[i].getTimestamp(), newCopies[i].getBucketInfo());
}
} else {
_nodes.push_back(newCopies[i]);
@@ -135,19 +134,15 @@ BucketInfo::addNodes(const std::vector<BucketCopy>& newCopies,
}
void
-BucketInfo::addNode(const BucketCopy& newCopy,
- const std::vector<uint16_t>& recommendedOrder)
+BucketInfo::addNode(const BucketCopy& newCopy, const std::vector<uint16_t>& recommendedOrder)
{
- addNodes(toVector<BucketCopy>(newCopy),
- recommendedOrder);
+ addNodes(toVector<BucketCopy>(newCopy), recommendedOrder);
}
bool
BucketInfo::removeNode(unsigned short node, TrustedUpdate update)
{
- for (std::vector<BucketCopy>::iterator iter = _nodes.begin();
- iter != _nodes.end();
- iter++) {
+ for (auto iter = _nodes.begin(); iter != _nodes.end(); iter++) {
if (iter->getNode() == node) {
_nodes.erase(iter);
if (update == TrustedUpdate::UPDATE) {
@@ -162,11 +157,9 @@ BucketInfo::removeNode(unsigned short node, TrustedUpdate update)
BucketCopy*
BucketInfo::getNodeInternal(uint16_t node)
{
- for (std::vector<BucketCopy>::iterator iter = _nodes.begin();
- iter != _nodes.end();
- iter++) {
- if (iter->getNode() == node) {
- return &*iter;
+ for (BucketCopy & copy : _nodes) {
+ if (copy.getNode() == node) {
+ return &copy;
}
}
return 0;
diff --git a/storage/src/vespa/storage/bucketdb/bucketinfo.h b/storage/src/vespa/storage/bucketdb/bucketinfo.h
index 9a428674dec..219d0335966 100644
--- a/storage/src/vespa/storage/bucketdb/bucketinfo.h
+++ b/storage/src/vespa/storage/bucketdb/bucketinfo.h
@@ -78,7 +78,7 @@ public:
* @param countInCompleteAsInconsistent If false, nodes that are incomplete
* are always counted as consistent with complete nodes.
*/
- bool consistentNodes(bool countInvalidAsConsistent = false) const noexcept;
+ bool consistentNodes() const noexcept;
void print(std::ostream&, bool verbose, const std::string& indent) const;
@@ -140,8 +140,8 @@ public:
class BucketInfo : public BucketInfoBase<std::vector<BucketCopy>> {
public:
- BucketInfo();
- BucketInfo(uint32_t lastGarbageCollection, std::vector<BucketCopy> nodes);
+ BucketInfo() noexcept;
+ BucketInfo(uint32_t lastGarbageCollection, std::vector<BucketCopy> nodes) noexcept;
~BucketInfo();
BucketInfo(const BucketInfo&);
@@ -159,13 +159,13 @@ public:
/**
Update trusted flags if bucket is now complete and consistent.
*/
- void updateTrusted();
+ void updateTrusted() noexcept;
/**
Removes any historical information on trustedness, and sets the bucket copies to
trusted if they are now complete and consistent.
*/
- void resetTrusted();
+ void resetTrusted() noexcept;
/**
Adds the given node.
@@ -184,8 +184,7 @@ public:
/**
Simplified API for the common case of inserting one node. See addNodes().
*/
- void addNode(const BucketCopy& newCopy,
- const std::vector<uint16_t>& recommendedOrder);
+ void addNode(const BucketCopy& newCopy, const std::vector<uint16_t>& recommendedOrder);
/**
Updates bucket information for a node. Does nothing if the node
diff --git a/storage/src/vespa/storage/bucketdb/bucketinfo.hpp b/storage/src/vespa/storage/bucketdb/bucketinfo.hpp
index c57a293fab1..6c2ca657938 100644
--- a/storage/src/vespa/storage/bucketdb/bucketinfo.hpp
+++ b/storage/src/vespa/storage/bucketdb/bucketinfo.hpp
@@ -63,11 +63,10 @@ BucketInfoBase<NodeSeq>::getTrustedCount() const noexcept {
template <typename NodeSeq>
bool
-BucketInfoBase<NodeSeq>::consistentNodes(bool countInvalidAsConsistent) const noexcept {
+BucketInfoBase<NodeSeq>::consistentNodes() const noexcept {
int compareIndex = 0;
for (uint32_t i = 1; i < _nodes.size(); i++) {
- if (!_nodes[i].consistentWith(_nodes[compareIndex],
- countInvalidAsConsistent)) return false;
+ if (!_nodes[i].consistentWith(_nodes[compareIndex])) return false;
}
return true;
}