summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
Diffstat (limited to 'storage')
-rw-r--r--storage/src/tests/bucketdb/judyarraytest.cpp17
-rw-r--r--storage/src/tests/bucketdb/judymultimaptest.cpp26
-rw-r--r--storage/src/tests/bucketdb/lockablemaptest.cpp18
-rw-r--r--storage/src/vespa/storage/bucketdb/judyarray.h19
-rw-r--r--storage/src/vespa/storage/bucketdb/judymultimap.h19
-rw-r--r--storage/src/vespa/storage/bucketdb/lockablemap.h149
-rw-r--r--storage/src/vespa/storage/bucketmover/bucketmover.cpp7
-rw-r--r--storage/src/vespa/storage/common/hostreporter/cpureporter.cpp5
-rw-r--r--storage/src/vespa/storage/common/statusmetricconsumer.cpp13
-rw-r--r--storage/src/vespa/storage/distributor/operations/idealstate/mergelimiter.cpp27
-rw-r--r--storage/src/vespa/storage/distributor/operationtargetresolver.h3
-rw-r--r--storage/src/vespa/storage/distributor/operationtargetresolverimpl.h6
-rw-r--r--storage/src/vespa/storage/tools/generatedistributionbits.cpp8
13 files changed, 130 insertions, 187 deletions
diff --git a/storage/src/tests/bucketdb/judyarraytest.cpp b/storage/src/tests/bucketdb/judyarraytest.cpp
index 235c0c9eb5c..4a6157fc93e 100644
--- a/storage/src/tests/bucketdb/judyarraytest.cpp
+++ b/storage/src/tests/bucketdb/judyarraytest.cpp
@@ -61,18 +61,6 @@ JudyArrayTest::testIterating()
foundVals = getJudyArrayContents(array);
CPPUNIT_ASSERT_EQUAL(values, foundVals);
- { // Test that both postfix operator work
- JudyArray::iterator it = array.begin();
- JudyArray::iterator it2 = it++;
- CPPUNIT_ASSERT_EQUAL(JudyArray::value_type(values[0]), *it2);
- CPPUNIT_ASSERT_EQUAL(JudyArray::value_type(values[1]), *it);
-
- // And that iterator comparisons work
- CPPUNIT_ASSERT_EQUAL(it2, array.begin());
- CPPUNIT_ASSERT_EQUAL(it, ++array.begin());
- CPPUNIT_ASSERT(!(it == it2));
- CPPUNIT_ASSERT(it != it2);
- }
{ // Test that we can alter through non-const iterator
JudyArray::iterator it = array.begin();
++it;
@@ -127,7 +115,7 @@ JudyArrayTest::testDualArrayFunctions()
CPPUNIT_ASSERT_EQUAL(values1, getJudyArrayContents(array1));
CPPUNIT_ASSERT_EQUAL(values2, getJudyArrayContents(array2));
- CPPUNIT_ASSERT(array1 > array2);
+ CPPUNIT_ASSERT(array2 < array1);
CPPUNIT_ASSERT(array1 != array2);
array1.swap(array2);
CPPUNIT_ASSERT_EQUAL(values1, getJudyArrayContents(array2));
@@ -142,10 +130,7 @@ JudyArrayTest::testDualArrayFunctions()
}
CPPUNIT_ASSERT(array1 != array3);
CPPUNIT_ASSERT_EQUAL(array2, array3);
- CPPUNIT_ASSERT(array2 >= array3);
- CPPUNIT_ASSERT(array2 <= array3);
CPPUNIT_ASSERT(!(array2 < array3));
- CPPUNIT_ASSERT(!(array2 > array3));
}
void
diff --git a/storage/src/tests/bucketdb/judymultimaptest.cpp b/storage/src/tests/bucketdb/judymultimaptest.cpp
index f63fad9aa06..b737155d6a9 100644
--- a/storage/src/tests/bucketdb/judymultimaptest.cpp
+++ b/storage/src/tests/bucketdb/judymultimaptest.cpp
@@ -135,37 +135,35 @@ JudyMultiMapTest::testIterator()
MultiMap::Iterator iter = multiMap.begin();
CPPUNIT_ASSERT_EQUAL((uint64_t)11, (uint64_t)iter.key());
CPPUNIT_ASSERT_EQUAL(A(4, 6, 0), iter.value());
- iter++;
+ ++iter;
CPPUNIT_ASSERT_EQUAL((uint64_t)14, (uint64_t)iter.key());
CPPUNIT_ASSERT_EQUAL(A(42, 0, 0), iter.value());
- iter++;
+ ++iter;
CPPUNIT_ASSERT_EQUAL((uint64_t)16, (uint64_t)iter.key());
CPPUNIT_ASSERT_EQUAL(A(1, 2, 3), iter.value());
- iter--;
+ --iter;
CPPUNIT_ASSERT_EQUAL((uint64_t)14, (uint64_t)iter.key());
CPPUNIT_ASSERT_EQUAL(A(42, 0, 0), iter.value());
- iter++;
+ ++iter;
CPPUNIT_ASSERT_EQUAL((uint64_t)16, (uint64_t)iter.key());
CPPUNIT_ASSERT_EQUAL(A(1, 2, 3), iter.value());
- iter--;
- iter--;
+ --iter;
+ --iter;
CPPUNIT_ASSERT_EQUAL((uint64_t)11,(uint64_t) iter.key());
CPPUNIT_ASSERT_EQUAL(A(4, 6, 0), iter.value());
- iter++;
- iter++;
- iter++;
+ ++iter;
+ ++iter;
+ ++iter;
CPPUNIT_ASSERT_EQUAL(multiMap.end(), iter);
- iter--;
+ --iter;
CPPUNIT_ASSERT_EQUAL((uint64_t)16, (uint64_t)iter.key());
CPPUNIT_ASSERT_EQUAL(A(1, 2, 3), iter.value());
- iter--;
+ --iter;
CPPUNIT_ASSERT_EQUAL((uint64_t)14, (uint64_t)iter.key());
CPPUNIT_ASSERT_EQUAL(A(42, 0, 0), iter.value());
- iter--;
+ --iter;
CPPUNIT_ASSERT_EQUAL((uint64_t)11,(uint64_t) iter.key());
CPPUNIT_ASSERT_EQUAL(A(4, 6, 0), iter.value());
-
-
}
} // storage
diff --git a/storage/src/tests/bucketdb/lockablemaptest.cpp b/storage/src/tests/bucketdb/lockablemaptest.cpp
index 0f35f51afbd..ad1cc1dcef4 100644
--- a/storage/src/tests/bucketdb/lockablemaptest.cpp
+++ b/storage/src/tests/bucketdb/lockablemaptest.cpp
@@ -158,48 +158,36 @@ LockableMapTest::testComparison() {
// Check empty state is correct
CPPUNIT_ASSERT_EQUAL(map1, map2);
- CPPUNIT_ASSERT(map1 <= map2);
- CPPUNIT_ASSERT(map1 >= map2);
CPPUNIT_ASSERT(!(map1 < map2));
- CPPUNIT_ASSERT(!(map1 > map2));
CPPUNIT_ASSERT(!(map1 != map2));
// Check that different lengths are oki
map1.insert(4, A(1, 2, 3), "foo", preExisted);
CPPUNIT_ASSERT(!(map1 == map2));
- CPPUNIT_ASSERT(!(map1 <= map2));
CPPUNIT_ASSERT(!(map1 < map2));
- CPPUNIT_ASSERT(map1 >= map2);
- CPPUNIT_ASSERT(map1 > map2);
+ CPPUNIT_ASSERT(map2 < map1);
CPPUNIT_ASSERT(map1 != map2);
// Check that equal elements are oki
map2.insert(4, A(1, 2, 3), "foo", preExisted);
CPPUNIT_ASSERT_EQUAL(map1, map2);
- CPPUNIT_ASSERT(map1 <= map2);
- CPPUNIT_ASSERT(map1 >= map2);
CPPUNIT_ASSERT(!(map1 < map2));
- CPPUNIT_ASSERT(!(map1 > map2));
CPPUNIT_ASSERT(!(map1 != map2));
// Check that non-equal values are oki
map1.insert(6, A(1, 2, 6), "foo", preExisted);
map2.insert(6, A(1, 2, 3), "foo", preExisted);
CPPUNIT_ASSERT(!(map1 == map2));
- CPPUNIT_ASSERT(!(map1 <= map2));
CPPUNIT_ASSERT(!(map1 < map2));
- CPPUNIT_ASSERT(map1 >= map2);
- CPPUNIT_ASSERT(map1 > map2);
+ CPPUNIT_ASSERT(map2 < map1);
CPPUNIT_ASSERT(map1 != map2);
// Check that non-equal keys are oki
map1.erase(6, "foo");
map1.insert(7, A(1, 2, 3), "foo", preExisted);
CPPUNIT_ASSERT(!(map1 == map2));
- CPPUNIT_ASSERT(!(map1 <= map2));
CPPUNIT_ASSERT(!(map1 < map2));
- CPPUNIT_ASSERT(map1 >= map2);
- CPPUNIT_ASSERT(map1 > map2);
+ CPPUNIT_ASSERT(map2 < map1);
CPPUNIT_ASSERT(map1 != map2);
}
diff --git a/storage/src/vespa/storage/bucketdb/judyarray.h b/storage/src/vespa/storage/bucketdb/judyarray.h
index 963fdb86f98..c539e1e8469 100644
--- a/storage/src/vespa/storage/bucketdb/judyarray.h
+++ b/storage/src/vespa/storage/bucketdb/judyarray.h
@@ -16,7 +16,6 @@
#pragma once
-#include <boost/operators.hpp>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/util/printable.h>
#include <vespa/fastos/fastos.h>
@@ -25,7 +24,7 @@
namespace storage {
-class JudyArray : public vespalib::Printable, public boost::operators<JudyArray>
+class JudyArray : public vespalib::Printable
{
JudyArray(const JudyArray&); // Deny copying
JudyArray& operator=(const JudyArray&);
@@ -49,6 +48,9 @@ public:
virtual ~JudyArray();
bool operator==(const JudyArray& array) const;
+ bool operator!=(const JudyArray& array) const {
+ return ! (*this == array);
+ }
bool operator<(const JudyArray& array) const;
/** Warning: Size may be a O(n) function (Unknown implementation in judy) */
@@ -86,14 +88,16 @@ public:
virtual void print(std::ostream& out, bool verbose,
const std::string& indent) const;
- class ConstIterator : public vespalib::Printable,
- public boost::operators<ConstIterator>
+ class ConstIterator : public vespalib::Printable
{
public:
ConstIterator& operator--();
- ConstIterator& operator++(); // Prefix, postfix provided by boost
+ ConstIterator& operator++();
- bool operator==(const ConstIterator &cp) const; // != provided by boost
+ bool operator==(const ConstIterator &cp) const;
+ bool operator!=(const ConstIterator &cp) const {
+ return ! (*this == cp);
+ }
value_type operator*() const { return value_type(_key, *_data); }
bool end() const { return (_data == 0); }
@@ -115,8 +119,7 @@ public:
friend class JudyArray;
};
- class Iterator : public ConstIterator,
- public boost::operators<Iterator>
+ class Iterator : public ConstIterator
{
public:
Iterator& operator--()
diff --git a/storage/src/vespa/storage/bucketdb/judymultimap.h b/storage/src/vespa/storage/bucketdb/judymultimap.h
index ea7c005dc24..c6f0194c7bd 100644
--- a/storage/src/vespa/storage/bucketdb/judymultimap.h
+++ b/storage/src/vespa/storage/bucketdb/judymultimap.h
@@ -95,14 +95,16 @@ public:
virtual void print(std::ostream& out, bool verbose,
const std::string& indent) const;
- class ConstIterator : public vespalib::Printable,
- public boost::operators<ConstIterator>
+ class ConstIterator : public vespalib::Printable
{
public:
ConstIterator& operator--() { --_iterator; return *this; }
ConstIterator& operator++() { ++_iterator; return *this; }
- bool operator==(const ConstIterator &cp) const; // != provided by boost
+ bool operator==(const ConstIterator &cp) const;
+ bool operator!=(const ConstIterator &cp) const {
+ return ! (*this == cp);
+ }
value_type operator*() const;
inline bool end() const { return _iterator.end(); }
@@ -129,8 +131,7 @@ public:
mutable std::pair<key_type, mapped_type> _pair;
};
- class Iterator : public ConstIterator,
- public boost::operators<Iterator>
+ class Iterator : public ConstIterator
{
public:
Iterator& operator--()
@@ -150,10 +151,10 @@ public:
private:
JudyArray _judyArray;
- typedef vespalib::Array<Type0, vespalib::DefaultAlloc> Type0Vector;
- typedef vespalib::Array<Type1, vespalib::DefaultAlloc> Type1Vector;
- typedef vespalib::Array<Type2, vespalib::DefaultAlloc> Type2Vector;
- typedef vespalib::Array<Type3, vespalib::DefaultAlloc> Type3Vector;
+ typedef vespalib::Array<Type0> Type0Vector;
+ typedef vespalib::Array<Type1> Type1Vector;
+ typedef vespalib::Array<Type2> Type2Vector;
+ typedef vespalib::Array<Type3> Type3Vector;
Type0Vector _values0;
Type1Vector _values1;
Type2Vector _values2;
diff --git a/storage/src/vespa/storage/bucketdb/lockablemap.h b/storage/src/vespa/storage/bucketdb/lockablemap.h
index 95d9326eff0..25a1cf09d0b 100644
--- a/storage/src/vespa/storage/bucketdb/lockablemap.h
+++ b/storage/src/vespa/storage/bucketdb/lockablemap.h
@@ -28,14 +28,14 @@
namespace storage {
template<typename Map>
-class LockableMap : public vespalib::Printable,
- public boost::operators<LockableMap<Map> >
+class LockableMap : public vespalib::Printable
{
public:
typedef typename Map::key_type key_type;
typedef typename Map::mapped_type mapped_type;
typedef typename Map::value_type value_type;
typedef typename Map::size_type size_type;
+ using BucketId = document::BucketId;
/** Responsible for releasing lock in map when out of scope. */
class LockKeeper {
@@ -66,8 +66,8 @@ public:
bool locked() const { return _lockKeeper.get(); }
const key_type& getKey() const { return _lockKeeper->_key; };
- document::BucketId getBucketId() const {
- return document::BucketId(document::BucketId::keyToBucketId(getKey()));
+ BucketId getBucketId() const {
+ return BucketId(BucketId::keyToBucketId(getKey()));
}
protected:
@@ -114,6 +114,9 @@ public:
LockableMap();
bool operator==(const LockableMap& other) const;
+ bool operator!=(const LockableMap& other) const {
+ return ! (*this == other);
+ }
bool operator<(const LockableMap& other) const;
typename Map::size_type size() const;
size_type getMemoryUsage() const;
@@ -173,15 +176,15 @@ public:
* bucket. Usually, there should be only one such bucket, but in the case
* of inconsistent splitting, there may be more than one.
*/
- std::map<document::BucketId, WrappedEntry>
- getContained(const document::BucketId& bucketId, const char* clientId);
+ std::map<BucketId, WrappedEntry>
+ getContained(const BucketId& bucketId, const char* clientId);
WrappedEntry
createAppropriateBucket(uint16_t newBucketBits,
const char* clientId,
- const document::BucketId& bucket);
+ const BucketId& bucket);
- typedef std::map<document::BucketId, WrappedEntry> EntryMap;
+ typedef std::map<BucketId, WrappedEntry> EntryMap;
/**
* Returns all buckets in the bucket database that can contain the given
@@ -189,10 +192,7 @@ public:
*
* If sibling is != 0, also fetch that bucket if possible.
*/
- EntryMap getAll(
- const document::BucketId& bucketId,
- const char* clientId,
- const document::BucketId& sibling = document::BucketId(0));
+ EntryMap getAll(const BucketId& bucketId, const char* clientId, const BucketId& sibling = BucketId(0));
/**
* Returns true iff bucket has no superbuckets or sub-buckets in the
@@ -270,9 +270,9 @@ private:
/**
* Returns the given bucket, its super buckets and its sub buckets.
*/
- void getAllWithoutLocking(const document::BucketId& bucket,
- const document::BucketId& sibling,
- std::vector<document::BucketId::Type>& keys);
+ void getAllWithoutLocking(const BucketId& bucket,
+ const BucketId& sibling,
+ std::vector<BucketId::Type>& keys);
/**
* Retrieves the most specific bucket id (highest used bits) that matches
@@ -284,25 +284,25 @@ private:
* If not found, nextKey is set to the key after one that could have
* matched and we return false.
*/
- bool getMostSpecificMatch(const document::BucketId& bucket,
- document::BucketId& result,
- document::BucketId::Type& keyResult,
- document::BucketId::Type& nextKey);
+ bool getMostSpecificMatch(const BucketId& bucket,
+ BucketId& result,
+ BucketId::Type& keyResult,
+ BucketId::Type& nextKey);
/**
* Finds all buckets that can contain the given bucket, except for the
* bucket itself (that is, its super buckets)
*/
- void getAllContaining(const document::BucketId& bucket,
- std::vector<document::BucketId::Type>& keys);
+ void getAllContaining(const BucketId& bucket,
+ std::vector<BucketId::Type>& keys);
/**
* Find the given list of keys in the map and add them to the map of
* results, locking them in the process.
*/
- void addAndLockResults(const std::vector<document::BucketId::Type> keys,
+ void addAndLockResults(const std::vector<BucketId::Type> keys,
const char* clientId,
- std::map<document::BucketId, WrappedEntry>& results,
+ std::map<BucketId, WrappedEntry>& results,
vespalib::MonitorGuard& guard);
};
@@ -692,12 +692,9 @@ LockableMap<Map>::print(std::ostream& out, bool verbose,
out << "LockableMap {\n" << indent << " ";
if (verbose) {
- for (typename Map::const_iterator iter = _map.begin();
- iter != _map.end();
- iter++) {
- out << "Key: " <<
- document::BucketId(document::BucketId::keyToBucketId(iter->first))
- << " Value: " << iter->second << "\n" << indent << " ";
+ for (const auto & entry : _map) {
+ out << "Key: " << BucketId(BucketId::keyToBucketId(entry.first))
+ << " Value: " << entry.second << "\n" << indent << " ";
}
out << "\n" << indent << " Locked keys: ";
@@ -747,8 +744,7 @@ bool
checkContains(document::BucketId::Type key, const document::BucketId& bucket,
document::BucketId& result, document::BucketId::Type& keyResult)
{
- document::BucketId id = document::BucketId(
- document::BucketId::keyToBucketId(key));
+ document::BucketId id = document::BucketId(document::BucketId::keyToBucketId(key));
if (id.contains(bucket)) {
result = id;
keyResult = key;
@@ -772,10 +768,10 @@ checkContains(document::BucketId::Type key, const document::BucketId& bucket,
*/
template<typename Map>
bool
-LockableMap<Map>::getMostSpecificMatch(const document::BucketId& bucket,
- document::BucketId& result,
- document::BucketId::Type& keyResult,
- document::BucketId::Type& nextKey)
+LockableMap<Map>::getMostSpecificMatch(const BucketId& bucket,
+ BucketId& result,
+ BucketId::Type& keyResult,
+ BucketId::Type& nextKey)
{
typename Map::const_iterator iter = _map.lower_bound(bucket.toKey());
@@ -809,17 +805,17 @@ LockableMap<Map>::getMostSpecificMatch(const document::BucketId& bucket,
*/
template<typename Map>
void
-LockableMap<Map>::getAllContaining(const document::BucketId& bucket,
- std::vector<document::BucketId::Type>& keys)
+LockableMap<Map>::getAllContaining(const BucketId& bucket,
+ std::vector<BucketId::Type>& keys)
{
- document::BucketId id = bucket;
+ BucketId id = bucket;
// Find other buckets that contain this bucket.
// TODO: Optimize?
while (id.getUsedBits() > 1) {
id.setUsedBits(id.getUsedBits() - 1);
id = id.stripUnused();
- document::BucketId::Type key = id.toKey();
+ BucketId::Type key = id.toKey();
typename Map::const_iterator iter = _map.find(key);
if (iter != _map.end()) {
@@ -831,9 +827,9 @@ LockableMap<Map>::getAllContaining(const document::BucketId& bucket,
template<typename Map>
void
LockableMap<Map>::addAndLockResults(
- const std::vector<document::BucketId::Type> keys,
+ const std::vector<BucketId::Type> keys,
const char* clientId,
- std::map<document::BucketId, WrappedEntry>& results,
+ std::map<BucketId, WrappedEntry>& results,
vespalib::MonitorGuard& guard)
{
// Wait until all buckets are free to be added, then add them all.
@@ -858,8 +854,7 @@ LockableMap<Map>::addAndLockResults(
typename Map::iterator it = _map.find(keys[i]);
if (it != _map.end()) {
_lockedKeys.insert(LockId(keys[i], clientId));
- results[document::BucketId(
- document::BucketId::keyToBucketId(keys[i]))]
+ results[BucketId(BucketId::keyToBucketId(keys[i]))]
= WrappedEntry(*this, keys[i], it->second,
clientId, true);
}
@@ -873,8 +868,8 @@ namespace {
uint8_t getMinDiffBits(uint16_t minBits, const document::BucketId& a, const document::BucketId& b) {
for (uint32_t i = minBits; i <= std::min(a.getUsedBits(), b.getUsedBits()); i++) {
- document::BucketId a1 = document::BucketId(i, a.getRawId());
- document::BucketId b1 = document::BucketId(i, b.getRawId());
+ document::BucketId a1(i, a.getRawId());
+ document::BucketId b1(i, b.getRawId());
if (b1.getId() != a1.getId()) {
return i;
}
@@ -889,7 +884,7 @@ typename LockableMap<Map>::WrappedEntry
LockableMap<Map>::createAppropriateBucket(
uint16_t newBucketBits,
const char* clientId,
- const document::BucketId& bucket)
+ const BucketId& bucket)
{
vespalib::MonitorGuard guard(_lock);
typename Map::const_iterator iter = _map.lower_bound(bucket.toKey());
@@ -898,19 +893,17 @@ LockableMap<Map>::createAppropriateBucket(
// bucket's used bits should be the highest used bits it can be while
// still being different from both of these.
if (iter != _map.end()) {
- newBucketBits = getMinDiffBits(newBucketBits,
- document::BucketId(document::BucketId::keyToBucketId(iter->first)), bucket);
+ newBucketBits = getMinDiffBits(newBucketBits, BucketId(BucketId::keyToBucketId(iter->first)), bucket);
}
if (iter != _map.begin()) {
--iter;
- newBucketBits = getMinDiffBits(newBucketBits,
- document::BucketId(document::BucketId::keyToBucketId(iter->first)), bucket);
+ newBucketBits = getMinDiffBits(newBucketBits, BucketId(BucketId::keyToBucketId(iter->first)), bucket);
}
- document::BucketId newBucket(newBucketBits, bucket.getRawId());
+ BucketId newBucket(newBucketBits, bucket.getRawId());
newBucket.setUsedBits(newBucketBits);
- document::BucketId::Type key = newBucket.stripUnused().toKey();
+ BucketId::Type key = newBucket.stripUnused().toKey();
LockId lid(key, clientId);
ackquireKey(lid, guard);
@@ -922,17 +915,17 @@ LockableMap<Map>::createAppropriateBucket(
template<typename Map>
std::map<document::BucketId, typename LockableMap<Map>::WrappedEntry>
-LockableMap<Map>::getContained(const document::BucketId& bucket,
+LockableMap<Map>::getContained(const BucketId& bucket,
const char* clientId)
{
vespalib::MonitorGuard guard(_lock);
- std::map<document::BucketId, WrappedEntry> results;
+ std::map<BucketId, WrappedEntry> results;
- document::BucketId result;
- document::BucketId::Type keyResult;
- document::BucketId::Type nextKey;
+ BucketId result;
+ BucketId::Type keyResult;
+ BucketId::Type nextKey;
- std::vector<document::BucketId::Type> keys;
+ std::vector<BucketId::Type> keys;
if (getMostSpecificMatch(bucket, result, keyResult, nextKey)) {
keys.push_back(keyResult);
@@ -955,13 +948,13 @@ LockableMap<Map>::getContained(const document::BucketId& bucket,
template<typename Map>
void
-LockableMap<Map>::getAllWithoutLocking(const document::BucketId& bucket,
- const document::BucketId& sibling,
- std::vector<document::BucketId::Type>& keys)
+LockableMap<Map>::getAllWithoutLocking(const BucketId& bucket,
+ const BucketId& sibling,
+ std::vector<BucketId::Type>& keys)
{
- document::BucketId result;
- document::BucketId::Type keyResult;
- document::BucketId::Type nextKey;
+ BucketId result;
+ BucketId::Type keyResult;
+ BucketId::Type nextKey;
typename Map::iterator it = _map.end();
@@ -974,7 +967,7 @@ LockableMap<Map>::getAllWithoutLocking(const document::BucketId& bucket,
it = _map.find(keyResult);
if (it != _map.end()) {
// Skipping nextKey, since it was equal to keyResult
- it++;
+ ++it;
}
} else {
// Find the super buckets for the input bucket
@@ -986,19 +979,17 @@ LockableMap<Map>::getAllWithoutLocking(const document::BucketId& bucket,
if (it != _map.end()) {
// Nextkey might be contained in the imput bucket,
// e.g. if it is the first bucket in bucketdb
- document::BucketId id = document::BucketId(
- document::BucketId::keyToBucketId(it->first));
+ BucketId id = BucketId(BucketId::keyToBucketId(it->first));
if (!bucket.contains(id)) {
- it++;
+ ++it;
}
}
}
// Buckets contained in the found bucket will come immediately after it.
// Traverse the map to find them.
- for (; it != _map.end(); it++) {
- document::BucketId id(
- document::BucketId(document::BucketId::keyToBucketId(it->first)));
+ for (; it != _map.end(); ++it) {
+ BucketId id(BucketId(BucketId::keyToBucketId(it->first)));
if (bucket.contains(id)) {
keys.push_back(it->first);
@@ -1017,13 +1008,13 @@ LockableMap<Map>::getAllWithoutLocking(const document::BucketId& bucket,
*/
template<typename Map>
std::map<document::BucketId, typename LockableMap<Map>::WrappedEntry>
-LockableMap<Map>::getAll(const document::BucketId& bucket, const char* clientId,
- const document::BucketId& sibling)
+LockableMap<Map>::getAll(const BucketId& bucket, const char* clientId,
+ const BucketId& sibling)
{
vespalib::MonitorGuard guard(_lock);
- std::map<document::BucketId, WrappedEntry> results;
- std::vector<document::BucketId::Type> keys;
+ std::map<BucketId, WrappedEntry> results;
+ std::vector<BucketId::Type> keys;
getAllWithoutLocking(bucket, sibling, keys);
@@ -1038,8 +1029,8 @@ LockableMap<Map>::isConsistent(const typename LockableMap<Map>::WrappedEntry& en
{
vespalib::MonitorGuard guard(_lock);
- document::BucketId sibling(0);
- std::vector<document::BucketId::Type> keys;
+ BucketId sibling(0);
+ std::vector<BucketId::Type> keys;
getAllWithoutLocking(entry.getBucketId(), sibling, keys);
assert(keys.size() >= 1);
@@ -1058,7 +1049,7 @@ LockableMap<Map>::showLockClients(vespalib::asciistream & out) const
it != _lockedKeys.end(); ++it)
{
out << "\n "
- << document::BucketId(document::BucketId::keyToBucketId(it->_key))
+ << BucketId(BucketId::keyToBucketId(it->_key))
<< " - " << it->_owner;
}
out << "\nClients waiting for keys:";
@@ -1066,7 +1057,7 @@ LockableMap<Map>::showLockClients(vespalib::asciistream & out) const
it != _lockWaiters.end(); ++it)
{
out << "\n "
- << document::BucketId(document::BucketId::keyToBucketId(it->second._key))
+ << BucketId(BucketId::keyToBucketId(it->second._key))
<< " - " << it->second._owner;
}
}
diff --git a/storage/src/vespa/storage/bucketmover/bucketmover.cpp b/storage/src/vespa/storage/bucketmover/bucketmover.cpp
index dab6f2ebdc0..f6319b7ef55 100644
--- a/storage/src/vespa/storage/bucketmover/bucketmover.cpp
+++ b/storage/src/vespa/storage/bucketmover/bucketmover.cpp
@@ -1,7 +1,6 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/fastos/fastos.h>
-#include <boost/lexical_cast.hpp>
#include <iomanip>
#include <vespa/storage/bucketmover/bucketmover.h>
#include <vespa/storage/bucketmover/htmltable.h>
@@ -31,8 +30,7 @@ BucketMover::BucketMover(const config::ConfigUri & configUri,
{
if (!configUri.empty()) {
using vespa::config::content::core::StorBucketmoverConfig;
- _configFetcher.subscribe<StorBucketmoverConfig>(
- configUri.getConfigId(), this);
+ _configFetcher.subscribe<StorBucketmoverConfig>(configUri.getConfigId(), this);
_configFetcher.start();
}
_component.registerStatusPage(*this);
@@ -193,8 +191,7 @@ BucketMover::tick()
{
vespalib::MonitorGuard monitor(_wait);
- framework::SecondTime currentTime(
- _component.getClock().getTimeInSeconds());
+ framework::SecondTime currentTime(_component.getClock().getTimeInSeconds());
if (_currentRun.get() == 0) {
if (currentTime >= _nextRun) {
diff --git a/storage/src/vespa/storage/common/hostreporter/cpureporter.cpp b/storage/src/vespa/storage/common/hostreporter/cpureporter.cpp
index 5ed6d560975..d7f59e07d4e 100644
--- a/storage/src/vespa/storage/common/hostreporter/cpureporter.cpp
+++ b/storage/src/vespa/storage/common/hostreporter/cpureporter.cpp
@@ -8,8 +8,7 @@
#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/text/stringtokenizer.h>
#include "kernelmetrictool.h"
-
-#include <boost/array.hpp>
+#include <array>
LOG_SETUP(".cpureporter");
@@ -30,7 +29,7 @@ const vespalib::string priorityText[proprityLevels] =
struct CpuInfo {
int _cpuIndex;
- boost::array<uint64_t, proprityLevels> _usage;
+ std::array<uint64_t, proprityLevels> _usage;
CpuInfo(int index) : _cpuIndex(index) {}
uint64_t getTotalUsage() const {
diff --git a/storage/src/vespa/storage/common/statusmetricconsumer.cpp b/storage/src/vespa/storage/common/statusmetricconsumer.cpp
index 4f94fbb0be8..d81de03919d 100644
--- a/storage/src/vespa/storage/common/statusmetricconsumer.cpp
+++ b/storage/src/vespa/storage/common/statusmetricconsumer.cpp
@@ -436,19 +436,6 @@ StatusMetricConsumer::printHtmlMetricsReport(
std::ostream& out, const metrics::MetricSnapshot& data,
bool includeNotUsed) const
{
- using namespace boost::assign;
-
- /*
- std::cerr << "All metrics available:\n";
- for (MetricSnapshot::const_iterator it = data.begin();
- it != data.end(); ++it)
- {
- std::cerr << " '" << it->first << "' => '";
- it->second->printXml(std::cerr);
- std::cerr << "'.\n";
- }
- */
-
std::map<String, Metric::SP> usedMetrics;
out << "<h2>Metrics report for the last "
diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/mergelimiter.cpp b/storage/src/vespa/storage/distributor/operations/idealstate/mergelimiter.cpp
index 18a2f8c8118..618ba9ba884 100644
--- a/storage/src/vespa/storage/distributor/operations/idealstate/mergelimiter.cpp
+++ b/storage/src/vespa/storage/distributor/operations/idealstate/mergelimiter.cpp
@@ -1,7 +1,6 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/storage/distributor/operations/idealstate/mergelimiter.h>
-#include <vespa/vdslib/container/smallvector.h>
#include <vespa/log/log.h>
@@ -19,7 +18,7 @@ MergeLimiter::MergeLimiter(uint16_t maxNodes)
namespace {
class EqualCopies {
uint32_t _checksum;
- lib::SmallVector<MergeMetaData> _copies;
+ std::vector<MergeMetaData> _copies;
uint32_t _trustedCopies;
public:
@@ -47,14 +46,8 @@ namespace {
}
};
- vespalib::asciistream& operator<<(vespalib::asciistream& out,
- const EqualCopies& e)
- {
- return out << "EqualCopies(" << e.size() << ")";
- }
-
class Statistics {
- lib::SmallVector<EqualCopies> _groups;
+ std::vector<EqualCopies> _groups;
uint32_t _trustedCopies;
public:
@@ -62,6 +55,7 @@ namespace {
Statistics(const MergeLimiter::NodeArray& a)
: _trustedCopies(0)
{
+ _groups.reserve(a.size());
for (uint32_t i=0, n=a.size(); i<n; ++i) {
add(a[i]);
if (a[i].trusted()) {
@@ -87,18 +81,20 @@ namespace {
uint32_t trustedCount() const { return _trustedCopies; }
Statistics extractGroupsWithTrustedCopies() {
- lib::SmallVector<EqualCopies> _remaining;
+ std::vector<EqualCopies> remaining;
Statistics trusted;
+ remaining.reserve(_groups.size());
+ trusted._groups.reserve(_groups.size());
for (uint32_t i=0, n=_groups.size(); i<n; ++i) {
if (_groups[i].hasTrusted()) {
trusted._groups.push_back(_groups[i]);
trusted._trustedCopies += _groups[i].trustedCount();
} else {
- _remaining.push_back(_groups[i]);
+ remaining.push_back(_groups[i]);
_trustedCopies -= _groups[i].trustedCount();
}
}
- swap(_remaining, _groups);
+ swap(remaining, _groups);
return trusted;
}
bool extractNext(MergeMetaData& data, uint32_t& last) {
@@ -112,9 +108,12 @@ namespace {
return true;
}
void removeGroup(uint32_t groupIndex) {
- lib::SmallVector<EqualCopies> remaining;
+ std::vector<EqualCopies> remaining;
+ remaining.reserve(_groups.size()-1);
for (uint32_t i=0, n=_groups.size(); i<n; ++i) {
- if (i != groupIndex) remaining.push_back(_groups[i]);
+ if (i != groupIndex) {
+ remaining.push_back(_groups[i]);
+ }
}
remaining.swap(_groups);
}
diff --git a/storage/src/vespa/storage/distributor/operationtargetresolver.h b/storage/src/vespa/storage/distributor/operationtargetresolver.h
index 87757ec3227..380ce3ae1e6 100644
--- a/storage/src/vespa/storage/distributor/operationtargetresolver.h
+++ b/storage/src/vespa/storage/distributor/operationtargetresolver.h
@@ -7,7 +7,6 @@
#pragma once
#include <vespa/document/bucket/bucketid.h>
-#include <vespa/vdslib/container/smallvector.h>
#include <vespa/vdslib/state/node.h>
#include <vespa/vespalib/util/printable.h>
@@ -42,7 +41,7 @@ public:
}
};
-class OperationTargetList : public lib::SmallVector<OperationTarget> {
+class OperationTargetList : public std::vector<OperationTarget> {
public:
bool hasAnyNewCopies() const {
for (size_t i=0; i<size(); ++i) {
diff --git a/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h b/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h
index 08d79c501e4..36cb02dc213 100644
--- a/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h
+++ b/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h
@@ -27,7 +27,7 @@ struct BucketInstance : public vespalib::AsciiPrintable {
};
class BucketInstanceList : public vespalib::AsciiPrintable {
- lib::SmallVector<BucketInstance> _instances;
+ std::vector<BucketInstance> _instances;
/**
* Resolve and return the least specific bucket in the subtree of (and
@@ -73,8 +73,8 @@ public:
OperationTargetList createTargets();
- void print(vespalib::asciistream& out, const PrintProperties& p) const {
- _instances.print(out, p);
+ void print(vespalib::asciistream& out, const PrintProperties& p) const override {
+ vespalib::print(_instances, out, p);
}
};
diff --git a/storage/src/vespa/storage/tools/generatedistributionbits.cpp b/storage/src/vespa/storage/tools/generatedistributionbits.cpp
index 0bf27c5f05c..83bf602d0c3 100644
--- a/storage/src/vespa/storage/tools/generatedistributionbits.cpp
+++ b/storage/src/vespa/storage/tools/generatedistributionbits.cpp
@@ -1,6 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/fastos/fastos.h>
-#include <boost/assign.hpp>
#include <vespa/document/bucket/bucketidfactory.h>
#include <vespa/vespalib/util/programoptions.h>
#include <vespa/vdslib/distribution/distribution.h>
@@ -60,13 +59,10 @@ namespace storage {
}
void finalize() {
- using namespace boost::assign;
if (highRange) {
- nodeCounts += 16, 20, 32, 48, 64, 100, 128, 160, 200, 256, 350,
- 500, 800, 1000, 5000;
+ nodeCounts.insert(nodeCounts.begin(), {16, 20, 32, 48, 64, 100, 128, 160, 200, 256, 350, 500, 800, 1000, 5000});
} else {
- nodeCounts += 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
- 11, 12, 13, 14, 15;
+ nodeCounts.insert(nodeCounts.begin(), {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15});
}
for (uint32_t i=1; i<=maxBit; ++i) {
bitCounts.push_back(i);