diff options
author | Tor Brede Vekterli <vekterli@yahooinc.com> | 2023-09-08 14:27:02 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@yahooinc.com> | 2023-09-08 14:27:02 +0000 |
commit | 3118b1c594edcd7b7755fb3c82d206c449e1dbf8 (patch) | |
tree | d0c796e4fce45954dea25413172da08c93c15261 /storage/src/vespa/storageapi | |
parent | 2d83bc79d0bc51a9236fb2c85910bafcc7427706 (diff) |
Remove remaining deprecated "revert" functionality from code base
Serialization code can safely be removed, as no revert-related
messages have ever flown across the wire in the new serialization
format.
Diffstat (limited to 'storage/src/vespa/storageapi')
10 files changed, 5 insertions, 150 deletions
diff --git a/storage/src/vespa/storageapi/mbusprot/protocolserialization.cpp b/storage/src/vespa/storageapi/mbusprot/protocolserialization.cpp index 59ea60e6e0d..1f24d7a03ef 100644 --- a/storage/src/vespa/storageapi/mbusprot/protocolserialization.cpp +++ b/storage/src/vespa/storageapi/mbusprot/protocolserialization.cpp @@ -49,12 +49,6 @@ ProtocolSerialization::encode(const api::StorageMessage& msg) const case api::MessageType::REMOVE_REPLY_ID: onEncode(buf, static_cast<const api::RemoveReply&>(msg)); break; - case api::MessageType::REVERT_ID: - onEncode(buf, static_cast<const api::RevertCommand&>(msg)); - break; - case api::MessageType::REVERT_REPLY_ID: - onEncode(buf, static_cast<const api::RevertReply&>(msg)); - break; case api::MessageType::DELETEBUCKET_ID: onEncode(buf, static_cast<const api::DeleteBucketCommand&>(msg)); break; @@ -140,9 +134,8 @@ ProtocolSerialization::encode(const api::StorageMessage& msg) const onEncode(buf, static_cast<const api::SetBucketStateReply&>(msg)); break; default: - LOG(error, "Trying to encode unhandled type %s", - msg.getType().toString().c_str()); - break; + LOG(error, "Trying to encode unhandled type %s", msg.getType().toString().c_str()); + abort(); } mbus::Blob retVal(buf.position()); @@ -174,8 +167,6 @@ ProtocolSerialization::decodeCommand(mbus::BlobRef data) const cmd = onDecodeGetCommand(buf); break; case api::MessageType::REMOVE_ID: cmd = onDecodeRemoveCommand(buf); break; - case api::MessageType::REVERT_ID: - cmd = onDecodeRevertCommand(buf); break; case api::MessageType::CREATEBUCKET_ID: cmd = onDecodeCreateBucketCommand(buf); break; case api::MessageType::DELETEBUCKET_ID: @@ -238,8 +229,6 @@ ProtocolSerialization::decodeReply(mbus::BlobRef data, const api::StorageCommand reply = onDecodeGetReply(cmd, buf); break; case api::MessageType::REMOVE_REPLY_ID: reply = onDecodeRemoveReply(cmd, buf); break; - case api::MessageType::REVERT_REPLY_ID: - reply = onDecodeRevertReply(cmd, buf); break; case api::MessageType::CREATEBUCKET_REPLY_ID: reply = onDecodeCreateBucketReply(cmd, buf); break; case api::MessageType::DELETEBUCKET_REPLY_ID: diff --git a/storage/src/vespa/storageapi/mbusprot/protocolserialization.h b/storage/src/vespa/storageapi/mbusprot/protocolserialization.h index 0daf04c75c6..6ed46e1f770 100644 --- a/storage/src/vespa/storageapi/mbusprot/protocolserialization.h +++ b/storage/src/vespa/storageapi/mbusprot/protocolserialization.h @@ -25,8 +25,6 @@ class GetCommand; class GetReply; class RemoveCommand; class RemoveReply; -class RevertCommand; -class RevertReply; class DeleteBucketCommand; class DeleteBucketReply; class CreateBucketCommand; @@ -85,8 +83,6 @@ protected: virtual void onEncode(GBBuf&, const api::GetReply&) const = 0; virtual void onEncode(GBBuf&, const api::RemoveCommand&) const = 0; virtual void onEncode(GBBuf&, const api::RemoveReply&) const = 0; - virtual void onEncode(GBBuf&, const api::RevertCommand&) const = 0; - virtual void onEncode(GBBuf&, const api::RevertReply&) const = 0; virtual void onEncode(GBBuf&, const api::DeleteBucketCommand&) const = 0; virtual void onEncode(GBBuf&, const api::DeleteBucketReply&) const = 0; virtual void onEncode(GBBuf&, const api::CreateBucketCommand&) const = 0; @@ -124,8 +120,6 @@ protected: virtual SRep::UP onDecodeGetReply(const SCmd&, BBuf&) const = 0; virtual SCmd::UP onDecodeRemoveCommand(BBuf&) const = 0; virtual SRep::UP onDecodeRemoveReply(const SCmd&, BBuf&) const = 0; - virtual SCmd::UP onDecodeRevertCommand(BBuf&) const = 0; - virtual SRep::UP onDecodeRevertReply(const SCmd&, BBuf&) const = 0; virtual SCmd::UP onDecodeDeleteBucketCommand(BBuf&) const = 0; virtual SRep::UP onDecodeDeleteBucketReply(const SCmd&, BBuf&) const = 0; virtual SCmd::UP onDecodeCreateBucketCommand(BBuf&) const = 0; diff --git a/storage/src/vespa/storageapi/mbusprot/protocolserialization7.cpp b/storage/src/vespa/storageapi/mbusprot/protocolserialization7.cpp index 3f1ab1e5fe1..9ccb4c2ffc6 100644 --- a/storage/src/vespa/storageapi/mbusprot/protocolserialization7.cpp +++ b/storage/src/vespa/storageapi/mbusprot/protocolserialization7.cpp @@ -624,42 +624,6 @@ api::StorageReply::UP ProtocolSerialization7::onDecodeGetReply(const SCmd& cmd, } // ----------------------------------------------------------------- -// Revert -// ----------------------------------------------------------------- - -void ProtocolSerialization7::onEncode(GBBuf& buf, const api::RevertCommand& msg) const { - encode_bucket_request<protobuf::RevertRequest>(buf, msg, [&](auto& req) { - auto* tokens = req.mutable_revert_tokens(); - assert(msg.getRevertTokens().size() <= INT_MAX); - tokens->Reserve(static_cast<int>(msg.getRevertTokens().size())); - for (auto token : msg.getRevertTokens()) { - tokens->Add(token); - } - }); -} - -void ProtocolSerialization7::onEncode(GBBuf& buf, const api::RevertReply& msg) const { - encode_bucket_info_response<protobuf::RevertResponse>(buf, msg, no_op_encode); -} - -api::StorageCommand::UP ProtocolSerialization7::onDecodeRevertCommand(BBuf& buf) const { - return decode_bucket_request<protobuf::RevertRequest>(buf, [&](auto& req, auto& bucket) { - std::vector<api::Timestamp> tokens; - tokens.reserve(req.revert_tokens_size()); - for (auto token : req.revert_tokens()) { - tokens.emplace_back(api::Timestamp(token)); - } - return std::make_unique<api::RevertCommand>(bucket, std::move(tokens)); - }); -} - -api::StorageReply::UP ProtocolSerialization7::onDecodeRevertReply(const SCmd& cmd, BBuf& buf) const { - return decode_bucket_info_response<protobuf::RevertResponse>(buf, [&]([[maybe_unused]] auto& res) { - return std::make_unique<api::RevertReply>(static_cast<const api::RevertCommand&>(cmd)); - }); -} - -// ----------------------------------------------------------------- // RemoveLocation // ----------------------------------------------------------------- diff --git a/storage/src/vespa/storageapi/mbusprot/protocolserialization7.h b/storage/src/vespa/storageapi/mbusprot/protocolserialization7.h index a61397c85ac..a11d589af60 100644 --- a/storage/src/vespa/storageapi/mbusprot/protocolserialization7.h +++ b/storage/src/vespa/storageapi/mbusprot/protocolserialization7.h @@ -41,12 +41,6 @@ public: SCmd::UP onDecodeGetCommand(BBuf&) const override; SRep::UP onDecodeGetReply(const SCmd&, BBuf&) const override; - // Revert - TODO this is deprecated, no? - void onEncode(GBBuf&, const api::RevertCommand&) const override; - void onEncode(GBBuf&, const api::RevertReply&) const override; - SCmd::UP onDecodeRevertCommand(BBuf&) const override; - SRep::UP onDecodeRevertReply(const SCmd&, BBuf&) const override; - // DeleteBucket void onEncode(GBBuf&, const api::DeleteBucketCommand&) const override; void onEncode(GBBuf&, const api::DeleteBucketReply&) const override; diff --git a/storage/src/vespa/storageapi/mbusprot/storagemessage.h b/storage/src/vespa/storageapi/mbusprot/storagemessage.h index 4a7a18ce355..f338d1900fb 100644 --- a/storage/src/vespa/storageapi/mbusprot/storagemessage.h +++ b/storage/src/vespa/storageapi/mbusprot/storagemessage.h @@ -9,7 +9,7 @@ class StorageMessage { public: using UP = std::unique_ptr<StorageMessage>; - virtual ~StorageMessage() {} + virtual ~StorageMessage() = default; virtual api::StorageMessage::SP getInternalMessage() = 0; virtual api::StorageMessage::CSP getInternalMessage() const = 0; diff --git a/storage/src/vespa/storageapi/message/persistence.cpp b/storage/src/vespa/storageapi/message/persistence.cpp index a8fa9a0bba1..2fafb998991 100644 --- a/storage/src/vespa/storageapi/message/persistence.cpp +++ b/storage/src/vespa/storageapi/message/persistence.cpp @@ -17,8 +17,6 @@ IMPLEMENT_COMMAND(GetCommand, GetReply) IMPLEMENT_REPLY(GetReply) IMPLEMENT_COMMAND(RemoveCommand, RemoveReply) IMPLEMENT_REPLY(RemoveReply) -IMPLEMENT_COMMAND(RevertCommand, RevertReply) -IMPLEMENT_REPLY(RevertReply) TestAndSetCommand::TestAndSetCommand(const MessageType & messageType, const document::Bucket &bucket) : BucketInfoCommand(messageType, bucket) @@ -309,47 +307,4 @@ RemoveReply::print(std::ostream& out, bool verbose, const std::string& indent) c } } -RevertCommand::RevertCommand(const document::Bucket &bucket, const std::vector<Timestamp>& revertTokens) - : BucketInfoCommand(MessageType::REVERT, bucket), - _tokens(revertTokens) -{ -} - -RevertCommand::~RevertCommand() = default; - -void -RevertCommand::print(std::ostream& out, bool verbose, const std::string& indent) const -{ - out << "Revert(" << getBucketId(); - if (verbose) { - out << ","; - for (Timestamp token : _tokens) { - out << "\n" << indent << " " << token; - } - } - out << ")"; - if (verbose) { - out << " : "; - BucketInfoCommand::print(out, verbose, indent); - } -} - -RevertReply::RevertReply(const RevertCommand& cmd) - : BucketInfoReply(cmd), - _tokens(cmd.getRevertTokens()) -{ -} - -RevertReply::~RevertReply() = default; - -void -RevertReply::print(std::ostream& out, bool verbose, const std::string& indent) const -{ - out << "RevertReply(" << getBucketId() << ")"; - if (verbose) { - out << " : "; - BucketInfoReply::print(out, verbose, indent); - } -} - } diff --git a/storage/src/vespa/storageapi/message/persistence.h b/storage/src/vespa/storageapi/message/persistence.h index 0607f3792f3..40749e2a02f 100644 --- a/storage/src/vespa/storageapi/message/persistence.h +++ b/storage/src/vespa/storageapi/message/persistence.h @@ -308,37 +308,4 @@ public: DECLARE_STORAGEREPLY(RemoveReply, onRemoveReply) }; -/** - * @class RevertCommand - * @ingroup message - * - * @brief Command for reverting a write or remove operation. - */ -class RevertCommand : public BucketInfoCommand { - std::vector<Timestamp> _tokens; -public: - RevertCommand(const document::Bucket &bucket, - const std::vector<Timestamp>& revertTokens); - ~RevertCommand() override; - const std::vector<Timestamp>& getRevertTokens() const { return _tokens; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGECOMMAND(RevertCommand, onRevert) -}; - -/** - * @class RevertReply - * @ingroup message - * - * @brief Reply for a revert command. - */ -class RevertReply : public BucketInfoReply { - std::vector<Timestamp> _tokens; -public: - explicit RevertReply(const RevertCommand& cmd); - ~RevertReply() override; - const std::vector<Timestamp>& getRevertTokens() const { return _tokens; } - void print(std::ostream& out, bool verbose, const std::string& indent) const override; - DECLARE_STORAGEREPLY(RevertReply, onRevertReply) -}; - } diff --git a/storage/src/vespa/storageapi/messageapi/messagehandler.h b/storage/src/vespa/storageapi/messageapi/messagehandler.h index fa362d5380f..fba0c58ecf9 100644 --- a/storage/src/vespa/storageapi/messageapi/messagehandler.h +++ b/storage/src/vespa/storageapi/messageapi/messagehandler.h @@ -23,7 +23,6 @@ class GetCommand; // Retrieve document class PutCommand; // Add document class UpdateCommand; // Update document class RemoveCommand; // Remove document -class RevertCommand; // Revert put/remove operation class CreateVisitorCommand; // Create a new visitor class DestroyVisitorCommand; // Destroy a running visitor @@ -59,7 +58,6 @@ class GetReply; class PutReply; class UpdateReply; class RemoveReply; -class RevertReply; class CreateVisitorReply; class DestroyVisitorReply; @@ -122,8 +120,6 @@ public: virtual bool onUpdateReply(const std::shared_ptr<api::UpdateReply>&) { return false; } virtual bool onRemove(const std::shared_ptr<api::RemoveCommand>&) { return false; } virtual bool onRemoveReply(const std::shared_ptr<api::RemoveReply>&) { return false; } - virtual bool onRevert(const std::shared_ptr<api::RevertCommand>&) { return false; } - virtual bool onRevertReply(const std::shared_ptr<api::RevertReply>&) { return false; } virtual bool onCreateVisitor(const std::shared_ptr<api::CreateVisitorCommand>&) { return false; } virtual bool onCreateVisitorReply(const std::shared_ptr<api::CreateVisitorReply>&) { return false; } diff --git a/storage/src/vespa/storageapi/messageapi/storagemessage.cpp b/storage/src/vespa/storageapi/messageapi/storagemessage.cpp index f78e8e7a8f5..0007cb3b817 100644 --- a/storage/src/vespa/storageapi/messageapi/storagemessage.cpp +++ b/storage/src/vespa/storageapi/messageapi/storagemessage.cpp @@ -44,8 +44,6 @@ const MessageType MessageType::UPDATE("Update", UPDATE_ID); const MessageType MessageType::UPDATE_REPLY("Update Reply", UPDATE_REPLY_ID, &MessageType::UPDATE); const MessageType MessageType::REMOVE("Remove", REMOVE_ID); const MessageType MessageType::REMOVE_REPLY("Remove Reply", REMOVE_REPLY_ID, &MessageType::REMOVE); -const MessageType MessageType::REVERT("Revert", REVERT_ID); -const MessageType MessageType::REVERT_REPLY("Revert Reply", REVERT_REPLY_ID, &MessageType::REVERT); const MessageType MessageType::VISITOR_CREATE("Visitor Create", VISITOR_CREATE_ID); const MessageType MessageType::VISITOR_CREATE_REPLY("Visitor Create Reply", VISITOR_CREATE_REPLY_ID, &MessageType::VISITOR_CREATE); const MessageType MessageType::VISITOR_DESTROY("Visitor Destroy", VISITOR_DESTROY_ID); diff --git a/storage/src/vespa/storageapi/messageapi/storagemessage.h b/storage/src/vespa/storageapi/messageapi/storagemessage.h index 831e44bdba9..af258125984 100644 --- a/storage/src/vespa/storageapi/messageapi/storagemessage.h +++ b/storage/src/vespa/storageapi/messageapi/storagemessage.h @@ -80,8 +80,8 @@ public: PUT_REPLY_ID = 11, REMOVE_ID = 12, REMOVE_REPLY_ID = 13, - REVERT_ID = 14, - REVERT_REPLY_ID = 15, + // REVERT_ID = 14, unused but reserved + // REVERT_REPLY_ID = 15, unused but reserved STAT_ID = 16, STAT_REPLY_ID = 17, VISITOR_CREATE_ID = 18, @@ -164,8 +164,6 @@ public: static const MessageType PUT_REPLY; static const MessageType REMOVE; static const MessageType REMOVE_REPLY; - static const MessageType REVERT; - static const MessageType REVERT_REPLY; static const MessageType VISITOR_CREATE; static const MessageType VISITOR_CREATE_REPLY; static const MessageType VISITOR_DESTROY; |