diff options
author | Tor Brede Vekterli <vekterli@yahooinc.com> | 2023-06-16 11:01:40 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@yahooinc.com> | 2023-06-16 11:01:40 +0000 |
commit | 5f0a193ec1afbbc61da035424467665c3095aa71 (patch) | |
tree | 448053fb32a734ee316acf9dd335f0a369a37b97 | |
parent | c483f99e61db99228262b72734a0417058dea208 (diff) |
GC some unused internal storage message types
Remnants of the "file per bucket on spinning disks" days and no
longer used for anything.
14 files changed, 2 insertions, 289 deletions
diff --git a/storage/src/tests/common/dummystoragelink.h b/storage/src/tests/common/dummystoragelink.h index 8da92917c08..8e68f2e5a70 100644 --- a/storage/src/tests/common/dummystoragelink.h +++ b/storage/src/tests/common/dummystoragelink.h @@ -8,7 +8,6 @@ #include <string> #include <vector> #include <vespa/storage/common/storagelink.h> -#include <vespa/storage/common/bucketmessages.h> #include <vespa/storageapi/message/internal.h> namespace storage { diff --git a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp index bbe2af732f5..f39222722fc 100644 --- a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp +++ b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp @@ -1713,21 +1713,6 @@ TEST_F(FileStorManagerTest, set_bucket_active_state) { StorBucketDatabase::WrappedEntry entry(_node->getStorageBucketDatabase().get(bid, "foo")); EXPECT_TRUE(entry->info.isActive()); } - // Trigger bucket info to be read back into the database - { - auto cmd = std::make_shared<ReadBucketInfo>(makeDocumentBucket(bid)); - top.sendDown(cmd); - top.waitForMessages(1, _waitTime); - ASSERT_EQ(1, top.getNumReplies()); - auto reply = std::dynamic_pointer_cast<ReadBucketInfoReply>(top.getReply(0)); - top.reset(); - ASSERT_TRUE(reply.get()); - } - // Should not have lost active flag - { - StorBucketDatabase::WrappedEntry entry(_node->getStorageBucketDatabase().get(bid, "foo")); - EXPECT_TRUE(entry->info.isActive()); - } { auto cmd = std::make_shared<api::SetBucketStateCommand>( diff --git a/storage/src/vespa/storage/bucketdb/bucketmanager.h b/storage/src/vespa/storage/bucketdb/bucketmanager.h index ce60ec88bff..cb0bc6a9f95 100644 --- a/storage/src/vespa/storage/bucketdb/bucketmanager.h +++ b/storage/src/vespa/storage/bucketdb/bucketmanager.h @@ -11,7 +11,6 @@ #include "storbucketdb.h" #include <vespa/config/subscription/configuri.h> #include <vespa/storage/bucketdb/config-stor-bucketdb.h> -#include <vespa/storage/common/bucketmessages.h> #include <vespa/storage/common/servicelayercomponent.h> #include <vespa/storage/common/storagelinkqueued.h> #include <vespa/storageapi/message/bucket.h> diff --git a/storage/src/vespa/storage/common/CMakeLists.txt b/storage/src/vespa/storage/common/CMakeLists.txt index 4a712719d53..6165106f871 100644 --- a/storage/src/vespa/storage/common/CMakeLists.txt +++ b/storage/src/vespa/storage/common/CMakeLists.txt @@ -2,7 +2,6 @@ vespa_add_library(storage_common OBJECT SOURCES bucket_stripe_utils.cpp - bucketmessages.cpp content_bucket_space.cpp content_bucket_space_repo.cpp distributorcomponent.cpp diff --git a/storage/src/vespa/storage/common/bucketmessages.cpp b/storage/src/vespa/storage/common/bucketmessages.cpp deleted file mode 100644 index 1523ad1b0ef..00000000000 --- a/storage/src/vespa/storage/common/bucketmessages.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include "bucketmessages.h" -#include <vespa/vespalib/stllike/asciistream.h> -#include <ostream> - -using document::BucketSpace; - -namespace storage { - -ReadBucketList::ReadBucketList(BucketSpace bucketSpace) - : api::InternalCommand(ID), - _bucketSpace(bucketSpace) -{ } - -ReadBucketList::~ReadBucketList() = default; - -document::Bucket -ReadBucketList::getBucket() const -{ - return document::Bucket(_bucketSpace, document::BucketId()); -} - -void -ReadBucketList::print(std::ostream& out, bool verbose, const std::string& indent) const { - out << "ReadBucketList()"; - - if (verbose) { - out << " : "; - InternalCommand::print(out, true, indent); - } -} - -ReadBucketListReply::ReadBucketListReply(const ReadBucketList& cmd) - : api::InternalReply(ID, cmd), - _bucketSpace(cmd.getBucketSpace()) -{ } - -ReadBucketListReply::~ReadBucketListReply() = default; - -document::Bucket -ReadBucketListReply::getBucket() const -{ - return document::Bucket(_bucketSpace, document::BucketId()); -} - -void -ReadBucketListReply::print(std::ostream& out, bool verbose, const std::string& indent) const -{ - out << "ReadBucketListReply(" << _buckets.size() << " buckets)"; - if (verbose) { - out << " : "; - InternalReply::print(out, true, indent); - } -} - -std::unique_ptr<api::StorageReply> -ReadBucketList::makeReply() { - return std::make_unique<ReadBucketListReply>(*this); -} - -ReadBucketInfo::ReadBucketInfo(const document::Bucket &bucket) - : api::InternalCommand(ID), - _bucket(bucket) -{ } - -ReadBucketInfo::~ReadBucketInfo() = default; - -void -ReadBucketInfo::print(std::ostream& out, bool verbose, const std::string& indent) const -{ - out << "ReadBucketInfo(" << _bucket.getBucketId() << ")"; - - if (verbose) { - out << " : "; - InternalCommand::print(out, true, indent); - } -} - -vespalib::string -ReadBucketInfo::getSummary() const { - vespalib::string s("ReadBucketInfo("); - s.append(_bucket.toString()); - s.append(')'); - return s; -} - -ReadBucketInfoReply::ReadBucketInfoReply(const ReadBucketInfo& cmd) - : api::InternalReply(ID, cmd), - _bucket(cmd.getBucket()) -{ } - -ReadBucketInfoReply::~ReadBucketInfoReply() = default; -void -ReadBucketInfoReply::print(std::ostream& out, bool verbose, const std::string& indent) const { - out << "ReadBucketInfoReply()"; - if (verbose) { - out << " : "; - InternalReply::print(out, true, indent); - } -} - -std::unique_ptr<api::StorageReply> ReadBucketInfo::makeReply() { - return std::make_unique<ReadBucketInfoReply>(*this); -} - -} // storage - diff --git a/storage/src/vespa/storage/common/bucketmessages.h b/storage/src/vespa/storage/common/bucketmessages.h deleted file mode 100644 index ccee12938b2..00000000000 --- a/storage/src/vespa/storage/common/bucketmessages.h +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#pragma once - -#include <vespa/persistence/spi/result.h> -#include <vespa/storageapi/message/internal.h> -#include <vespa/storageapi/buckets/bucketinfo.h> - -namespace storage { - -/** - * @class ReadBucketList - * @ingroup common - * - * @brief List buckets existing in a bucket space. - */ -class ReadBucketList : public api::InternalCommand { - document::BucketSpace _bucketSpace; - -public: - using UP = std::unique_ptr<ReadBucketList>; - static constexpr uint32_t ID = 2003; - - ReadBucketList(document::BucketSpace bucketSpace); - ~ReadBucketList(); - document::BucketSpace getBucketSpace() const { return _bucketSpace; } - document::Bucket getBucket() const override; - - std::unique_ptr<api::StorageReply> makeReply() override; - - void print(std::ostream& out, bool verbose, const std::string& indent) const override; -}; - - -/** - * @class ReadBucketListReply - * @ingroup common - */ -class ReadBucketListReply : public api::InternalReply { - document::BucketSpace _bucketSpace; - spi::BucketIdListResult::List _buckets; - -public: - using UP = std::unique_ptr<ReadBucketListReply>; - using SP = std::shared_ptr<ReadBucketListReply>; - static constexpr uint32_t ID = 2004; - - ReadBucketListReply(const ReadBucketList& cmd); - ~ReadBucketListReply(); - - document::BucketSpace getBucketSpace() const { return _bucketSpace; } - document::Bucket getBucket() const override; - - spi::BucketIdListResult::List& getBuckets() { return _buckets; } - const spi::BucketIdListResult::List& getBuckets() const { - return _buckets; - } - - void print(std::ostream& out, bool verbose, const std::string& indent) const override; -}; - -/** - * @class ReadBucketInfo - * @ingroup common - * - * @brief Get more detailed information about a set of buckets. - * - * The distributor wants some information for each bucket, that one - * have to open the bucket and read its headers to find. This class is - * used to retrieve such information. - */ -class ReadBucketInfo : public api::InternalCommand { - document::Bucket _bucket; - -public: - static constexpr uint32_t ID = 2005; - - ReadBucketInfo(const document::Bucket &bucket); - ~ReadBucketInfo(); - - document::Bucket getBucket() const override { return _bucket; } - - std::unique_ptr<api::StorageReply> makeReply() override; - - void print(std::ostream& out, bool verbose, const std::string& indent) const override; -private: - vespalib::string getSummary() const override; -}; - - -/** - * @class ReadBucketInfoReply - * @ingroup common - */ -class ReadBucketInfoReply : public api::InternalReply { - document::Bucket _bucket; - -public: - static constexpr uint32_t ID = 2006; - - ReadBucketInfoReply(const ReadBucketInfo& cmd); - ~ReadBucketInfoReply(); - - document::Bucket getBucket() const override { return _bucket; } - - void print(std::ostream& out, bool verbose, const std::string& indent) const override; -}; - -} // storage diff --git a/storage/src/vespa/storage/common/messagebucket.cpp b/storage/src/vespa/storage/common/messagebucket.cpp index 73b83936e98..286eef39e16 100644 --- a/storage/src/vespa/storage/common/messagebucket.cpp +++ b/storage/src/vespa/storage/common/messagebucket.cpp @@ -2,7 +2,6 @@ #include "messagebucket.h" #include "statusmessages.h" -#include "bucketmessages.h" #include <vespa/storageapi/message/bucket.h> #include <vespa/storageapi/message/bucketsplitting.h> #include <vespa/storageapi/message/persistence.h> @@ -60,10 +59,6 @@ getStorageMessageBucket(const api::StorageMessage& msg) return static_cast<const GetIterCommand&>(msg).getBucket(); case CreateIteratorCommand::ID: return static_cast<const CreateIteratorCommand&>(msg).getBucket(); - case ReadBucketList::ID: - return static_cast<const ReadBucketList&>(msg).getBucket(); - case ReadBucketInfo::ID: - return static_cast<const ReadBucketInfo&>(msg).getBucket(); case RecheckBucketInfoCommand::ID: return static_cast<const RecheckBucketInfoCommand&>(msg).getBucket(); case RunTaskCommand::ID: diff --git a/storage/src/vespa/storage/common/storagelink.cpp b/storage/src/vespa/storage/common/storagelink.cpp index 85ec26fda2f..2d566f1fc29 100644 --- a/storage/src/vespa/storage/common/storagelink.cpp +++ b/storage/src/vespa/storage/common/storagelink.cpp @@ -1,7 +1,8 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "storagelink.h" -#include "bucketmessages.h" +#include <vespa/storageapi/messageapi/storagecommand.h> +#include <vespa/storageapi/messageapi/storagereply.h> #include <vespa/vespalib/util/backtrace.h> #include <sstream> #include <cassert> diff --git a/storage/src/vespa/storage/distributor/idealstatemanager.cpp b/storage/src/vespa/storage/distributor/idealstatemanager.cpp index 2c33bc490fe..cad141e76ed 100644 --- a/storage/src/vespa/storage/distributor/idealstatemanager.cpp +++ b/storage/src/vespa/storage/distributor/idealstatemanager.cpp @@ -8,7 +8,6 @@ #include "distributor_bucket_space.h" #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/storageapi/message/persistence.h> -#include <vespa/storage/common/bucketmessages.h> #include <vespa/document/bucket/fixed_bucket_spaces.h> #include <vespa/vespalib/util/assert.h> #include <vespa/vespalib/stllike/hash_map.hpp> diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp index 1d29a8795d5..33022c65e24 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp @@ -6,7 +6,6 @@ #include <vespa/storageapi/message/bucketsplitting.h> #include <vespa/storageapi/message/persistence.h> #include <vespa/storage/bucketdb/storbucketdb.h> -#include <vespa/storage/common/bucketmessages.h> #include <vespa/storage/common/statusmessages.h> #include <vespa/storage/common/messagebucket.h> #include <vespa/storage/persistence/asynchandler.h> @@ -666,7 +665,6 @@ FileStorHandlerImpl::remapMessage(api::StorageMessage& msg, const document::Buck } } break; - case ReadBucketInfo::ID: case RecheckBucketInfoCommand::ID: { LOG(debug, "While remapping load for bucket %s for reason %u, " diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp index da9d16c9356..d2c3cea44b0 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp @@ -4,7 +4,6 @@ #include "filestorhandlerimpl.h" #include <vespa/storageframework/generic/thread/thread.h> #include <vespa/storage/bucketdb/minimumusedbitstracker.h> -#include <vespa/storage/common/bucketmessages.h> #include <vespa/storage/common/content_bucket_space_repo.h> #include <vespa/storage/common/doneinitializehandler.h> #include <vespa/storage/common/hostreporter/hostinfo.h> @@ -755,21 +754,6 @@ FileStorManager::onInternal(const shared_ptr<api::InternalCommand>& msg) msg->getTrace().addChild(context.steal_trace()); return true; } - case ReadBucketList::ID: - { - shared_ptr<ReadBucketList> cmd(std::static_pointer_cast<ReadBucketList>(msg)); - handlePersistenceMessage(cmd); - return true; - } - case ReadBucketInfo::ID: - { - shared_ptr<ReadBucketInfo> cmd(std::static_pointer_cast<ReadBucketInfo>(msg)); - StorBucketDatabase::WrappedEntry entry(mapOperationToDisk(*cmd, cmd->getBucket())); - if (entry.exists()) { - handlePersistenceMessage(cmd); - } - return true; - } case RecheckBucketInfoCommand::ID: { shared_ptr<RecheckBucketInfoCommand> cmd(std::static_pointer_cast<RecheckBucketInfoCommand>(msg)); diff --git a/storage/src/vespa/storage/persistence/persistencehandler.cpp b/storage/src/vespa/storage/persistence/persistencehandler.cpp index 69f910d0910..00ab61f2304 100644 --- a/storage/src/vespa/storage/persistence/persistencehandler.cpp +++ b/storage/src/vespa/storage/persistence/persistencehandler.cpp @@ -100,10 +100,6 @@ PersistenceHandler::handleCommandSplitByType(api::StorageCommand& msg, MessageTr auto usage = vespalib::CpuUsage::use(CpuUsage::Category::READ); return _simpleHandler.handleCreateIterator(static_cast<CreateIteratorCommand&>(msg), std::move(tracker)); } - case ReadBucketList::ID: - return _simpleHandler.handleReadBucketList(static_cast<ReadBucketList&>(msg), std::move(tracker)); - case ReadBucketInfo::ID: - return _simpleHandler.handleReadBucketInfo(static_cast<ReadBucketInfo&>(msg), std::move(tracker)); case RecheckBucketInfoCommand::ID: return _splitJoinHandler.handleRecheckBucketInfo(static_cast<RecheckBucketInfoCommand&>(msg), std::move(tracker)); case RunTaskCommand::ID: diff --git a/storage/src/vespa/storage/persistence/simplemessagehandler.cpp b/storage/src/vespa/storage/persistence/simplemessagehandler.cpp index ea929bf8620..1ac0939c21e 100644 --- a/storage/src/vespa/storage/persistence/simplemessagehandler.cpp +++ b/storage/src/vespa/storage/persistence/simplemessagehandler.cpp @@ -131,29 +131,6 @@ SimpleMessageHandler::handleGetIter(GetIterCommand& cmd, MessageTracker::UP trac } MessageTracker::UP -SimpleMessageHandler::handleReadBucketList(ReadBucketList& cmd, MessageTracker::UP tracker) const -{ - tracker->setMetric(_env._metrics.readBucketList); - - spi::BucketIdListResult result(_spi.listBuckets(cmd.getBucketSpace())); - if (tracker->checkForError(result)) { - auto reply = std::make_shared<ReadBucketListReply>(cmd); - result.getList().swap(reply->getBuckets()); - tracker->setReply(reply); - } - - return tracker; -} - -MessageTracker::UP -SimpleMessageHandler::handleReadBucketInfo(ReadBucketInfo& cmd, MessageTracker::UP tracker) const -{ - tracker->setMetric(_env._metrics.readBucketInfo); - _env.updateBucketDatabase(cmd.getBucket(), _env.getBucketInfo(cmd.getBucket())); - return tracker; -} - -MessageTracker::UP SimpleMessageHandler::handleCreateIterator(CreateIteratorCommand& cmd, MessageTracker::UP tracker) const { tracker->setMetric(_env._metrics.createIterator); diff --git a/storage/src/vespa/storage/persistence/simplemessagehandler.h b/storage/src/vespa/storage/persistence/simplemessagehandler.h index a5a19772556..49432c1ccb7 100644 --- a/storage/src/vespa/storage/persistence/simplemessagehandler.h +++ b/storage/src/vespa/storage/persistence/simplemessagehandler.h @@ -4,7 +4,6 @@ #include "types.h" #include "messages.h" -#include <vespa/storage/common/bucketmessages.h> #include <vespa/storageapi/message/persistence.h> namespace document { class BucketIdFactory; } @@ -28,8 +27,6 @@ public: MessageTrackerUP handleRevert(api::RevertCommand& cmd, MessageTrackerUP tracker) const; MessageTrackerUP handleCreateIterator(CreateIteratorCommand& cmd, MessageTrackerUP tracker) const; MessageTrackerUP handleGetIter(GetIterCommand& cmd, MessageTrackerUP tracker) const; - MessageTrackerUP handleReadBucketList(ReadBucketList& cmd, MessageTrackerUP tracker) const; - MessageTrackerUP handleReadBucketInfo(ReadBucketInfo& cmd, MessageTrackerUP tracker) const; private: MessageTrackerUP handle_conditional_get(api::GetCommand& cmd, MessageTrackerUP tracker) const; |