summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2021-06-16 12:30:25 +0200
committerGitHub <noreply@github.com>2021-06-16 12:30:25 +0200
commit43447f3db319fc41ea5ad52cb0a9352e804d87b7 (patch)
treed42dabfe34dbcfcde852c2924800cd5aa84bade4
parent9e60c04f72b733417788f0015e3fa3ba11273796 (diff)
parentc0b808b7321c519eb40a92788a9ca2c2203ffc57 (diff)
Merge pull request #18287 from vespa-engine/geirst/fix-stripe-dispatch-of-request-bucket-info-reply
Dispatch RequestBucketInfoReply for non-existing buckets to correct d…
-rw-r--r--storage/src/vespa/storage/distributor/distributor.cpp12
-rw-r--r--storageapi/src/vespa/storageapi/message/bucket.cpp9
-rw-r--r--storageapi/src/vespa/storageapi/message/bucket.h3
3 files changed, 13 insertions, 11 deletions
diff --git a/storage/src/vespa/storage/distributor/distributor.cpp b/storage/src/vespa/storage/distributor/distributor.cpp
index 4e6ae90718c..6f9cbf3b0f2 100644
--- a/storage/src/vespa/storage/distributor/distributor.cpp
+++ b/storage/src/vespa/storage/distributor/distributor.cpp
@@ -353,15 +353,7 @@ get_bucket_id_for_striping(const api::StorageMessage& msg, const DistributorNode
case api::MessageType::REMOVE_ID:
return node_ctx.bucket_id_factory().getBucketId(dynamic_cast<const api::TestAndSetCommand&>(msg).getDocumentId());
case api::MessageType::REQUESTBUCKETINFO_REPLY_ID:
- {
- const auto& reply = dynamic_cast<const api::RequestBucketInfoReply&>(msg);
- if (!reply.getBucketInfo().empty()) {
- // Note: All bucket ids in this reply belong to the same distributor stripe, so we just use the first entry.
- return reply.getBucketInfo()[0]._bucketId;
- } else {
- return reply.getBucketId();
- }
- }
+ return dynamic_cast<const api::RequestBucketInfoReply&>(msg).super_bucket_id();
case api::MessageType::GET_ID:
return node_ctx.bucket_id_factory().getBucketId(dynamic_cast<const api::GetCommand&>(msg).getDocumentId());
case api::MessageType::VISITOR_CREATE_ID:
@@ -389,7 +381,7 @@ Distributor::stripe_of_bucket_id(const document::BucketId& bucket_id, const api:
{
if (!bucket_id.isSet()) {
LOG(error, "Message (%s) has a bucket id (%s) that is not set. Cannot route to stripe",
- msg.getSummary().c_str(), bucket_id.toString().c_str());
+ msg.toString(true).c_str(), bucket_id.toString().c_str());
}
assert(bucket_id.isSet());
if (bucket_id.getUsedBits() < spi::BucketLimits::MinUsedBits) {
diff --git a/storageapi/src/vespa/storageapi/message/bucket.cpp b/storageapi/src/vespa/storageapi/message/bucket.cpp
index 2e2ca82079d..2323a1ab0a4 100644
--- a/storageapi/src/vespa/storageapi/message/bucket.cpp
+++ b/storageapi/src/vespa/storageapi/message/bucket.cpp
@@ -476,6 +476,12 @@ RequestBucketInfoCommand::getBucket() const
return document::Bucket(_bucketSpace, document::BucketId());
}
+document::BucketId
+RequestBucketInfoCommand::super_bucket_id() const
+{
+ return _buckets.empty() ? document::BucketId() : _buckets[0];
+}
+
void
RequestBucketInfoCommand::print(std::ostream& out, bool verbose,
const std::string& indent) const
@@ -510,7 +516,8 @@ std::ostream& operator<<(std::ostream& out, const RequestBucketInfoReply::Entry&
RequestBucketInfoReply::RequestBucketInfoReply(const RequestBucketInfoCommand& cmd)
: StorageReply(cmd),
_buckets(),
- _full_bucket_fetch(cmd.hasSystemState())
+ _full_bucket_fetch(cmd.hasSystemState()),
+ _super_bucket_id(cmd.super_bucket_id())
{ }
RequestBucketInfoReply::~RequestBucketInfoReply() = default;
diff --git a/storageapi/src/vespa/storageapi/message/bucket.h b/storageapi/src/vespa/storageapi/message/bucket.h
index 61766fb1f11..98445745753 100644
--- a/storageapi/src/vespa/storageapi/message/bucket.h
+++ b/storageapi/src/vespa/storageapi/message/bucket.h
@@ -358,6 +358,7 @@ public:
const vespalib::string& getDistributionHash() const { return _distributionHash; }
document::BucketSpace getBucketSpace() const { return _bucketSpace; }
document::Bucket getBucket() const override;
+ document::BucketId super_bucket_id() const;
void print(std::ostream& out, bool verbose, const std::string& indent) const override;
@@ -388,6 +389,7 @@ public:
private:
EntryVector _buckets;
bool _full_bucket_fetch;
+ document::BucketId _super_bucket_id;
public:
@@ -396,6 +398,7 @@ public:
const EntryVector & getBucketInfo() const { return _buckets; }
EntryVector & getBucketInfo() { return _buckets; }
[[nodiscard]] bool full_bucket_fetch() const noexcept { return _full_bucket_fetch; }
+ const document::BucketId& super_bucket_id() const { return _super_bucket_id; }
void print(std::ostream& out, bool verbose, const std::string& indent) const override;
DECLARE_STORAGEREPLY(RequestBucketInfoReply, onRequestBucketInfoReply)
};