diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-01-20 12:01:13 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-01-20 12:01:13 +0000 |
commit | ff551559deacaacc3bb77699686bb6c65e08a818 (patch) | |
tree | fcfa8056cd61aa89bfa50728ab6983fa85ce4c88 /storage | |
parent | c5c86dd6b6f0baf2b807ed9cd2dbc16bb507cab8 (diff) |
Add debug dumping and other minor followup on PR comments.
Diffstat (limited to 'storage')
3 files changed, 37 insertions, 15 deletions
diff --git a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp index 2cd9f34c0f3..acccbb8b9b9 100644 --- a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp +++ b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp @@ -419,14 +419,14 @@ TEST_F(FileStorManagerTest, running_task_against_unknown_bucket_fails) { EXPECT_TRUE(getDummyPersistence().getClusterState().nodeUp()); auto executor = getDummyPersistence().get_bucket_executor(); - EXPECT_TRUE(executor); + ASSERT_TRUE(executor); spi::Bucket b1 = makeSpiBucket(document::BucketId(1)); std::atomic<size_t> numInvocations(0); auto response = executor->execute(b1, spi::makeBucketTask([&numInvocations](const spi::Bucket &, std::shared_ptr<IDestructorCallback>) { numInvocations++; })); - EXPECT_TRUE(response); + ASSERT_TRUE(response); EXPECT_EQ(0, numInvocations); response->run(spi::Bucket(), {}); EXPECT_EQ(1, numInvocations); @@ -439,7 +439,7 @@ TEST_F(FileStorManagerTest, running_task_against_existing_bucket_works) { EXPECT_TRUE(getDummyPersistence().getClusterState().nodeUp()); auto executor = getDummyPersistence().get_bucket_executor(); - EXPECT_TRUE(executor); + ASSERT_TRUE(executor); spi::Bucket b1 = makeSpiBucket(document::BucketId(1)); diff --git a/storage/src/vespa/storage/persistence/messages.cpp b/storage/src/vespa/storage/persistence/messages.cpp index 528a19ba7dc..7ccb3ee895d 100644 --- a/storage/src/vespa/storage/persistence/messages.cpp +++ b/storage/src/vespa/storage/persistence/messages.cpp @@ -193,8 +193,28 @@ RunTaskCommand::RunTaskCommand(const spi::Bucket &bucket, std::unique_ptr<spi::B RunTaskCommand::~RunTaskCommand() = default; +void +RunTaskCommand::print(std::ostream& out, bool verbose, const std::string& indent) const { + out << "RunTaskCommand(" << _bucket <<")"; + + if (verbose) { + out << " : "; + InternalCommand::print(out, true, indent); + } +} + RunTaskReply::RunTaskReply(const RunTaskCommand& cmd) : api::InternalReply(ID, cmd) {} +void +RunTaskReply::print(std::ostream& out, bool verbose, const std::string& indent) const { + out << "RunTaskReply()"; + + if (verbose) { + out << " : "; + InternalReply::print(out, true, indent); + } +} + } diff --git a/storage/src/vespa/storage/persistence/messages.h b/storage/src/vespa/storage/persistence/messages.h index 3b49365d560..043747d10d2 100644 --- a/storage/src/vespa/storage/persistence/messages.h +++ b/storage/src/vespa/storage/persistence/messages.h @@ -17,7 +17,7 @@ private: uint32_t _maxByteSize; public: - static const uint32_t ID = 1001; + static constexpr uint32_t ID = 1001; typedef std::unique_ptr<GetIterCommand> UP; typedef std::shared_ptr<GetIterCommand> SP; @@ -51,7 +51,7 @@ private: public: typedef std::unique_ptr<GetIterReply> UP; typedef std::shared_ptr<GetIterReply> SP; - static const uint32_t ID = 1002; + static constexpr uint32_t ID = 1002; explicit GetIterReply(GetIterCommand& cmd); ~GetIterReply() override; @@ -81,7 +81,7 @@ class CreateIteratorCommand : public api::InternalCommand spi::ReadConsistency _readConsistency; public: - static const uint32_t ID = 1003; + static constexpr uint32_t ID = 1003; typedef std::unique_ptr<CreateIteratorCommand> UP; typedef std::shared_ptr<CreateIteratorCommand> SP; @@ -115,7 +115,7 @@ class CreateIteratorReply : public api::InternalReply document::Bucket _bucket; spi::IteratorId _iteratorId; public: - static const uint32_t ID = 1004; + static constexpr uint32_t ID = 1004; typedef std::unique_ptr<CreateIteratorReply> UP; typedef std::shared_ptr<CreateIteratorReply> SP; @@ -133,7 +133,7 @@ class DestroyIteratorCommand : public api::InternalCommand { spi::IteratorId _iteratorId; public: - static const uint32_t ID = 1005; + static constexpr uint32_t ID = 1005; typedef std::unique_ptr<DestroyIteratorCommand> UP; typedef std::shared_ptr<DestroyIteratorCommand> SP; @@ -151,7 +151,7 @@ class DestroyIteratorReply : public api::InternalReply { spi::IteratorId _iteratorId; public: - static const uint32_t ID = 1006; + static constexpr uint32_t ID = 1006; typedef std::unique_ptr<DestroyIteratorReply> UP; typedef std::shared_ptr<DestroyIteratorReply> SP; @@ -165,7 +165,7 @@ class RecheckBucketInfoCommand : public api::InternalCommand { document::Bucket _bucket; public: - static const uint32_t ID = 1007; + static constexpr uint32_t ID = 1007; typedef std::shared_ptr<RecheckBucketInfoCommand> SP; typedef std::unique_ptr<RecheckBucketInfoCommand> UP; @@ -183,7 +183,7 @@ class RecheckBucketInfoReply : public api::InternalReply { document::Bucket _bucket; public: - static const uint32_t ID = 1008; + static constexpr uint32_t ID = 1008; typedef std::shared_ptr<RecheckBucketInfoReply> SP; typedef std::unique_ptr<RecheckBucketInfoReply> UP; @@ -207,7 +207,7 @@ public: } }; - static const uint32_t ID = 1009; + static constexpr uint32_t ID = 1009; typedef std::shared_ptr<AbortBucketOperationsCommand> SP; typedef std::shared_ptr<const AbortBucketOperationsCommand> CSP; private: @@ -228,7 +228,7 @@ public: class AbortBucketOperationsReply : public api::InternalReply { public: - static const uint32_t ID = 1010; + static constexpr uint32_t ID = 1010; typedef std::shared_ptr<AbortBucketOperationsReply> SP; typedef std::shared_ptr<const AbortBucketOperationsReply> CSP; @@ -243,7 +243,7 @@ public: // the inner workings of the storagelink chain. class RunTaskCommand : public api::InternalCommand { public: - static const uint32_t ID = 1011; + static constexpr uint32_t ID = 1011; RunTaskCommand(const spi::Bucket &bucket, std::unique_ptr<spi::BucketTask> task); ~RunTaskCommand(); @@ -253,6 +253,7 @@ public: return *_task; } + void print(std::ostream& out, bool verbose, const std::string& indent) const override; private: std::unique_ptr<spi::BucketTask> _task; spi::Bucket _bucket; @@ -263,8 +264,9 @@ class RunTaskReply : public api::InternalReply { public: explicit RunTaskReply(const RunTaskCommand&); + void print(std::ostream& out, bool verbose, const std::string& indent) const override; private: - static const uint32_t ID = 1012; + static constexpr uint32_t ID = 1012; }; } // ns storage |