aboutsummaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-07-01 15:07:38 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-07-01 15:07:38 +0000
commit1eb0be704f64138d543b467a4d914ff21acbef52 (patch)
tree1a274c50a86c69221e52a8954eba4ba42f173004 /storage
parent2704a5af8f7c78852e73bebdde9a46011cec8ad1 (diff)
Since there is not a well defined contract for the the sendReply interface,
I add a stricter sendReplyDirectly interface where the caller guarantees that he has no hidden requirements that the calle should be aware of. This will avoid a task switch when propagating the reply.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/bucketdb/bucketmanager.h2
-rw-r--r--storage/src/vespa/storage/common/messagesender.cpp5
-rw-r--r--storage/src/vespa/storage/common/messagesender.h2
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestorhandler.cpp6
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestorhandler.h1
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp6
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h1
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp13
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestormanager.h1
-rw-r--r--storage/src/vespa/storage/persistence/persistenceutil.cpp2
10 files changed, 36 insertions, 3 deletions
diff --git a/storage/src/vespa/storage/bucketdb/bucketmanager.h b/storage/src/vespa/storage/bucketdb/bucketmanager.h
index fe62ff27a88..9ba5f770f9d 100644
--- a/storage/src/vespa/storage/bucketdb/bucketmanager.h
+++ b/storage/src/vespa/storage/bucketdb/bucketmanager.h
@@ -40,8 +40,6 @@ public:
private:
config::ConfigUri _configUri;
-
- uint32_t _chunkLevel;
BucketInfoRequestMap _bucketInfoRequests;
/**
diff --git a/storage/src/vespa/storage/common/messagesender.cpp b/storage/src/vespa/storage/common/messagesender.cpp
index 34a892ffe04..3dfbbb67d31 100644
--- a/storage/src/vespa/storage/common/messagesender.cpp
+++ b/storage/src/vespa/storage/common/messagesender.cpp
@@ -16,4 +16,9 @@ MessageSender::send(const std::shared_ptr<api::StorageMessage>& msg)
}
}
+void
+MessageSender::sendReplyDirectly(const std::shared_ptr<api::StorageReply>& reply) {
+ sendReply(reply);
+}
+
}
diff --git a/storage/src/vespa/storage/common/messagesender.h b/storage/src/vespa/storage/common/messagesender.h
index 2f24b750d66..48020bf053e 100644
--- a/storage/src/vespa/storage/common/messagesender.h
+++ b/storage/src/vespa/storage/common/messagesender.h
@@ -31,6 +31,8 @@ struct MessageSender {
virtual void sendCommand(const std::shared_ptr<api::StorageCommand>&) = 0;
virtual void sendReply(const std::shared_ptr<api::StorageReply>&) = 0;
+ // By calling this you certify that it can continue in same thread or be dispatched.
+ virtual void sendReplyDirectly(const std::shared_ptr<api::StorageReply>&);
void send(const std::shared_ptr<api::StorageMessage>&);
};
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandler.cpp b/storage/src/vespa/storage/persistence/filestorage/filestorhandler.cpp
index 44cd8f0ab0c..d5aecaa6da0 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestorhandler.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandler.cpp
@@ -104,6 +104,12 @@ FileStorHandler::sendReply(const api::StorageReply::SP& msg)
}
void
+FileStorHandler::sendReplyDirectly(const api::StorageReply::SP& msg)
+{
+ _impl->sendReplyDirectly(msg);
+}
+
+void
FileStorHandler::getStatus(std::ostream& out, const framework::HttpUrlPath& path) const
{
_impl->getStatus(out, path);
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h b/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h
index af0a52b2fa0..973e51b04e3 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h
+++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h
@@ -239,6 +239,7 @@ public:
void sendCommand(const api::StorageCommand::SP&) override;
/** Send the given reply back out of the persistence layer. */
void sendReply(const api::StorageReply::SP&) override;
+ void sendReplyDirectly(const std::shared_ptr<api::StorageReply>&) override;
/** Writes status page. */
void getStatus(std::ostream& out, const framework::HttpUrlPath& path) const;
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
index fbdbac27b7c..f536def28a0 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
@@ -837,6 +837,12 @@ FileStorHandlerImpl::sendReply(const std::shared_ptr<api::StorageReply>& msg)
_messageSender.sendReply(msg);
}
+void
+FileStorHandlerImpl::sendReplyDirectly(const std::shared_ptr<api::StorageReply>& msg)
+{
+ _messageSender.sendReplyDirectly(msg);
+}
+
FileStorHandlerImpl::MessageEntry::MessageEntry(const std::shared_ptr<api::StorageMessage>& cmd,
const document::Bucket &bucket)
: _command(cmd),
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h
index 00714c291b7..a609473afd5 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h
+++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h
@@ -254,6 +254,7 @@ public:
}
void sendCommand(const std::shared_ptr<api::StorageCommand>&) override;
void sendReply(const std::shared_ptr<api::StorageReply>&) override;
+ void sendReplyDirectly(const api::StorageReply::SP& msg) override;
void getStatus(std::ostream& out, const framework::HttpUrlPath& path) const;
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
index 021c94464df..b2a06dc5633 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
@@ -769,6 +769,19 @@ FileStorManager::sendReply(const std::shared_ptr<api::StorageReply>& reply)
}
void
+FileStorManager::sendReplyDirectly(const std::shared_ptr<api::StorageReply>& reply)
+{
+ LOG(spam, "Sending reply %s", reply->toString().c_str());
+
+ if (reply->getType() == api::MessageType::INTERNAL_REPLY) {
+ std::shared_ptr<api::InternalReply> rep(std::dynamic_pointer_cast<api::InternalReply>(reply));
+ assert(rep.get());
+ if (onInternalReply(rep)) return;
+ }
+ sendUp(reply);
+}
+
+void
FileStorManager::sendUp(const std::shared_ptr<api::StorageMessage>& msg)
{
StorageLinkQueued::sendUp(msg);
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.h b/storage/src/vespa/storage/persistence/filestorage/filestormanager.h
index 452b83bb794..ba3d378b9e6 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.h
+++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.h
@@ -149,6 +149,7 @@ private:
void handleAbortBucketOperations(const std::shared_ptr<AbortBucketOperationsCommand>&);
void sendCommand(const std::shared_ptr<api::StorageCommand>&) override;
void sendReply(const std::shared_ptr<api::StorageReply>&) override;
+ void sendReplyDirectly(const std::shared_ptr<api::StorageReply>&) override;
void sendUp(const std::shared_ptr<api::StorageMessage>&) override;
void onClose() override;
void onFlush(bool downwards) override;
diff --git a/storage/src/vespa/storage/persistence/persistenceutil.cpp b/storage/src/vespa/storage/persistence/persistenceutil.cpp
index 72d6a1bb8d3..6605e3f6363 100644
--- a/storage/src/vespa/storage/persistence/persistenceutil.cpp
+++ b/storage/src/vespa/storage/persistence/persistenceutil.cpp
@@ -99,7 +99,7 @@ MessageTracker::sendReply() {
}
LOG(spam, "Sending reply up: %s %" PRIu64,
getReply().toString().c_str(), getReply().getMsgId());
- _replySender.sendReply(std::move(_reply));
+ _replySender.sendReplyDirectly(std::move(_reply));
} else {
if ( ! _context.getTrace().getRoot().isEmpty()) {
_msg->getTrace().getRoot().addChild(_context.getTrace().getRoot());