summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@oath.com>2017-11-03 14:00:33 +0000
committerTor Egge <Tor.Egge@oath.com>2017-11-03 14:00:33 +0000
commitaf114174557efbecdac25a1164cc7fdb5f7e21ab (patch)
tree2aba0fa8f08cc7b6123a0e29b47de790e01fb705 /storage
parent93ff3884996746633c72749cd573533e1b94dc84 (diff)
Pass distributor bucket space to multi operation operation.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/distributor/externaloperationhandler.cpp2
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/multioperationoperation.cpp9
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/multioperationoperation.h4
3 files changed, 12 insertions, 3 deletions
diff --git a/storage/src/vespa/storage/distributor/externaloperationhandler.cpp b/storage/src/vespa/storage/distributor/externaloperationhandler.cpp
index bd42885aede..0d9135a375f 100644
--- a/storage/src/vespa/storage/distributor/externaloperationhandler.cpp
+++ b/storage/src/vespa/storage/distributor/externaloperationhandler.cpp
@@ -19,6 +19,7 @@
#include <vespa/storageapi/message/removelocation.h>
#include <vespa/storageapi/message/batch.h>
#include <vespa/storageapi/message/stat.h>
+#include "distributor_bucket_space_repo.h"
#include <vespa/log/log.h>
LOG_SETUP(".distributor.manager");
@@ -251,6 +252,7 @@ IMPL_MSG_COMMAND_H(ExternalOperationHandler, MultiOperation)
_op = Operation::SP(new MultiOperationOperation(
*this,
+ _bucketSpaceRepo.get(cmd->getBucket().getBucketSpace()),
cmd,
getMetrics().multioperations[cmd->getLoadType()]));
return true;
diff --git a/storage/src/vespa/storage/distributor/operations/external/multioperationoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/multioperationoperation.cpp
index 404cb286ecf..5d93d3e3a5a 100644
--- a/storage/src/vespa/storage/distributor/operations/external/multioperationoperation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/external/multioperationoperation.cpp
@@ -4,6 +4,7 @@
#include "putoperation.h"
#include <vespa/storageapi/message/multioperation.h>
#include <vespa/storageapi/message/persistence.h>
+#include <vespa/storage/distributor/distributor_bucket_space.h>
#include <vespa/log/log.h>
LOG_SETUP(".distributor.callback.doc.multioperation");
@@ -14,6 +15,7 @@ namespace storage::distributor {
MultiOperationOperation::MultiOperationOperation(
DistributorComponent& manager,
+ DistributorBucketSpace &bucketSpace,
const std::shared_ptr<api::MultiOperationCommand> & msg,
PersistenceOperationMetricSet& metric)
: Operation(),
@@ -22,6 +24,7 @@ MultiOperationOperation::MultiOperationOperation(
_tracker(_trackerInstance),
_msg(msg),
_manager(manager),
+ _bucketSpace(bucketSpace),
_minUseBits(manager.getDistributor().getConfig().getMinimalBucketSplit())
{
}
@@ -36,14 +39,14 @@ MultiOperationOperation::sendToBucket(
std::vector<uint16_t> targetNodes;
std::vector<MessageTracker::ToSend> createBucketBatch;
- if (PutOperation::checkCreateBucket(_manager.getDistribution(),
+ if (PutOperation::checkCreateBucket(_bucketSpace.getDistribution(),
_manager.getClusterState(),
e,
targetNodes,
createBucketBatch,
*moCommand))
{
- _manager.getBucketDatabase().update(e);
+ _bucketSpace.getBucketDatabase().update(e);
}
if (createBucketBatch.size()) {
@@ -151,7 +154,7 @@ MultiOperationOperation::onStart(DistributorMessageSender& sender)
// OK, we have a bucket ID, must now know which buckets this belongs
// to
std::vector<BucketDatabase::Entry> entries;
- _manager.getBucketDatabase().getParents(bucket.getBucketId(), entries);
+ _bucketSpace.getBucketDatabase().getParents(bucket.getBucketId(), entries);
if (entries.empty()) {
entries.push_back(_manager.createAppropriateBucket(bucket));
diff --git a/storage/src/vespa/storage/distributor/operations/external/multioperationoperation.h b/storage/src/vespa/storage/distributor/operations/external/multioperationoperation.h
index a967c7f076f..f63fbbc5458 100644
--- a/storage/src/vespa/storage/distributor/operations/external/multioperationoperation.h
+++ b/storage/src/vespa/storage/distributor/operations/external/multioperationoperation.h
@@ -17,10 +17,13 @@ namespace api {
namespace distributor {
+class DistributorBucketSpace;
+
class MultiOperationOperation : public Operation
{
public:
MultiOperationOperation(DistributorComponent& manager,
+ DistributorBucketSpace &bucketSpace,
const std::shared_ptr<api::MultiOperationCommand> & msg,
PersistenceOperationMetricSet& metric);
~MultiOperationOperation();
@@ -36,6 +39,7 @@ private:
PersistenceMessageTracker& _tracker;
std::shared_ptr<api::MultiOperationCommand> _msg;
DistributorComponent& _manager;
+ DistributorBucketSpace &_bucketSpace;
uint32_t _minUseBits;
uint32_t getMinimumUsedBits(const vdslib::DocumentList& opList) const;