summaryrefslogtreecommitdiffstats
path: root/storage/src
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-01-20 13:04:49 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-01-20 13:04:49 +0000
commit1d3fe1bedb648cfd497eeee61478fa45f332255b (patch)
tree7519f9f9d87dd9e89a788a596ca865bd5330cac5 /storage/src
parent5eaae9afb93ad82a931e117a14babdbb271762c6 (diff)
GC a load of unused code. ByteBuffer towards read only.
Diffstat (limited to 'storage/src')
-rw-r--r--storage/src/tests/common/message_sender_stub.cpp10
-rw-r--r--storage/src/tests/visiting/visitormanagertest.cpp2
-rw-r--r--storage/src/vespa/storage/common/bucketmessages.cpp22
-rw-r--r--storage/src/vespa/storage/common/storagelink.cpp4
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/statbucketoperation.cpp13
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestormanager.h3
-rw-r--r--storage/src/vespa/storage/visiting/recoveryvisitor.cpp3
-rw-r--r--storage/src/vespa/storage/visiting/recoveryvisitor.h12
-rw-r--r--storage/src/vespa/storage/visiting/visitor.cpp24
9 files changed, 35 insertions, 58 deletions
diff --git a/storage/src/tests/common/message_sender_stub.cpp b/storage/src/tests/common/message_sender_stub.cpp
index c127f9071e5..f4e64e07955 100644
--- a/storage/src/tests/common/message_sender_stub.cpp
+++ b/storage/src/tests/common/message_sender_stub.cpp
@@ -22,9 +22,7 @@ MessageSenderStub::getLastCommand(bool verbose) const
}
std::string
-MessageSenderStub::dumpMessage(const api::StorageMessage& msg,
- bool includeAddress,
- bool verbose) const
+MessageSenderStub::dumpMessage(const api::StorageMessage& msg, bool includeAddress, bool verbose) const
{
std::ostringstream ost;
@@ -38,7 +36,7 @@ MessageSenderStub::dumpMessage(const api::StorageMessage& msg,
ost << " => " << msg.getAddress()->getIndex();
}
if (verbose && msg.getType().isReply()) {
- ost << " " << dynamic_cast<const api::StorageReply&>(msg).getResult();
+ ost << " " << dynamic_cast<const api::StorageReply&>(msg).getResult().toString();
}
return ost.str();
@@ -67,9 +65,7 @@ MessageSenderStub::getLastReply(bool verbose) const
throw std::logic_error("Expected reply where there was none");
}
- return dumpMessage(*replies.back(),
- true,
- verbose);
+ return dumpMessage(*replies.back(),true, verbose);
}
diff --git a/storage/src/tests/visiting/visitormanagertest.cpp b/storage/src/tests/visiting/visitormanagertest.cpp
index 3f111bb53f7..2544fcc9a4b 100644
--- a/storage/src/tests/visiting/visitormanagertest.cpp
+++ b/storage/src/tests/visiting/visitormanagertest.cpp
@@ -653,7 +653,7 @@ TEST_F(VisitorManagerTest, visitor_cleanup) {
if (api::ReturnCode::ILLEGAL_PARAMETERS == reply->getResult().getResult()) {
failures++;
} else {
- std::cerr << reply->getResult() << "\n";
+ std::cerr << reply->getResult().toString() << "\n";
}
} else {
if (api::ReturnCode::BUSY == reply->getResult().getResult()) {
diff --git a/storage/src/vespa/storage/common/bucketmessages.cpp b/storage/src/vespa/storage/common/bucketmessages.cpp
index e92e2d4c3bf..c80b7bbb17a 100644
--- a/storage/src/vespa/storage/common/bucketmessages.cpp
+++ b/storage/src/vespa/storage/common/bucketmessages.cpp
@@ -14,7 +14,7 @@ ReadBucketList::ReadBucketList(BucketSpace bucketSpace, spi::PartitionId partiti
_partition(partition)
{ }
-ReadBucketList::~ReadBucketList() { }
+ReadBucketList::~ReadBucketList() = default;
document::Bucket
ReadBucketList::getBucket() const
@@ -38,7 +38,7 @@ ReadBucketListReply::ReadBucketListReply(const ReadBucketList& cmd)
_partition(cmd.getPartition())
{ }
-ReadBucketListReply::~ReadBucketListReply() { }
+ReadBucketListReply::~ReadBucketListReply() = default;
document::Bucket
ReadBucketListReply::getBucket() const
@@ -66,7 +66,7 @@ ReadBucketInfo::ReadBucketInfo(const document::Bucket &bucket)
_bucket(bucket)
{ }
-ReadBucketInfo::~ReadBucketInfo() { }
+ReadBucketInfo::~ReadBucketInfo() = default;
void
ReadBucketInfo::print(std::ostream& out, bool verbose, const std::string& indent) const
@@ -92,7 +92,7 @@ ReadBucketInfoReply::ReadBucketInfoReply(const ReadBucketInfo& cmd)
_bucket(cmd.getBucket())
{ }
-ReadBucketInfoReply::~ReadBucketInfoReply() { }
+ReadBucketInfoReply::~ReadBucketInfoReply() = default;
void
ReadBucketInfoReply::print(std::ostream& out, bool verbose, const std::string& indent) const {
out << "ReadBucketInfoReply()";
@@ -117,7 +117,7 @@ RepairBucketCommand::RepairBucketCommand(const document::Bucket &bucket, uint16_
setPriority(LOW);
}
-RepairBucketCommand::~RepairBucketCommand() { }
+RepairBucketCommand::~RepairBucketCommand() = default;
void
RepairBucketCommand::print(std::ostream& out, bool verbose, const std::string& indent) const {
@@ -153,7 +153,7 @@ RepairBucketReply::RepairBucketReply(const RepairBucketCommand& cmd, const api::
_altered(false)
{ }
-RepairBucketReply::~RepairBucketReply() { }
+RepairBucketReply::~RepairBucketReply() = default;
void
RepairBucketReply::print(std::ostream& out, bool verbose, const std::string& indent) const {
@@ -180,7 +180,7 @@ BucketDiskMoveCommand::BucketDiskMoveCommand(const document::Bucket &bucket,
setPriority(LOW);
}
-BucketDiskMoveCommand::~BucketDiskMoveCommand() { }
+BucketDiskMoveCommand::~BucketDiskMoveCommand() = default;
void
BucketDiskMoveCommand::setBucketId(const document::BucketId& id)
@@ -208,14 +208,14 @@ BucketDiskMoveReply::BucketDiskMoveReply(const BucketDiskMoveCommand& cmd,
_dstDisk(cmd.getDstDisk())
{ }
-BucketDiskMoveReply::~BucketDiskMoveReply() { }
+BucketDiskMoveReply::~BucketDiskMoveReply() = default;
void
BucketDiskMoveReply::print(std::ostream& out, bool, const std::string&) const
{
out << "BucketDiskMoveReply(" << _bucket.getBucketId() << ", source " << _srcDisk
<< ", target " << _dstDisk << ", " << _bucketInfo << ", "
- << getResult() << ")";
+ << getResult().toString() << ")";
}
std::unique_ptr<api::StorageReply>
@@ -236,7 +236,7 @@ InternalBucketJoinCommand::InternalBucketJoinCommand(const document::Bucket &buc
// them higher than getting more bucket info lists.
}
-InternalBucketJoinCommand::~InternalBucketJoinCommand() { }
+InternalBucketJoinCommand::~InternalBucketJoinCommand() = default;
void
InternalBucketJoinCommand::print(std::ostream& out, bool verbose, const std::string& indent) const {
@@ -255,7 +255,7 @@ InternalBucketJoinReply::InternalBucketJoinReply(const InternalBucketJoinCommand
_bucketInfo(info)
{ }
-InternalBucketJoinReply::~InternalBucketJoinReply() { }
+InternalBucketJoinReply::~InternalBucketJoinReply() = default;
void
InternalBucketJoinReply::print(std::ostream& out, bool verbose, const std::string& indent) const
diff --git a/storage/src/vespa/storage/common/storagelink.cpp b/storage/src/vespa/storage/common/storagelink.cpp
index 065f0b0b750..d9612eb48a0 100644
--- a/storage/src/vespa/storage/common/storagelink.cpp
+++ b/storage/src/vespa/storage/common/storagelink.cpp
@@ -142,7 +142,7 @@ void StorageLink::sendDown(const StorageMessage::SP& msg)
sendUp(reply);
}
} else {
- ost << " Return code: " << static_cast<StorageReply&>(*msg).getResult();
+ ost << " Return code: " << static_cast<const StorageReply&>(*msg).getResult().toString();
LOGBP(warning, "%s", ost.str().c_str());
}
} else if (!_down->onDown(msg)) {
@@ -182,7 +182,7 @@ void StorageLink::sendUp(const shared_ptr<StorageMessage> & msg)
sendDown(reply);
}
} else {
- ost << " Return code: " << static_cast<StorageReply&>(*msg).getResult();
+ ost << " Return code: " << static_cast<const StorageReply&>(*msg).getResult().toString();
LOGBP(warning, "%s", ost.str().c_str());
}
} else if (!_up->onUp(msg)) {
diff --git a/storage/src/vespa/storage/distributor/operations/external/statbucketoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/statbucketoperation.cpp
index 8e6494a588d..c19168ca6e1 100644
--- a/storage/src/vespa/storage/distributor/operations/external/statbucketoperation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/external/statbucketoperation.cpp
@@ -8,8 +8,7 @@
#include <vespa/log/log.h>
LOG_SETUP(".distributor.callback.statbucket");
-namespace storage {
-namespace distributor {
+namespace storage::distributor {
StatBucketOperation::StatBucketOperation(
[[maybe_unused]] DistributorComponent& manager,
@@ -21,7 +20,7 @@ StatBucketOperation::StatBucketOperation(
{
}
-StatBucketOperation::~StatBucketOperation() {}
+StatBucketOperation::~StatBucketOperation() = default;
void
StatBucketOperation::onClose(DistributorMessageSender& sender)
@@ -36,8 +35,7 @@ StatBucketOperation::onStart(DistributorMessageSender& sender)
{
std::vector<uint16_t> nodes;
- BucketDatabase::Entry entry(
- _bucketSpace.getBucketDatabase().get(_command->getBucketId()));
+ BucketDatabase::Entry entry(_bucketSpace.getBucketDatabase().get(_command->getBucketId()));
if (entry.valid()) {
nodes = entry->getNodes();
@@ -83,7 +81,7 @@ StatBucketOperation::onReceive(DistributorMessageSender& sender, const std::shar
if (myreply.getResult().getResult() == api::ReturnCode::OK) {
ost << "\tBucket information from node " << found->second << ":\n" << myreply.getResults() << "\n\n";
} else {
- ost << "\tBucket information retrieval failed on node " << found->second << ": " << myreply.getResult() << "\n\n";
+ ost << "\tBucket information retrieval failed on node " << found->second << ": " << myreply.getResult().toString() << "\n\n";
}
_results[found->second] = ost.str();
@@ -103,5 +101,4 @@ StatBucketOperation::onReceive(DistributorMessageSender& sender, const std::shar
}
}
-} // distributor
-} // storage
+}
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.h b/storage/src/vespa/storage/persistence/filestorage/filestormanager.h
index bfc89a70a85..65d4035a3dd 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.h
+++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.h
@@ -36,11 +36,8 @@ namespace api {
class StorageReply;
}
-class BucketMergeTest;
-class DiskInfo;
struct FileStorManagerTest;
class ReadBucketList;
-class ModifiedBucketCheckerThread;
class BucketOwnershipNotifier;
class AbortBucketOperationsCommand;
diff --git a/storage/src/vespa/storage/visiting/recoveryvisitor.cpp b/storage/src/vespa/storage/visiting/recoveryvisitor.cpp
index f9e0fa17d66..8bac2bac10a 100644
--- a/storage/src/vespa/storage/visiting/recoveryvisitor.cpp
+++ b/storage/src/vespa/storage/visiting/recoveryvisitor.cpp
@@ -36,8 +36,7 @@ RecoveryVisitor::handleDocuments(const document::BucketId& bid,
{
vespalib::LockGuard guard(_mutex);
- LOG(debug, "Visitor %s handling block of %zu documents.",
- _id.c_str(), entries.size());
+ LOG(debug, "Visitor %s handling block of %zu documents.", _id.c_str(), entries.size());
documentapi::DocumentListMessage* cmd = nullptr;
diff --git a/storage/src/vespa/storage/visiting/recoveryvisitor.h b/storage/src/vespa/storage/visiting/recoveryvisitor.h
index e68a8fdbc8c..1da2acfed9c 100644
--- a/storage/src/vespa/storage/visiting/recoveryvisitor.h
+++ b/storage/src/vespa/storage/visiting/recoveryvisitor.h
@@ -12,16 +12,13 @@
#include "visitor.h"
#include <vespa/storageapi/message/datagram.h>
-namespace documentapi {
-class DocumentListMessage;
-}
+namespace documentapi { class DocumentListMessage; }
namespace storage {
class RecoveryVisitor : public Visitor {
public:
- RecoveryVisitor(StorageComponent&,
- const vdslib::Parameters& params);
+ RecoveryVisitor(StorageComponent&, const vdslib::Parameters& params);
private:
void handleDocuments(const document::BucketId& bucketId,
@@ -43,12 +40,11 @@ struct RecoveryVisitorFactory : public VisitorFactory {
VisitorEnvironment::UP
makeVisitorEnvironment(StorageComponent&) override {
- return VisitorEnvironment::UP(new VisitorEnvironment);
+ return std::make_unique<VisitorEnvironment>();
};
Visitor*
- makeVisitor(StorageComponent& c, VisitorEnvironment&,
- const vdslib::Parameters& params) override
+ makeVisitor(StorageComponent& c, VisitorEnvironment&, const vdslib::Parameters& params) override
{
return new RecoveryVisitor(c, params);
}
diff --git a/storage/src/vespa/storage/visiting/visitor.cpp b/storage/src/vespa/storage/visiting/visitor.cpp
index 4b213dff1d5..153d75fd50e 100644
--- a/storage/src/vespa/storage/visiting/visitor.cpp
+++ b/storage/src/vespa/storage/visiting/visitor.cpp
@@ -44,17 +44,12 @@ Visitor::HitCounter::addHit(const document::DocumentId& , uint32_t size)
}
void
-Visitor::HitCounter::updateVisitorStatistics(
- vdslib::VisitorStatistics& statistics)
+Visitor::HitCounter::updateVisitorStatistics(vdslib::VisitorStatistics& statistics)
{
- statistics.setDocumentsReturned(
- statistics.getDocumentsReturned() + _firstPassHits);
- statistics.setBytesReturned(
- statistics.getBytesReturned() + _firstPassBytes);
- statistics.setSecondPassDocumentsReturned(
- statistics.getSecondPassDocumentsReturned() + _secondPassHits);
- statistics.setSecondPassBytesReturned(
- statistics.getSecondPassBytesReturned() + _secondPassBytes);
+ statistics.setDocumentsReturned(statistics.getDocumentsReturned() + _firstPassHits);
+ statistics.setBytesReturned(statistics.getBytesReturned() + _firstPassBytes);
+ statistics.setSecondPassDocumentsReturned(statistics.getSecondPassDocumentsReturned() + _secondPassHits);
+ statistics.setSecondPassBytesReturned(statistics.getSecondPassBytesReturned() + _secondPassBytes);
}
Visitor::VisitorTarget::MessageMeta::MessageMeta(
@@ -68,8 +63,7 @@ Visitor::VisitorTarget::MessageMeta::MessageMeta(
{
}
-Visitor::VisitorTarget::MessageMeta::MessageMeta(
- Visitor::VisitorTarget::MessageMeta&& rhs) noexcept
+Visitor::VisitorTarget::MessageMeta::MessageMeta(Visitor::VisitorTarget::MessageMeta&& rhs) noexcept
: messageId(rhs.messageId),
retryCount(rhs.retryCount),
memoryUsage(rhs.memoryUsage),
@@ -78,9 +72,7 @@ Visitor::VisitorTarget::MessageMeta::MessageMeta(
{
}
-Visitor::VisitorTarget::MessageMeta::~MessageMeta()
-{
-}
+Visitor::VisitorTarget::MessageMeta::~MessageMeta() = default;
Visitor::VisitorTarget::MessageMeta&
Visitor::VisitorTarget::MessageMeta::operator=(
@@ -977,7 +969,7 @@ Visitor::getStatus(std::ostream& out, bool verbose) const
<< "</td></tr>\n";
out << "<tr><td>Current status</td><td>"
- << _result << "</td></tr>\n";
+ << _result.toString() << "</td></tr>\n";
out << "<tr><td>Failed</td><td>" << (failed() ? "true" : "false")
<< "</td></tr>\n";