summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-01-09 19:03:23 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2017-01-11 10:19:17 +0000
commita1f31b81a6a40e5b1929e565d08ab66215db5556 (patch)
tree565bd66ea3cbd97106a669c000b7b46256116037 /storage
parentaf332c6f0a75974f687b1e0f9dc6e51d77e2322e (diff)
Delay taking a shared_ptr until it is really necessary.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
index bee8e7a6c49..e899d2b958e 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
@@ -8,13 +8,10 @@
#include <vespa/storageapi/message/removelocation.h>
#include <vespa/storage/bucketdb/storbucketdb.h>
#include <vespa/storage/common/bucketmessages.h>
-#include <vespa/storage/common/messagesender.h>
-#include <vespa/storage/common/nodestateupdater.h>
#include <vespa/storage/common/statusmessages.h>
#include <vespa/storage/common/bucketoperationlogger.h>
#include <vespa/storage/common/messagebucketid.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>
@@ -606,11 +603,11 @@ FileStorHandlerImpl::getNextMessage(uint16_t disk, uint8_t maxPriority)
continue;
}
- std::shared_ptr<api::StorageMessage> msg(iter->_command);
- mbus::Trace& trace(msg->getTrace());
+ api::StorageMessage & m(*iter->_command);
+ mbus::Trace& trace(m.getTrace());
- if (!operationHasHighEnoughPriorityToBeRun(*msg, maxPriority)
- || operationBlockedByHigherPriorityThread(*msg, t)
+ if (!operationHasHighEnoughPriorityToBeRun(m, maxPriority)
+ || operationBlockedByHigherPriorityThread(m, t)
|| isPaused())
{
break;
@@ -619,15 +616,13 @@ FileStorHandlerImpl::getNextMessage(uint16_t disk, uint8_t maxPriority)
const uint64_t waitTime(
const_cast<metrics::MetricTimer&>(iter->_timer).stop(
t.metrics->averageQueueWaitingTime[
- msg->getLoadType()]));
+ m.getLoadType()]));
- MBUS_TRACE(trace, 9, "FileStorHandler: Message identified by "
- "disk thread.");
- LOG(debug,
- "Message %s waited %" PRIu64 " ms in storage queue, timeout %d",
- msg->toString().c_str(), waitTime,
- static_cast<api::StorageCommand&>(*msg).getTimeout());
+ MBUS_TRACE(trace, 9, "FileStorHandler: Message identified by disk thread.");
+ LOG(debug, "Message %s waited %" PRIu64 " ms in storage queue, timeout %d",
+ m.toString().c_str(), waitTime, static_cast<api::StorageCommand&>(m).getTimeout());
+ std::shared_ptr<api::StorageMessage> msg(iter->_command);
idx.erase(iter); // iter not used after this point.
if (!messageTimedOutInQueue(*msg, waitTime)) {