summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-12-14 22:58:54 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2016-12-15 13:12:36 +0100
commit2a85dc3fd5af5c33601cf04ead06c7545fa46d75 (patch)
treef46f355235fd7684a9f8a6bb562797fd985d1180 /storage
parentd9b45214d28207564329991afe70afc358fe6d12 (diff)
Split in hash_xxx, array, lru, cache ++ in hpp files. To reduce clinon build
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/bucketdb/bucketmanager.cpp1
-rw-r--r--storage/src/vespa/storage/bucketdb/judymultimap.h4
-rw-r--r--storage/src/vespa/storage/bucketdb/judymultimap.hpp9
-rw-r--r--storage/src/vespa/storage/bucketdb/lockablemap.h2
-rw-r--r--storage/src/vespa/storage/bucketdb/lockablemap.hpp8
-rw-r--r--storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.cpp12
-rw-r--r--storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h13
-rw-r--r--storage/src/vespa/storage/config/distributorconfiguration.cpp11
-rw-r--r--storage/src/vespa/storage/config/distributorconfiguration.h1
-rw-r--r--storage/src/vespa/storage/distributor/bucketdb/bucketdbmetricupdater.cpp5
-rw-r--r--storage/src/vespa/storage/distributor/bucketdb/bucketdbmetricupdater.h3
-rw-r--r--storage/src/vespa/storage/distributor/externaloperationhandler.cpp18
-rw-r--r--storage/src/vespa/storage/distributor/idealstatemanager.cpp20
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp1
-rw-r--r--storage/src/vespa/storage/persistence/bucketprocessor.cpp4
-rw-r--r--storage/src/vespa/storage/persistence/diskmoveoperationhandler.cpp6
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp45
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h129
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp12
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.cpp5
-rw-r--r--storage/src/vespa/storage/persistence/messages.cpp2
-rw-r--r--storage/src/vespa/storage/persistence/persistencethread.cpp15
-rw-r--r--storage/src/vespa/storage/persistence/processallhandler.cpp8
-rw-r--r--storage/src/vespa/storage/persistence/types.cpp4
-rw-r--r--storage/src/vespa/storage/storageserver/communicationmanager.cpp8
-rw-r--r--storage/src/vespa/storage/visiting/dumpvisitor.cpp2
-rw-r--r--storage/src/vespa/storage/visiting/recoveryvisitor.cpp9
-rw-r--r--storage/src/vespa/storage/visiting/visitor.cpp12
-rw-r--r--storage/src/vespa/storage/visiting/visitormanager.cpp20
-rw-r--r--storage/src/vespa/storage/visiting/visitormetrics.cpp1
-rw-r--r--storage/src/vespa/storage/visiting/visitorthread.cpp6
31 files changed, 153 insertions, 243 deletions
diff --git a/storage/src/vespa/storage/bucketdb/bucketmanager.cpp b/storage/src/vespa/storage/bucketdb/bucketmanager.cpp
index 7552a471256..be189a0bfa9 100644
--- a/storage/src/vespa/storage/bucketdb/bucketmanager.cpp
+++ b/storage/src/vespa/storage/bucketdb/bucketmanager.cpp
@@ -19,6 +19,7 @@
#include <vespa/storageapi/message/bucketsplitting.h>
#include <vespa/storageapi/message/stat.h>
#include <vespa/storage/storageutil/distributorstatecache.h>
+#include <vespa/vespalib/stllike/hash_map.hpp>
#include <vespa/config/config.h>
#include <unordered_map>
#include <vespa/log/log.h>
diff --git a/storage/src/vespa/storage/bucketdb/judymultimap.h b/storage/src/vespa/storage/bucketdb/judymultimap.h
index 44a7c7e712c..1c829a6f1de 100644
--- a/storage/src/vespa/storage/bucketdb/judymultimap.h
+++ b/storage/src/vespa/storage/bucketdb/judymultimap.h
@@ -37,8 +37,8 @@ template<class Type0,
class Type3 = Type2 >
class JudyMultiMap : public vespalib::Printable {
public:
- JudyMultiMap()
- : _values0(1), _values1(1), _values2(1), _values3(1), _free(4) {}
+ JudyMultiMap();
+ ~JudyMultiMap();
class Iterator;
class ConstIterator;
diff --git a/storage/src/vespa/storage/bucketdb/judymultimap.hpp b/storage/src/vespa/storage/bucketdb/judymultimap.hpp
index 3bc9263aa37..5ce2c302789 100644
--- a/storage/src/vespa/storage/bucketdb/judymultimap.hpp
+++ b/storage/src/vespa/storage/bucketdb/judymultimap.hpp
@@ -3,12 +3,21 @@
#include "judymultimap.h"
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/array.hpp>
#include <set>
#include <ostream>
namespace storage {
template<class T0, class T1, class T2, class T3>
+JudyMultiMap<T0, T1, T2, T3>::JudyMultiMap()
+ : _values0(1), _values1(1), _values2(1), _values3(1), _free(4)
+{ }
+
+template<class T0, class T1, class T2, class T3>
+JudyMultiMap<T0, T1, T2, T3>::~JudyMultiMap() { }
+
+template<class T0, class T1, class T2, class T3>
bool
JudyMultiMap<T0, T1, T2, T3>::
operator==(const JudyMultiMap<T0, T1, T2, T3>& map) const
diff --git a/storage/src/vespa/storage/bucketdb/lockablemap.h b/storage/src/vespa/storage/bucketdb/lockablemap.h
index 3a7843405c8..6301014d26b 100644
--- a/storage/src/vespa/storage/bucketdb/lockablemap.h
+++ b/storage/src/vespa/storage/bucketdb/lockablemap.h
@@ -212,7 +212,7 @@ private:
~LockIdSet();
void print(std::ostream& out, bool verbose, const std::string& indent) const;
bool exist(const LockId & lid) const { return this->find(lid) != Hash::end(); }
- size_t getMemoryUsage() const { return Hash::getMemoryConsumption(); }
+ size_t getMemoryUsage() const;
};
class LockWaiters {
diff --git a/storage/src/vespa/storage/bucketdb/lockablemap.hpp b/storage/src/vespa/storage/bucketdb/lockablemap.hpp
index c84ea68cd33..7510b5d1a87 100644
--- a/storage/src/vespa/storage/bucketdb/lockablemap.hpp
+++ b/storage/src/vespa/storage/bucketdb/lockablemap.hpp
@@ -3,6 +3,8 @@
#include "lockablemap.h"
#include <vespa/vespalib/stllike/asciistream.h>
+#include <vespa/vespalib/stllike/hash_map.hpp>
+#include <vespa/vespalib/stllike/hash_set.hpp>
#include <thread>
#include <chrono>
@@ -15,6 +17,12 @@ template<typename Map>
LockableMap<Map>::LockIdSet::~LockIdSet() { }
template<typename Map>
+size_t
+LockableMap<Map>::LockIdSet::getMemoryUsage() const {
+ return Hash::getMemoryConsumption();
+}
+
+template<typename Map>
LockableMap<Map>::LockWaiters::LockWaiters() : _id(0), _map() { }
template<typename Map>
diff --git a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.cpp b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.cpp
index 1021cf7f212..e5db345505c 100644
--- a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.cpp
+++ b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.cpp
@@ -10,10 +10,10 @@
#include <vespa/config-stor-filestor.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/config/config.h>
-#include <vespa/vespalib/stllike/hash_set.h>
+#include <vespa/vespalib/stllike/hash_map.hpp>
#include <iomanip>
-#include <vespa/log/log.h>
+#include <vespa/log/log.h>
LOG_SETUP(".storage.bucketdb.initializer");
namespace storage {
@@ -106,6 +106,14 @@ StorageBucketDBInitializer::Metrics::Metrics(framework::Component& component)
component.registerMetric(*this);
}
+StorageBucketDBInitializer::GlobalState::GlobalState()
+ : _insertedCount(0), _infoReadCount(0),
+ _infoSetByLoad(0), _dirsListed(0), _dirsToList(0),
+ _gottenInitProgress(false), _doneListing(false),
+ _doneInitializing(false)
+{ }
+StorageBucketDBInitializer::GlobalState::~GlobalState() { }
+
StorageBucketDBInitializer::StorageBucketDBInitializer(
const config::ConfigUri & configUri,
const spi::PartitionStateList& partitions,
diff --git a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h
index 01445529865..a0f4345a2a6 100644
--- a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h
+++ b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h
@@ -100,10 +100,8 @@ class StorageBucketDBInitializer : public StorageLink,
Metrics(framework::Component&);
};
struct GlobalState {
- vespalib::hash_map<api::StorageMessage::Id,
- ReadBucketList::SP> _lists;
- vespalib::hash_map<api::StorageMessage::Id,
- InternalBucketJoinCommand::SP> _joins;
+ vespalib::hash_map<api::StorageMessage::Id, ReadBucketList::SP> _lists;
+ vespalib::hash_map<api::StorageMessage::Id, InternalBucketJoinCommand::SP> _joins;
IdDiskMap _infoRequests;
std::list<api::StorageMessage::SP> _replies;
uint64_t _insertedCount;
@@ -121,11 +119,8 @@ class StorageBucketDBInitializer : public StorageLink,
// This lock protects the reply list.
vespalib::Monitor _replyLock;
- GlobalState()
- : _insertedCount(0), _infoReadCount(0),
- _infoSetByLoad(0), _dirsListed(0), _dirsToList(0),
- _gottenInitProgress(false), _doneListing(false),
- _doneInitializing(false) {}
+ GlobalState();
+ ~GlobalState();
};
diff --git a/storage/src/vespa/storage/config/distributorconfiguration.cpp b/storage/src/vespa/storage/config/distributorconfiguration.cpp
index 95322ad663a..623312a8049 100644
--- a/storage/src/vespa/storage/config/distributorconfiguration.cpp
+++ b/storage/src/vespa/storage/config/distributorconfiguration.cpp
@@ -1,11 +1,10 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/storage/config/distributorconfiguration.h>
-#include <vespa/log/log.h>
+#include "distributorconfiguration.h"
#include <vespa/document/select/parser.h>
-#include <vespa/document/select/node.h>
#include <vespa/document/select/traversingvisitor.h>
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/log/log.h>
LOG_SETUP(".distributorconfiguration");
namespace storage {
@@ -34,9 +33,9 @@ DistributorConfiguration::DistributorConfiguration(StorageComponent& component)
_enableHostInfoReporting(true),
_disableBucketActivation(false),
_minimumReplicaCountingMode(ReplicaCountingMode::TRUSTED)
-{
-
-}
+{ }
+
+DistributorConfiguration::~DistributorConfiguration() { }
namespace {
diff --git a/storage/src/vespa/storage/config/distributorconfiguration.h b/storage/src/vespa/storage/config/distributorconfiguration.h
index b18c09955fa..fd8ed0c272b 100644
--- a/storage/src/vespa/storage/config/distributorconfiguration.h
+++ b/storage/src/vespa/storage/config/distributorconfiguration.h
@@ -16,6 +16,7 @@ namespace distributor {
class DistributorConfiguration {
public:
DistributorConfiguration(StorageComponent& component);
+ ~DistributorConfiguration();
struct MaintenancePriorities
{
diff --git a/storage/src/vespa/storage/distributor/bucketdb/bucketdbmetricupdater.cpp b/storage/src/vespa/storage/distributor/bucketdb/bucketdbmetricupdater.cpp
index 1b82cdfeaf3..6de7722496b 100644
--- a/storage/src/vespa/storage/distributor/bucketdb/bucketdbmetricupdater.cpp
+++ b/storage/src/vespa/storage/distributor/bucketdb/bucketdbmetricupdater.cpp
@@ -1,12 +1,9 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/storage/distributor/bucketdb/bucketdbmetricupdater.h>
-
+#include "bucketdbmetricupdater.h"
#include <vespa/storage/distributor/distributormetricsset.h>
#include <vespa/storage/distributor/idealstatemetricsset.h>
-#include <algorithm>
-
namespace storage {
namespace distributor {
diff --git a/storage/src/vespa/storage/distributor/bucketdb/bucketdbmetricupdater.h b/storage/src/vespa/storage/distributor/bucketdb/bucketdbmetricupdater.h
index 9f59426f983..3c4dfa6f0fc 100644
--- a/storage/src/vespa/storage/distributor/bucketdb/bucketdbmetricupdater.h
+++ b/storage/src/vespa/storage/distributor/bucketdb/bucketdbmetricupdater.h
@@ -94,8 +94,7 @@ public:
}
private:
- void updateMinReplicationStats(const BucketDatabase::Entry& entry,
- uint32_t trustedCopies);
+ void updateMinReplicationStats(const BucketDatabase::Entry& entry, uint32_t trustedCopies);
void resetStats();
};
diff --git a/storage/src/vespa/storage/distributor/externaloperationhandler.cpp b/storage/src/vespa/storage/distributor/externaloperationhandler.cpp
index 30ff11fc85f..bc0429f806c 100644
--- a/storage/src/vespa/storage/distributor/externaloperationhandler.cpp
+++ b/storage/src/vespa/storage/distributor/externaloperationhandler.cpp
@@ -1,13 +1,8 @@
// 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 <vespa/storage/distributor/externaloperationhandler.h>
-
-#include <vespa/document/bucket/bucketidfactory.h>
+#include "externaloperationhandler.h"
+#include "distributor.h"
#include <vespa/document/base/documentid.h>
-#include <vespa/log/log.h>
-#include <vespa/storage/config/config-stor-server.h>
-#include <vespa/storage/storageutil/log.h>
#include <vespa/storage/distributor/operations/external/putoperation.h>
#include <vespa/storage/distributor/operations/external/twophaseupdateoperation.h>
#include <vespa/storage/distributor/operations/external/updateoperation.h>
@@ -20,18 +15,13 @@
#include <vespa/storage/distributor/operations/external/visitoroperation.h>
#include <vespa/document/util/stringutil.h>
#include <vespa/storageapi/message/persistence.h>
-#include <vespa/storageapi/message/state.h>
#include <vespa/storageapi/message/multioperation.h>
#include <vespa/storageapi/message/removelocation.h>
#include <vespa/storageapi/message/batch.h>
-#include <vespa/storage/storageserver/storagemetricsset.h>
-#include <vespa/storage/distributor/distributormetricsset.h>
-#include <vespa/storageapi/message/bucket.h>
#include <vespa/storageapi/message/stat.h>
-#include <vespa/vdslib/distribution/distribution.h>
-#include <vespa/storage/distributor/distributor.h>
-#include <vespa/storage/distributor/distributormetricsset.h>
+#include <vespa/vespalib/stllike/hash_map.hpp>
+#include <vespa/log/log.h>
LOG_SETUP(".distributor.manager");
namespace storage {
diff --git a/storage/src/vespa/storage/distributor/idealstatemanager.cpp b/storage/src/vespa/storage/distributor/idealstatemanager.cpp
index eba37435462..e4e40f32be5 100644
--- a/storage/src/vespa/storage/distributor/idealstatemanager.cpp
+++ b/storage/src/vespa/storage/distributor/idealstatemanager.cpp
@@ -1,25 +1,17 @@
// 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 <vespa/storage/distributor/idealstatemanager.h>
-#include <vespa/storage/distributor/operations/idealstate/idealstateoperation.h>
-#include <vespa/log/log.h>
-#include <vespa/storageapi/message/state.h>
-#include <vespa/vespalib/util/stringfmt.h>
+#include "idealstatemanager.h"
+#include "statecheckers.h"
+#include "distributor.h"
+#include "idealstatemetricsset.h"
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/storage/storageserver/storagemetricsset.h>
-#include <vespa/storageapi/message/internal.h>
#include <vespa/storageapi/message/persistence.h>
#include <vespa/storageapi/message/multioperation.h>
#include <vespa/storage/common/bucketmessages.h>
-#include <vespa/storage/distributor/statecheckers.h>
-#include <vespa/storageapi/message/bucket.h>
-#include <vespa/storage/distributor/distributormetricsset.h>
-#include <vespa/storageapi/message/stat.h>
-#include <vespa/storage/distributor/distributor.h>
-#include <vespa/storageframework/storageframework.h>
-#include <vespa/storage/distributor/idealstatemetricsset.h>
+#include <vespa/vespalib/stllike/hash_map.hpp>
+#include <vespa/log/log.h>
LOG_SETUP(".distributor.operation.queue");
using storage::lib::Node;
diff --git a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp
index 9997cc029d9..af0e016a77c 100644
--- a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp
@@ -9,6 +9,7 @@
#include <vespa/storageapi/message/persistence.h>
#include <vespa/storage/distributor/distributormetricsset.h>
#include <vespa/storageapi/message/batch.h>
+#include <vespa/vespalib/stllike/hash_map.hpp>
#include <vespa/log/log.h>
LOG_SETUP(".distributor.callback.twophaseupdate");
diff --git a/storage/src/vespa/storage/persistence/bucketprocessor.cpp b/storage/src/vespa/storage/persistence/bucketprocessor.cpp
index d185d94f11e..c15b4ac58e1 100644
--- a/storage/src/vespa/storage/persistence/bucketprocessor.cpp
+++ b/storage/src/vespa/storage/persistence/bucketprocessor.cpp
@@ -4,8 +4,6 @@
#include <vespa/document/fieldset/fieldsets.h>
#include <vespa/vespalib/stllike/asciistream.h>
-#include <stdexcept>
-
namespace storage {
namespace {
@@ -24,7 +22,7 @@ public:
: _spi(spi),
_iteratorId(iteratorId),
_context(context)
- {}
+ { }
~IteratorGuard()
{
assert(_iteratorId != 0);
diff --git a/storage/src/vespa/storage/persistence/diskmoveoperationhandler.cpp b/storage/src/vespa/storage/persistence/diskmoveoperationhandler.cpp
index aaadb8a7f7d..6040a4b58ab 100644
--- a/storage/src/vespa/storage/persistence/diskmoveoperationhandler.cpp
+++ b/storage/src/vespa/storage/persistence/diskmoveoperationhandler.cpp
@@ -1,8 +1,8 @@
// 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 <vespa/storage/persistence/diskmoveoperationhandler.h>
-#include <vespa/log/log.h>
+#include "diskmoveoperationhandler.h"
+
+#include <vespa/log/log.h>
LOG_SETUP(".persistence.diskmoveoperationhandler");
namespace storage {
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
index 36d0c477b39..fb9b18c7341 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
@@ -1,10 +1,7 @@
// 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 <vespa/storage/persistence/filestorage/filestorhandlerimpl.h>
-#include <vespa/log/log.h>
-#include <vespa/storageapi/messageapi/storagemessage.h>
-#include <vespa/storageapi/message/bucket.h>
+#include "filestorhandlerimpl.h"
+#include "filestormetrics.h"
#include <vespa/storageapi/message/bucketsplitting.h>
#include <vespa/storageapi/message/multioperation.h>
#include <vespa/storageapi/message/persistence.h>
@@ -16,12 +13,13 @@
#include <vespa/storage/common/statusmessages.h>
#include <vespa/storage/common/bucketoperationlogger.h>
#include <vespa/storage/common/messagebucketid.h>
-#include <vespa/storage/persistence/filestorage/filestormetrics.h>
#include <vespa/storage/persistence/messages.h>
#include <vespa/vespalib/util/random.h>
#include <vespa/storageapi/message/stat.h>
#include <vespa/storageapi/message/batch.h>
+#include <vespa/vespalib/stllike/hash_map.hpp>
+#include <vespa/log/log.h>
LOG_SETUP(".persistence.filestor.handler.impl");
namespace storage {
@@ -57,13 +55,10 @@ FileStorHandlerImpl::FileStorHandlerImpl(
_component.registerMetricUpdateHook(*this, framework::SecondTime(5));
}
-FileStorHandlerImpl::~FileStorHandlerImpl()
-{
-}
+FileStorHandlerImpl::~FileStorHandlerImpl() { }
void
-FileStorHandlerImpl::addMergeStatus(const document::BucketId& bucket,
- MergeStatus::SP status)
+FileStorHandlerImpl::addMergeStatus(const document::BucketId& bucket, MergeStatus::SP status)
{
vespalib::LockGuard mlock(_mergeStatesLock);
if (_mergeStates.find(bucket) != _mergeStates.end()) {;
@@ -1197,8 +1192,7 @@ FileStorHandlerImpl::failOperations(
}
void
-FileStorHandlerImpl::sendCommand(
- const std::shared_ptr<api::StorageCommand>& msg)
+FileStorHandlerImpl::sendCommand(const std::shared_ptr<api::StorageCommand>& msg)
{
_messageSender.sendCommand(msg);
}
@@ -1209,18 +1203,35 @@ FileStorHandlerImpl::sendReply(const std::shared_ptr<api::StorageReply>& msg)
_messageSender.sendReply(msg);
}
+FileStorHandlerImpl::MessageEntry::MessageEntry(const std::shared_ptr<api::StorageMessage>& cmd,
+ const document::BucketId& bId)
+ : _command(cmd),
+ _timer(),
+ _bucketId(bId),
+ _priority(cmd->getPriority())
+{ }
+
+FileStorHandlerImpl::MessageEntry::MessageEntry(const MessageEntry& entry)
+ : _command(entry._command),
+ _timer(entry._timer),
+ _bucketId(entry._bucketId),
+ _priority(entry._priority)
+{ }
+
+FileStorHandlerImpl::MessageEntry::~MessageEntry() { }
+
FileStorHandlerImpl::Disk::Disk()
: lock(),
queue(),
lockedBuckets(100),
metrics(0),
state(FileStorHandler::AVAILABLE)
-{
-}
+{ }
+
+FileStorHandlerImpl::Disk::~Disk() { }
bool
-FileStorHandlerImpl::Disk::isLocked(
- const document::BucketId& bucket) const noexcept
+FileStorHandlerImpl::Disk::isLocked(const document::BucketId& bucket) const noexcept
{
return (lockedBuckets.find(bucket) != lockedBuckets.end());
}
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h
index 5abf033be2b..27bb537ab18 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h
+++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h
@@ -50,20 +50,10 @@ public:
document::BucketId _bucketId;
uint8_t _priority;
- MessageEntry(const std::shared_ptr<api::StorageMessage>& cmd,
- const document::BucketId& bId)
- : _command(cmd),
- _bucketId(bId),
- _priority(cmd->getPriority())
- {}
-
- MessageEntry(const MessageEntry& entry)
- : _command(entry._command),
- _timer(entry._timer),
- _bucketId(entry._bucketId),
- _priority(entry._priority)
- {
- }
+ MessageEntry(const std::shared_ptr<api::StorageMessage>& cmd, const document::BucketId& bId);
+ MessageEntry(const MessageEntry &);
+ MessageEntry & operator = (const MessageEntry &) = delete;
+ ~MessageEntry();
bool operator<(const MessageEntry& entry) const {
return (_priority < entry._priority);
@@ -101,23 +91,16 @@ public:
LockEntry()
: timestamp(0), priority(0), statusString()
- {
- }
+ { }
- LockEntry(uint8_t priority_,
- vespalib::stringref status)
+ LockEntry(uint8_t priority_, vespalib::stringref status)
: timestamp(time(NULL)),
priority(priority_),
statusString(status)
- {
- }
+ { }
};
- typedef vespalib::hash_map<
- document::BucketId,
- LockEntry,
- document::BucketId::hash
- > LockedBuckets;
+ typedef vespalib::hash_map<document::BucketId, LockEntry, document::BucketId::hash> LockedBuckets;
LockedBuckets lockedBuckets;
FileStorDiskMetrics* metrics;
@@ -137,6 +120,7 @@ public:
}
Disk();
+ ~Disk();
bool isLocked(const document::BucketId&) const noexcept;
uint32_t getQueueSize() const noexcept;
@@ -146,15 +130,11 @@ public:
class BucketLock : public FileStorHandler::BucketLockInterface {
public:
- BucketLock(Disk& disk,
- const document::BucketId& id,
- uint8_t priority,
+ BucketLock(Disk& disk, const document::BucketId& id, uint8_t priority,
const vespalib::stringref & statusString);
~BucketLock();
- const document::BucketId& getBucketId() const {
- return _id;
- }
+ const document::BucketId& getBucketId() const { return _id; }
private:
Disk& _disk;
@@ -169,38 +149,26 @@ public:
uint8_t minPriorityToBeBlocking);
~FileStorHandlerImpl();
- void setGetNextMessageTimeout(uint32_t timeout)
- { _getNextMessageTimeout = timeout; }
+ void setGetNextMessageTimeout(uint32_t timeout) { _getNextMessageTimeout = timeout; }
void flush(bool killPendingMerges);
void setDiskState(uint16_t disk, DiskState state);
DiskState getDiskState(uint16_t disk) const;
void close();
- bool schedule(const std::shared_ptr<api::StorageMessage>&,
- uint16_t disk);
+ bool schedule(const std::shared_ptr<api::StorageMessage>&, uint16_t disk);
void pause(uint16_t disk, uint8_t priority) const;
+ FileStorHandler::LockedMessage getNextMessage(uint16_t disk, uint8_t lowestPriority);
- FileStorHandler::LockedMessage getNextMessage(uint16_t disk,
- uint8_t lowestPriority);
-
- FileStorHandler::LockedMessage & getNextMessage(uint16_t disk,
- FileStorHandler::LockedMessage& lock,
- uint8_t lowestPriority);
+ FileStorHandler::LockedMessage & getNextMessage(uint16_t disk, FileStorHandler::LockedMessage& lock,
+ uint8_t lowestPriority);
enum Operation { MOVE, SPLIT, JOIN };
- void remapQueue(
- const RemapInfo& source,
- RemapInfo& target,
- Operation op);
-
- void remapQueue(const RemapInfo& source,
- RemapInfo& target1,
- RemapInfo& target2,
- Operation op);
-
- void failOperations(const document::BucketId&, uint16_t fromDisk,
- const api::ReturnCode&);
+ void remapQueue(const RemapInfo& source, RemapInfo& target, Operation op);
+
+ void remapQueue(const RemapInfo& source, RemapInfo& target1, RemapInfo& target2, Operation op);
+
+ void failOperations(const document::BucketId&, uint16_t fromDisk, const api::ReturnCode&);
void sendCommand(const std::shared_ptr<api::StorageCommand>&);
void sendReply(const std::shared_ptr<api::StorageReply>&);
@@ -214,19 +182,13 @@ public:
void addMergeStatus(const document::BucketId&, MergeStatus::SP);
MergeStatus& editMergeStatus(const document::BucketId&);
-
bool isMerging(const document::BucketId&) const;
-
uint32_t getNumActiveMerges() const;
-
void clearMergeStatus(const document::BucketId&, const api::ReturnCode*);
std::string dumpQueue(uint16_t disk) const;
-
ResumeGuard pause();
-
void resume();
-
void abortQueuedOperations(const AbortBucketOperationsCommand& cmd);
private:
@@ -251,9 +213,7 @@ private:
static document::BucketId getBucketId(const api::StorageMessage&);
// Returns the index in the targets array we are sending to, or -1 if none of them match.
- int calculateTargetBasedOnDocId(
- const api::StorageMessage& msg,
- std::vector<RemapInfo*>& targets);
+ int calculateTargetBasedOnDocId(const api::StorageMessage& msg, std::vector<RemapInfo*>& targets);
/**
* If FileStor layer is explicitly paused, try to wait a single time, then
@@ -281,59 +241,38 @@ private:
* Often, operations such as streaming searches will have dedicated threads
* that refuse lower priority operations such as Puts etc.
*/
- bool operationHasHighEnoughPriorityToBeRun(
- const api::StorageMessage& msg,
- uint8_t maxPriority) const;
+ bool operationHasHighEnoughPriorityToBeRun(const api::StorageMessage& msg, uint8_t maxPriority) const;
/**
* Return whether an already running high priority operation pre-empts
* (blocks) the operation in msg from even starting in the current thread.
*/
- bool operationBlockedByHigherPriorityThread(
- const api::StorageMessage& msg,
- const Disk& disk) const;
+ bool operationBlockedByHigherPriorityThread(const api::StorageMessage& msg, const Disk& disk) const;
/**
* Return whether msg has timed out based on waitTime and the message's
* specified timeout.
*/
- bool messageTimedOutInQueue(const api::StorageMessage& msg,
- uint64_t waitTime) const;
+ bool messageTimedOutInQueue(const api::StorageMessage& msg, uint64_t waitTime) const;
/**
* Assume ownership of lock for a given bucket on a given disk.
* Disk lock MUST have been taken prior to calling this function.
*/
std::unique_ptr<FileStorHandler::BucketLockInterface>
- takeDiskBucketLockOwnership(Disk& disk,
- const document::BucketId& id,
- const api::StorageMessage& msg);
+ takeDiskBucketLockOwnership(Disk& disk, const document::BucketId& id, const api::StorageMessage& msg);
/**
* Creates and returns a reply with api::TIMEOUT return code for msg.
* Swaps (invalidates) context from msg into reply.
*/
- std::unique_ptr<api::StorageReply>
- makeQueueTimeoutReply(api::StorageMessage& msg) const;
-
- bool bucketIsLockedOnDisk(const document::BucketId&,
- const Disk&) const;
-
+ std::unique_ptr<api::StorageReply> makeQueueTimeoutReply(api::StorageMessage& msg) const;
+ bool bucketIsLockedOnDisk(const document::BucketId&, const Disk&) const;
bool messageMayBeAborted(const api::StorageMessage& msg) const;
-
bool hasBlockingOperations(const Disk& t) const;
-
- void abortQueuedCommandsForBuckets(
- Disk& disk,
- const AbortBucketOperationsCommand& cmd);
-
- bool diskHasActiveOperationForAbortedBucket(
- const Disk& disk,
- const AbortBucketOperationsCommand& cmd) const;
-
- void waitUntilNoActiveOperationsForAbortedBuckets(
- Disk& disk,
- const AbortBucketOperationsCommand& cmd);
+ void abortQueuedCommandsForBuckets(Disk& disk, const AbortBucketOperationsCommand& cmd);
+ bool diskHasActiveOperationForAbortedBucket(const Disk& disk, const AbortBucketOperationsCommand& cmd) const;
+ void waitUntilNoActiveOperationsForAbortedBuckets(Disk& disk, const AbortBucketOperationsCommand& cmd);
// Update hook
void updateMetrics(const MetricLockGuard &) override;
@@ -345,11 +284,7 @@ private:
uint16_t& targetDisk,
api::ReturnCode& returnCode);
- void remapQueueNoLock(
- Disk& from,
- const RemapInfo& source,
- std::vector<RemapInfo*>& targets,
- Operation op);
+ void remapQueueNoLock(Disk& from, const RemapInfo& source, std::vector<RemapInfo*>& targets, Operation op);
/**
* Waits until the queue has no pending operations (i.e. no locks are
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
index 12d0e4738f9..d77b62c3c6e 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
@@ -2,31 +2,21 @@
#include "filestormanager.h"
-#include <vespa/document/bucket/bucketidfactory.h>
-#include <vespa/storageapi/message/bucket.h>
#include <vespa/storageapi/message/bucketsplitting.h>
#include <vespa/storageapi/message/multioperation.h>
-#include <vespa/storageapi/message/internal.h>
#include <vespa/storageapi/message/persistence.h>
#include <vespa/storageapi/message/removelocation.h>
#include <vespa/storageapi/message/state.h>
-#include <vespa/storage/bucketdb/storbucketdb.h>
#include <vespa/storage/common/bucketmessages.h>
#include <vespa/storage/config/config-stor-server.h>
#include <vespa/storage/persistence/persistencethread.h>
-#include <vespa/storage/persistence/messages.h>
-#include <vespa/storage/storageserver/statemanager.h>
-#include <vespa/storage/storageserver/storagemetricsset.h>
#include <vespa/storage/storageutil/log.h>
#include <vespa/storage/common/messagebucketid.h>
#include <vespa/storage/persistence/bucketownershipnotifier.h>
-#include <vespa/vdslib/state/random.h>
-#include <vespa/vdslib/state/nodestate.h>
-#include <vespa/storageapi/message/stat.h>
#include <vespa/storageapi/message/batch.h>
-#include <vespa/vespalib/io/fileutil.h>
#include <vespa/storage/common/bucketoperationlogger.h>
#include <vespa/storage/bucketdb/lockablemap.hpp>
+#include <vespa/vespalib/stllike/hash_map.hpp>
LOG_SETUP(".persistence.filestor.manager");
diff --git a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.cpp b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.cpp
index 76744dc2a5b..f0e640afe27 100644
--- a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.cpp
@@ -1,9 +1,8 @@
// 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 <vespa/storage/persistence/filestorage/modifiedbucketchecker.h>
+#include "modifiedbucketchecker.h"
+#include "filestormanager.h"
#include <vespa/log/log.h>
-#include <vespa/storage/persistence/filestorage/filestormanager.h>
LOG_SETUP(".persistence.filestor.modifiedbucketchecker");
diff --git a/storage/src/vespa/storage/persistence/messages.cpp b/storage/src/vespa/storage/persistence/messages.cpp
index 8978c504a41..f84f9d38386 100644
--- a/storage/src/vespa/storage/persistence/messages.cpp
+++ b/storage/src/vespa/storage/persistence/messages.cpp
@@ -189,4 +189,4 @@ AbortBucketOperationsCommand::makeReply() {
return std::make_unique<AbortBucketOperationsReply>(*this);
}
-}
+} \ No newline at end of file
diff --git a/storage/src/vespa/storage/persistence/persistencethread.cpp b/storage/src/vespa/storage/persistence/persistencethread.cpp
index 8a6f320ac3e..a8f74af539d 100644
--- a/storage/src/vespa/storage/persistence/persistencethread.cpp
+++ b/storage/src/vespa/storage/persistence/persistencethread.cpp
@@ -1,19 +1,16 @@
// 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 <vespa/storage/persistence/persistencethread.h>
-
-#include <vespa/log/log.h>
+#include "persistencethread.h"
+#include "splitbitdetector.h"
+#include "bucketownershipnotifier.h"
+#include "testandsethelper.h"
#include <vespa/storageapi/message/multioperation.h>
#include <vespa/storage/bucketdb/storbucketdb.h>
#include <vespa/storageapi/message/bucketsplitting.h>
-#include <vespa/storage/persistence/splitbitdetector.h>
-#include <vespa/storage/persistence/bucketownershipnotifier.h>
-#include <vespa/storage/persistence/testandsethelper.h>
-#include <vespa/storage/common/nodestateupdater.h>
#include <vespa/storage/common/bucketoperationlogger.h>
#include <vespa/document/fieldset/fieldsetrepo.h>
-
+#include <vespa/vespalib/stllike/hash_map.hpp>
+#include <vespa/log/log.h>
LOG_SETUP(".persistence.thread");
namespace storage {
diff --git a/storage/src/vespa/storage/persistence/processallhandler.cpp b/storage/src/vespa/storage/persistence/processallhandler.cpp
index c4ed6031d64..23990cd2108 100644
--- a/storage/src/vespa/storage/persistence/processallhandler.cpp
+++ b/storage/src/vespa/storage/persistence/processallhandler.cpp
@@ -1,11 +1,11 @@
// 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 <vespa/log/log.h>
+#include "processallhandler.h"
+#include "bucketprocessor.h"
#include <vespa/storage/common/bucketmessages.h>
-#include <vespa/storage/persistence/processallhandler.h>
-#include <vespa/storage/persistence/bucketprocessor.h>
+#include <vespa/vespalib/stllike/hash_map.hpp>
+#include <vespa/log/log.h>
LOG_SETUP(".persistence.processall");
namespace storage {
diff --git a/storage/src/vespa/storage/persistence/types.cpp b/storage/src/vespa/storage/persistence/types.cpp
index ca8141a1ac6..beeb9d70748 100644
--- a/storage/src/vespa/storage/persistence/types.cpp
+++ b/storage/src/vespa/storage/persistence/types.cpp
@@ -1,8 +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 <iostream>
-#include <vespa/storage/persistence/types.h>
+#include "types.h"
namespace storage {
diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.cpp b/storage/src/vespa/storage/storageserver/communicationmanager.cpp
index b3ed31dcb88..e9b7013d04a 100644
--- a/storage/src/vespa/storage/storageserver/communicationmanager.cpp
+++ b/storage/src/vespa/storage/storageserver/communicationmanager.cpp
@@ -1,17 +1,11 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "communicationmanager.h"
-#include "storagemetricsset.h"
-#include "documentapiconverter.h"
#include <vespa/storageapi/message/state.h>
-#include <vespa/vespalib/util/stringfmt.h>
-#include <vespa/storageapi/message/persistence.h>
#include <vespa/messagebus/emptyreply.h>
-#include <vespa/messagebus/rpcmessagebus.h>
-#include <vespa/messagebus/sourcesessionparams.h>
#include <vespa/storage/config/config-stor-server.h>
#include <vespa/storage/common/nodestateupdater.h>
-#include <vespa/storageframework/storageframework.h>
#include <vespa/vespalib/stllike/asciistream.h>
+#include <vespa/vespalib/stllike/hash_map.hpp>
#include <vespa/log/log.h>
LOG_SETUP(".communication.manager");
diff --git a/storage/src/vespa/storage/visiting/dumpvisitor.cpp b/storage/src/vespa/storage/visiting/dumpvisitor.cpp
index 051022521e8..bbb23d295f1 100644
--- a/storage/src/vespa/storage/visiting/dumpvisitor.cpp
+++ b/storage/src/vespa/storage/visiting/dumpvisitor.cpp
@@ -4,7 +4,7 @@
#include <vespa/documentapi/messagebus/messages/multioperationmessage.h>
#include <vespa/document/update/documentupdate.h>
#include <vespa/vdslib/container/mutabledocumentlist.h>
-#include <vespa/vespalib/text/stringtokenizer.h>
+#include <vespa/vespalib/stllike/hash_map.hpp>
#include <vespa/log/log.h>
LOG_SETUP(".visitor.instance.dumpvisitor");
diff --git a/storage/src/vespa/storage/visiting/recoveryvisitor.cpp b/storage/src/vespa/storage/visiting/recoveryvisitor.cpp
index f133b2a7c0c..705b3f8d45e 100644
--- a/storage/src/vespa/storage/visiting/recoveryvisitor.cpp
+++ b/storage/src/vespa/storage/visiting/recoveryvisitor.cpp
@@ -1,13 +1,12 @@
// 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 <vespa/storage/visiting/recoveryvisitor.h>
-#include <vespa/document/fieldvalue/document.h>
-#include <vespa/log/log.h>
+#include "recoveryvisitor.h"
+
#include <vespa/documentapi/messagebus/messages/visitor.h>
-#include <vespa/vespalib/text/stringtokenizer.h>
+#include <vespa/vespalib/stllike/hash_map.hpp>
+#include <vespa/log/log.h>
LOG_SETUP(".visitor.instance.recoveryvisitor");
namespace storage {
diff --git a/storage/src/vespa/storage/visiting/visitor.cpp b/storage/src/vespa/storage/visiting/visitor.cpp
index 7214ed005e9..28694185d77 100644
--- a/storage/src/vespa/storage/visiting/visitor.cpp
+++ b/storage/src/vespa/storage/visiting/visitor.cpp
@@ -2,18 +2,14 @@
#include "visitor.h"
#include "visitormetrics.h"
-#include <vespa/log/log.h>
#include <vespa/storageapi/message/datagram.h>
-#include <vespa/storageapi/message/visitor.h>
#include <vespa/storage/persistence/messages.h>
-#include <vespa/storageframework/storageframework.h>
-#include <vespa/documentapi/messagebus/messages/documentmessage.h>
#include <vespa/documentapi/messagebus/messages/visitor.h>
#include <vespa/document/select/node.h>
-#include <sstream>
+#include <vespa/vespalib/stllike/hash_map.hpp>
+#include <vespa/vespalib/stllike/asciistream.h>
#include <unordered_map>
-#include <cmath>
-
+#include <vespa/log/log.h>
LOG_SETUP(".visitor.instance");
namespace storage {
@@ -560,7 +556,7 @@ Visitor::reportProblem(const std::string& problem)
void
Visitor::reportProblem(const api::ReturnCode& problemCode)
{
- std::ostringstream os;
+ vespalib::asciistream os;
os << "[From content node " << _ownNodeIndex << "] ";
os << api::ReturnCode::getResultString(problemCode.getResult())
<< ": " << problemCode.getMessage();
diff --git a/storage/src/vespa/storage/visiting/visitormanager.cpp b/storage/src/vespa/storage/visiting/visitormanager.cpp
index 948783c438a..33beae14c4c 100644
--- a/storage/src/vespa/storage/visiting/visitormanager.cpp
+++ b/storage/src/vespa/storage/visiting/visitormanager.cpp
@@ -1,22 +1,18 @@
// 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 <vespa/storage/visiting/visitormanager.h>
-
-#include <cstdlib>
-#include <vespa/log/log.h>
+#include "visitormanager.h"
+#include "messages.h"
+#include "dumpvisitor.h"
+#include "dumpvisitorsingle.h"
+#include "countvisitor.h"
+#include "testvisitor.h"
+#include "recoveryvisitor.h"
#include <vespa/storageapi/message/visitor.h>
#include <vespa/storage/common/statusmessages.h>
#include <vespa/storage/storageserver/storagemetricsset.h>
-#include <vespa/storage/visiting/messages.h>
-
-#include <vespa/storage/visiting/dumpvisitor.h>
-#include <vespa/storage/visiting/dumpvisitorsingle.h>
-#include <vespa/storage/visiting/countvisitor.h>
-#include <vespa/storage/visiting/testvisitor.h>
-#include <vespa/storage/visiting/recoveryvisitor.h>
#include <vespa/documentapi/loadtypes/loadtypeset.h>
+#include <vespa/log/log.h>
LOG_SETUP(".visitor.manager");
namespace storage {
diff --git a/storage/src/vespa/storage/visiting/visitormetrics.cpp b/storage/src/vespa/storage/visiting/visitormetrics.cpp
index 1ea9e7c9cd4..f36bda151e6 100644
--- a/storage/src/vespa/storage/visiting/visitormetrics.cpp
+++ b/storage/src/vespa/storage/visiting/visitormetrics.cpp
@@ -4,7 +4,6 @@
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/stllike/asciistream.h>
-
namespace storage {
VisitorMetrics::VisitorMetrics()
diff --git a/storage/src/vespa/storage/visiting/visitorthread.cpp b/storage/src/vespa/storage/visiting/visitorthread.cpp
index 9b1faf46ef7..61cdfba1a11 100644
--- a/storage/src/vespa/storage/visiting/visitorthread.cpp
+++ b/storage/src/vespa/storage/visiting/visitorthread.cpp
@@ -1,7 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "visitorthread.h"
-
+#include "messages.h"
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/document/select/bodyfielddetector.h>
#include <vespa/document/select/orderingselector.h>
@@ -9,14 +9,12 @@
#include <vespa/messagebus/rpcmessagebus.h>
#include <vespa/storage/common/statusmessages.h>
#include <vespa/storage/config/config-stor-server.h>
-#include <vespa/storage/visiting/messages.h>
#include <vespa/storageapi/message/datagram.h>
-#include <vespa/storageapi/message/visitor.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/document/base/exceptions.h>
-#include <algorithm>
#include <locale>
+#include <vespa/vespalib/stllike/hash_map.hpp>
#include <vespa/log/log.h>
LOG_SETUP(".visitor.thread");