diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-11-26 11:15:00 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-11-26 23:08:20 +0000 |
commit | c7721d45b452e3f29f24373c57e0b17507ae16d3 (patch) | |
tree | a9b6a4a6d801a414629b24bda0a16790db06d28f /storage/src/tests | |
parent | 2944de2c274959a864c77e639d32ff87839cb21f (diff) |
Remove loadmetrics indirection.
Diffstat (limited to 'storage/src/tests')
16 files changed, 85 insertions, 95 deletions
diff --git a/storage/src/tests/common/metricstest.cpp b/storage/src/tests/common/metricstest.cpp index fa46fce5e93..2c09b2974e5 100644 --- a/storage/src/tests/common/metricstest.cpp +++ b/storage/src/tests/common/metricstest.cpp @@ -5,6 +5,7 @@ #include <vespa/storage/bucketdb/bucketmanager.h> #include <vespa/storage/common/statusmetricconsumer.h> #include <vespa/storage/persistence/filestorage/filestormanager.h> +#include <vespa/storage/persistence/filestorage/filestormetrics.h> #include <vespa/storage/visiting/visitormetrics.h> #include <tests/common/teststorageapp.h> #include <tests/common/testhelper.h> @@ -94,15 +95,15 @@ void MetricsTest::SetUp() { documentapi::LoadTypeSet::SP loadTypes(_node->getLoadTypes()); - _filestorMetrics = std::make_shared<FileStorMetrics>(_node->getLoadTypes()->getMetricLoadTypes()); - _filestorMetrics->initDiskMetrics(loadTypes->getMetricLoadTypes(), 1, 1); + _filestorMetrics = std::make_shared<FileStorMetrics>(); + _filestorMetrics->initDiskMetrics(1, 1); _topSet->registerMetric(*_filestorMetrics); _bucketManagerMetrics = std::make_shared<BucketManagerMetrics>(_node->getComponentRegister().getBucketSpaceRepo()); _topSet->registerMetric(*_bucketManagerMetrics); _visitorMetrics = std::make_shared<VisitorMetrics>(); - _visitorMetrics->initThreads(4, loadTypes->getMetricLoadTypes()); + _visitorMetrics->initThreads(4); _topSet->registerMetric(*_visitorMetrics); _metricManager->init(_config->getConfigId(), _node->getThreadPool()); } @@ -145,22 +146,22 @@ void MetricsTest::createFakeLoad() using documentapi::LoadType; - thread.put[LoadType::DEFAULT].count.inc(10 * n); - thread.put[LoadType::DEFAULT].latency.addValue(5 * n); - thread.get[LoadType::DEFAULT].count.inc(12 * n); - thread.get[LoadType::DEFAULT].notFound.inc(2 * n); - thread.get[LoadType::DEFAULT].latency.addValue(3 * n); - thread.remove[LoadType::DEFAULT].count.inc(6 * n); - thread.remove[LoadType::DEFAULT].notFound.inc(1 * n); - thread.remove[LoadType::DEFAULT].latency.addValue(2 * n); - thread.update[LoadType::DEFAULT].count.inc(2 * n); - thread.update[LoadType::DEFAULT].notFound.inc(1 * n); - thread.update[LoadType::DEFAULT].latencyRead.addValue(2 * n); - thread.update[LoadType::DEFAULT].latency.addValue(7 * n); - thread.revert[LoadType::DEFAULT].count.inc(2 * n); - thread.revert[LoadType::DEFAULT].notFound.inc(n / 2); - thread.revert[LoadType::DEFAULT].latency.addValue(2 * n); - thread.visit[LoadType::DEFAULT].count.inc(6 * n); + thread.put.count.inc(10 * n); + thread.put.latency.addValue(5 * n); + thread.get.count.inc(12 * n); + thread.get.notFound.inc(2 * n); + thread.get.latency.addValue(3 * n); + thread.remove.count.inc(6 * n); + thread.remove.notFound.inc(1 * n); + thread.remove.latency.addValue(2 * n); + thread.update.count.inc(2 * n); + thread.update.notFound.inc(1 * n); + thread.update.latencyRead.addValue(2 * n); + thread.update.latency.addValue(7 * n); + thread.revert.count.inc(2 * n); + thread.revert.notFound.inc(n / 2); + thread.revert.latency.addValue(2 * n); + thread.visit.count.inc(6 * n); thread.deleteBuckets.count.inc(1 * n); thread.repairs.count.inc(3 * n); @@ -186,12 +187,12 @@ void MetricsTest::createFakeLoad() for (uint32_t i=0; i<_visitorMetrics->threads.size(); ++i) { VisitorThreadMetrics& thread(*_visitorMetrics->threads[i]); thread.queueSize.addValue(2); - thread.averageQueueWaitingTime[documentapi::LoadType::DEFAULT].addValue(10); - thread.averageVisitorLifeTime[documentapi::LoadType::DEFAULT].addValue(1000); - thread.createdVisitors[documentapi::LoadType::DEFAULT].inc(5 * n); - thread.abortedVisitors[documentapi::LoadType::DEFAULT].inc(1 * n); - thread.completedVisitors[documentapi::LoadType::DEFAULT].inc(4 * n); - thread.failedVisitors[documentapi::LoadType::DEFAULT].inc(2 * n); + thread.averageQueueWaitingTime.addValue(10); + thread.averageVisitorLifeTime.addValue(1000); + thread.createdVisitors.inc(5 * n); + thread.abortedVisitors.inc(1 * n); + thread.completedVisitors.inc(4 * n); + thread.failedVisitors.inc(2 * n); } _clock->addSecondsToTime(60); _metricManager->timeChangedNotification(); @@ -242,7 +243,7 @@ TEST_F(MetricsTest, snapshot_presenting) { LOG(debug, "Adding to get metric"); using documentapi::LoadType; - thread0.get[LoadType::DEFAULT].count.inc(1); + thread0.get.count.inc(1); LOG(debug, "Waiting for 5 minute snapshot to be taken"); // Wait until active metrics have been added to 5 min snapshot and reset @@ -258,7 +259,7 @@ TEST_F(MetricsTest, snapshot_presenting) { } LOG(debug, "5 minute snapshot should have been taken. Adding put count"); - thread0.put[LoadType::DEFAULT].count.inc(1); + thread0.put.count.inc(1); // Verify that active metrics have set put count but not get count ASSERT_METRIC(-2, "vds.filestor.alldisks.allthreads.put.sum.count", 1); diff --git a/storage/src/tests/distributor/bucketdbmetricupdatertest.cpp b/storage/src/tests/distributor/bucketdbmetricupdatertest.cpp index e0c3cf161bb..6b8a6608c34 100644 --- a/storage/src/tests/distributor/bucketdbmetricupdatertest.cpp +++ b/storage/src/tests/distributor/bucketdbmetricupdatertest.cpp @@ -23,14 +23,11 @@ struct BucketDBMetricUpdaterTest : Test { using NodeToReplicasMap = std::unordered_map<uint16_t, uint32_t>; NodeToReplicasMap replicaStatsOf(BucketDBMetricUpdater& metricUpdater); - metrics::LoadTypeSet _loadTypes; - BucketDBMetricUpdaterTest(); }; BucketDBMetricUpdaterTest::BucketDBMetricUpdaterTest() { - _loadTypes.push_back(metrics::LoadType(0, "foo")); } namespace { @@ -65,7 +62,7 @@ makeInfo(uint32_t copy0Crc, uint32_t copy1Crc) TEST_F(BucketDBMetricUpdaterTest, doc_and_byte_counts_are_updated) { BucketDBMetricUpdater metricUpdater; IdealStateMetricSet ims; - DistributorMetricSet dms(_loadTypes); + DistributorMetricSet dms; EXPECT_FALSE(metricUpdater.hasCompletedRound()); @@ -104,7 +101,7 @@ TEST_F(BucketDBMetricUpdaterTest, doc_and_byte_counts_are_updated) { TEST_F(BucketDBMetricUpdaterTest, bucket_db_memory_usage_metrics_are_updated) { BucketDBMetricUpdater metric_updater; IdealStateMetricSet ims; - DistributorMetricSet dms(_loadTypes); + DistributorMetricSet dms; vespalib::MemoryUsage mem_usage; mem_usage.incAllocatedBytes(1000); @@ -138,7 +135,7 @@ TEST_F(BucketDBMetricUpdaterTest, bucket_db_memory_usage_metrics_are_updated) { TEST_F(BucketDBMetricUpdaterTest, buckets_with_too_few_and_too_many_copies) { BucketDBMetricUpdater metricUpdater; IdealStateMetricSet ims; - DistributorMetricSet dms(_loadTypes); + DistributorMetricSet dms; metricUpdater.completeRound(); metricUpdater.getLastCompleteStats().propagateMetrics(ims, dms); @@ -186,7 +183,7 @@ TEST_F(BucketDBMetricUpdaterTest, buckets_with_too_few_and_too_many_copies) { TEST_F(BucketDBMetricUpdaterTest, buckets_with_varying_trustedness) { BucketDBMetricUpdater metricUpdater; IdealStateMetricSet ims; - DistributorMetricSet dms(_loadTypes); + DistributorMetricSet dms; metricUpdater.completeRound(false); metricUpdater.getLastCompleteStats().propagateMetrics(ims, dms); @@ -222,7 +219,7 @@ TEST_F(BucketDBMetricUpdaterTest, buckets_with_varying_trustedness) { TEST_F(BucketDBMetricUpdaterTest, pick_counts_from_trusted_copy) { BucketDBMetricUpdater metricUpdater; IdealStateMetricSet ims; - DistributorMetricSet dms(_loadTypes); + DistributorMetricSet dms; // First copy added is implicitly trusted, but it is not the largest. BucketDatabase::Entry e(document::BucketId(16, 2), makeInfo(100, 200)); @@ -237,7 +234,7 @@ TEST_F(BucketDBMetricUpdaterTest, pick_counts_from_trusted_copy) { TEST_F(BucketDBMetricUpdaterTest, pick_largest_copy_if_no_trusted) { BucketDBMetricUpdater metricUpdater; IdealStateMetricSet ims; - DistributorMetricSet dms(_loadTypes); + DistributorMetricSet dms; // No trusted copies, so must pick second copy. BucketInfo info(makeInfo(100, 200)); @@ -254,7 +251,7 @@ TEST_F(BucketDBMetricUpdaterTest, pick_largest_copy_if_no_trusted) { TEST_F(BucketDBMetricUpdaterTest, complete_round_clears_working_state) { BucketDBMetricUpdater metricUpdater; IdealStateMetricSet ims; - DistributorMetricSet dms(_loadTypes); + DistributorMetricSet dms; { BucketDatabase::Entry e(document::BucketId(16, 1), makeInfo(10)); diff --git a/storage/src/tests/distributor/externaloperationhandlertest.cpp b/storage/src/tests/distributor/externaloperationhandlertest.cpp index 1f0fba90200..9bd64876e98 100644 --- a/storage/src/tests/distributor/externaloperationhandlertest.cpp +++ b/storage/src/tests/distributor/externaloperationhandlertest.cpp @@ -43,23 +43,21 @@ struct ExternalOperationHandlerTest : Test, DistributorTestUtil { void start_operation_verify_rejected(std::shared_ptr<api::StorageCommand> cmd); int64_t safe_time_not_reached_metric_count( - const metrics::LoadMetric<PersistenceOperationMetricSet>& metrics) const { - return metrics[documentapi::LoadType::DEFAULT].failures - .safe_time_not_reached.getLongValue("count"); + const PersistenceOperationMetricSet & metrics) const { + return metrics.failures.safe_time_not_reached.getLongValue("count"); } - int64_t safe_time_not_reached_metric_count(const metrics::LoadMetric<UpdateMetricSet>& metrics) const { - return metrics[documentapi::LoadType::DEFAULT].failures.safe_time_not_reached.getLongValue("count"); + int64_t safe_time_not_reached_metric_count(const UpdateMetricSet & metrics) const { + return metrics.failures.safe_time_not_reached.getLongValue("count"); } int64_t concurrent_mutatations_metric_count( - const metrics::LoadMetric<PersistenceOperationMetricSet>& metrics) const { - return metrics[documentapi::LoadType::DEFAULT].failures - .concurrent_mutations.getLongValue("count"); + const PersistenceOperationMetricSet& metrics) const { + return metrics.failures.concurrent_mutations.getLongValue("count"); } - int64_t concurrent_mutatations_metric_count(const metrics::LoadMetric<UpdateMetricSet>& metrics) const { - return metrics[documentapi::LoadType::DEFAULT].failures.concurrent_mutations.getLongValue("count"); + int64_t concurrent_mutatations_metric_count(const UpdateMetricSet & metrics) const { + return metrics.failures.concurrent_mutations.getLongValue("count"); } void set_up_distributor_for_sequencing_test(); diff --git a/storage/src/tests/distributor/getoperationtest.cpp b/storage/src/tests/distributor/getoperationtest.cpp index 09e4f41d275..410705bb1a0 100644 --- a/storage/src/tests/distributor/getoperationtest.cpp +++ b/storage/src/tests/distributor/getoperationtest.cpp @@ -58,7 +58,7 @@ struct GetOperationTest : Test, DistributorTestUtil { op = std::make_unique<GetOperation>( getExternalOperationHandler(), getDistributorBucketSpace(), getDistributorBucketSpace().getBucketDatabase().acquire_read_guard(), - msg, getDistributor().getMetrics(). gets[msg->getLoadType()], + msg, getDistributor().getMetrics().gets, consistency); op->start(_sender, framework::MilliSecTime(0)); } @@ -414,8 +414,7 @@ TEST_F(GetOperationTest, not_found) { "timestamp 0) ReturnCode(NONE)", _sender.getLastReply()); - EXPECT_EQ(1, getDistributor().getMetrics().gets[documentapi::LoadType::DEFAULT]. - failures.notfound.getValue()); + EXPECT_EQ(1, getDistributor().getMetrics().gets.failures.notfound.getValue()); EXPECT_FALSE(op->any_replicas_failed()); // "Not found" is not a failure. EXPECT_TRUE(last_reply_had_consistent_replicas()); EXPECT_TRUE(op->newest_replica().has_value()); diff --git a/storage/src/tests/distributor/putoperationtest.cpp b/storage/src/tests/distributor/putoperationtest.cpp index 16d5dcf3b25..a69948e6dd7 100644 --- a/storage/src/tests/distributor/putoperationtest.cpp +++ b/storage/src/tests/distributor/putoperationtest.cpp @@ -76,7 +76,7 @@ public: getDistributorBucketSpace(), msg, getDistributor().getMetrics(). - puts[msg->getLoadType()]); + puts); op->start(_sender, framework::MilliSecTime(0)); } diff --git a/storage/src/tests/distributor/removelocationtest.cpp b/storage/src/tests/distributor/removelocationtest.cpp index 74daba3d098..9874e936e62 100644 --- a/storage/src/tests/distributor/removelocationtest.cpp +++ b/storage/src/tests/distributor/removelocationtest.cpp @@ -31,7 +31,7 @@ struct RemoveLocationOperationTest : Test, DistributorTestUtil { getDistributorBucketSpace(), msg, getDistributor().getMetrics(). - removelocations[msg->getLoadType()]); + removelocations); op->start(_sender, framework::MilliSecTime(0)); } diff --git a/storage/src/tests/distributor/removeoperationtest.cpp b/storage/src/tests/distributor/removeoperationtest.cpp index c3fcda30bf5..02c2771a78c 100644 --- a/storage/src/tests/distributor/removeoperationtest.cpp +++ b/storage/src/tests/distributor/removeoperationtest.cpp @@ -39,7 +39,7 @@ struct RemoveOperationTest : Test, DistributorTestUtil { getDistributorBucketSpace(), msg, getDistributor().getMetrics(). - removes[msg->getLoadType()]); + removes); op->start(_sender, framework::MilliSecTime(0)); } diff --git a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp index 635e5b9883b..200a98e352f 100644 --- a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp +++ b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp @@ -1002,7 +1002,7 @@ TEST_F(TwoPhaseUpdateOperationTest, safe_path_consistent_get_reply_timestamps_re "ReturnCode(NONE)", _sender.getLastReply(true)); - auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT]; + auto& metrics = getDistributor().getMetrics().updates; EXPECT_EQ(1, metrics.fast_path_restarts.getValue()); } @@ -1021,7 +1021,7 @@ TEST_F(TwoPhaseUpdateOperationTest, safe_path_consistent_get_reply_timestamps_do // Should _not_ be restarted with fast path, as it has been config disabled ASSERT_EQ("Put => 1,Put => 0", _sender.getCommands(true, false, 2)); - auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT]; + auto& metrics = getDistributor().getMetrics().updates; EXPECT_EQ(0, metrics.fast_path_restarts.getValue()); } @@ -1116,7 +1116,7 @@ TEST_F(ThreePhaseUpdateTest, full_document_get_sent_to_replica_with_highest_time reply_to_metadata_get(*cb, _sender, 0, 1000U); reply_to_metadata_get(*cb, _sender, 1, 2000U); - auto& metrics = getDistributor().getMetrics().update_metadata_gets[documentapi::LoadType::DEFAULT]; + auto& metrics = getDistributor().getMetrics().update_metadata_gets; EXPECT_EQ(1, metrics.ok.getValue()); // Technically tracks an entire operation covering multiple Gets. // Node 1 has newest document version at ts=2000 @@ -1137,7 +1137,7 @@ TEST_F(ThreePhaseUpdateTest, puts_are_sent_after_receiving_full_document_get) { replyToGet(*cb, _sender, 2, 2000U); ASSERT_EQ("Put => 1,Put => 0", _sender.getCommands(true, false, 3)); - auto& metrics = getDistributor().getMetrics().update_gets[documentapi::LoadType::DEFAULT]; + auto& metrics = getDistributor().getMetrics().update_gets; EXPECT_EQ(1, metrics.ok.getValue()); } @@ -1158,7 +1158,7 @@ TEST_F(ThreePhaseUpdateTest, consistent_meta_get_timestamps_can_restart_in_fast_ "ReturnCode(NONE)", _sender.getLastReply(true)); - auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT]; + auto& metrics = getDistributor().getMetrics().updates; EXPECT_EQ(1, metrics.fast_path_restarts.getValue()); } @@ -1178,7 +1178,7 @@ TEST_F(ThreePhaseUpdateTest, no_document_found_on_any_replicas_is_considered_con reply_to_metadata_get(*cb, _sender, 1, no_document_timestamp); ASSERT_EQ("Update => 0,Update => 1", _sender.getCommands(true, false, 2)); - auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT]; + auto& metrics = getDistributor().getMetrics().updates; EXPECT_EQ(1, metrics.fast_path_restarts.getValue()); } diff --git a/storage/src/tests/distributor/updateoperationtest.cpp b/storage/src/tests/distributor/updateoperationtest.cpp index 844cf80e6b6..422baf08465 100644 --- a/storage/src/tests/distributor/updateoperationtest.cpp +++ b/storage/src/tests/distributor/updateoperationtest.cpp @@ -68,7 +68,7 @@ UpdateOperationTest::sendUpdate(const std::string& bucketState, bool create_if_m ExternalOperationHandler& handler = getExternalOperationHandler(); return std::make_shared<UpdateOperation>( handler, getDistributorBucketSpace(), msg, - getDistributor().getMetrics().updates[msg->getLoadType()]); + getDistributor().getMetrics().updates); } void @@ -101,7 +101,7 @@ TEST_F(UpdateOperationTest, simple) { "timestamp 100, timestamp of updated doc: 90) ReturnCode(NONE)", sender.getLastReply(true)); - auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT]; + auto& metrics = getDistributor().getMetrics().updates; EXPECT_EQ(0, metrics.diverging_timestamp_updates.getValue()); } @@ -141,7 +141,7 @@ TEST_F(UpdateOperationTest, multi_node) { "node(idx=0,crc=0x2,docs=4/4,bytes=6/6,trusted=true,active=false,ready=false)", dumpBucket(_bId)); - auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT]; + auto& metrics = getDistributor().getMetrics().updates; EXPECT_EQ(0, metrics.diverging_timestamp_updates.getValue()); } @@ -161,7 +161,7 @@ TEST_F(UpdateOperationTest, multi_node_inconsistent_timestamp) { "(best node 1)) ReturnCode(NONE)", sender.getLastReply(true)); - auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT]; + auto& metrics = getDistributor().getMetrics().updates; EXPECT_EQ(1, metrics.diverging_timestamp_updates.getValue()); } @@ -179,7 +179,7 @@ TEST_F(UpdateOperationTest, test_and_set_failures_increment_tas_metric) { "ReturnCode(TEST_AND_SET_CONDITION_FAILED, bork bork)", sender.getLastReply(true)); - auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT]; + auto& metrics = getDistributor().getMetrics().updates; EXPECT_EQ(1, metrics.failures.test_and_set_failed.getValue()); } @@ -212,7 +212,7 @@ TEST_F(UpdateOperationTest, create_if_missing_update_sentinel_timestamp_is_treat "timestamp 100, timestamp of updated doc: 0) ReturnCode(NONE)", sender.getLastReply(true)); - auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT]; + auto& metrics = getDistributor().getMetrics().updates; EXPECT_EQ(0, metrics.diverging_timestamp_updates.getValue()); } @@ -236,7 +236,7 @@ TEST_F(UpdateOperationTest, inconsistent_create_if_missing_updates_picks_largest EXPECT_NE(newest.first, BucketId()); EXPECT_EQ(newest.second, 1); - auto& metrics = getDistributor().getMetrics().updates[documentapi::LoadType::DEFAULT]; + auto& metrics = getDistributor().getMetrics().updates; // Implementation detail: since we get diverging results from nodes 2 and 1, these are // counted as separate diverging updates. EXPECT_EQ(2, metrics.diverging_timestamp_updates.getValue()); diff --git a/storage/src/tests/distributor/visitoroperationtest.cpp b/storage/src/tests/distributor/visitoroperationtest.cpp index 8a9d8063525..df5180bbb7c 100644 --- a/storage/src/tests/distributor/visitoroperationtest.cpp +++ b/storage/src/tests/distributor/visitoroperationtest.cpp @@ -94,7 +94,7 @@ struct VisitorOperationTest : Test, DistributorTestUtil { } VisitorMetricSet& defaultVisitorMetrics() { - return getDistributor().getMetrics().visits[documentapi::LoadType::DEFAULT]; + return getDistributor().getMetrics().visits; } std::unique_ptr<VisitorOperation> createOpWithConfig( @@ -106,11 +106,10 @@ struct VisitorOperationTest : Test, DistributorTestUtil { getDistributorBucketSpace(), msg, config, - getDistributor().getMetrics().visits[msg->getLoadType()]); + getDistributor().getMetrics().visits); } - std::unique_ptr<VisitorOperation> createOpWithDefaultConfig( - api::CreateVisitorCommand::SP msg) + std::unique_ptr<VisitorOperation> createOpWithDefaultConfig(api::CreateVisitorCommand::SP msg) { return createOpWithConfig(std::move(msg), defaultConfig); } @@ -126,21 +125,17 @@ struct VisitorOperationTest : Test, DistributorTestUtil { } const std::vector<BucketId>& getBucketsFromLastCommand() { - const auto& cvc = dynamic_cast<const CreateVisitorCommand&>( - *_sender.commands().back()); + const auto& cvc = dynamic_cast<const CreateVisitorCommand&>(*_sender.commands().back()); return cvc.getBuckets(); } std::pair<std::string, std::string> - runVisitor(document::BucketId id, - document::BucketId lastId, - uint32_t maxBuckets); + runVisitor(document::BucketId id, document::BucketId lastId, uint32_t maxBuckets); void doStandardVisitTest(const std::string& clusterState); - std::unique_ptr<VisitorOperation> startOperationWith2StorageNodeVisitors( - bool inconsistent); + std::unique_ptr<VisitorOperation> startOperationWith2StorageNodeVisitors(bool inconsistent); void do_visitor_roundtrip_with_statistics(const api::ReturnCode& result); }; diff --git a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp index 39bbfa21e4e..6a888e6c02d 100644 --- a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp +++ b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp @@ -264,13 +264,13 @@ struct FileStorHandlerComponents { dummyManager(new DummyStorageLink), messageSender(*dummyManager), loadTypes("raw:"), - metrics(loadTypes.getMetricLoadTypes()), + metrics(), filestorHandler() { top.push_back(std::unique_ptr<StorageLink>(dummyManager)); top.open(); - metrics.initDiskMetrics(loadTypes.getMetricLoadTypes(), 1, threadsPerDisk); + metrics.initDiskMetrics(1, threadsPerDisk); filestorHandler = std::make_unique<FileStorHandlerImpl>(messageSender, metrics, test._node->getComponentRegister()); filestorHandler->setGetNextMessageTimeout(50ms); @@ -1831,7 +1831,7 @@ TEST_F(FileStorManagerTest, put_command_size_is_added_to_metric) { auto cmd = std::make_shared<api::PutCommand>( makeDocumentBucket(bucket), _node->getTestDocMan().createRandomDocument(), api::Timestamp(12345)); - assert_request_size_set(c, std::move(cmd), thread_metrics_of(*c.manager)->put[defaultLoadType]); + assert_request_size_set(c, std::move(cmd), thread_metrics_of(*c.manager)->put); } TEST_F(FileStorManagerTest, update_command_size_is_added_to_metric) { @@ -1845,7 +1845,7 @@ TEST_F(FileStorManagerTest, update_command_size_is_added_to_metric) { auto cmd = std::make_shared<api::UpdateCommand>( makeDocumentBucket(bucket), std::move(update), api::Timestamp(123456)); - assert_request_size_set(c, std::move(cmd), thread_metrics_of(*c.manager)->update[defaultLoadType]); + assert_request_size_set(c, std::move(cmd), thread_metrics_of(*c.manager)->update); } TEST_F(FileStorManagerTest, remove_command_size_is_added_to_metric) { @@ -1855,7 +1855,7 @@ TEST_F(FileStorManagerTest, remove_command_size_is_added_to_metric) { auto cmd = std::make_shared<api::RemoveCommand>( makeDocumentBucket(bucket), document::DocumentId("id:foo:testdoctype1::bar"), api::Timestamp(123456)); - assert_request_size_set(c, std::move(cmd), thread_metrics_of(*c.manager)->remove[defaultLoadType]); + assert_request_size_set(c, std::move(cmd), thread_metrics_of(*c.manager)->remove); } TEST_F(FileStorManagerTest, get_command_size_is_added_to_metric) { @@ -1865,7 +1865,7 @@ TEST_F(FileStorManagerTest, get_command_size_is_added_to_metric) { auto cmd = std::make_shared<api::GetCommand>( makeDocumentBucket(bucket), document::DocumentId("id:foo:testdoctype1::bar"), document::AllFields::NAME); - assert_request_size_set(c, std::move(cmd), thread_metrics_of(*c.manager)->get[defaultLoadType]); + assert_request_size_set(c, std::move(cmd), thread_metrics_of(*c.manager)->get); } TEST_F(FileStorManagerTest, test_and_set_condition_mismatch_not_counted_as_failure) { @@ -1882,7 +1882,7 @@ TEST_F(FileStorManagerTest, test_and_set_condition_mismatch_not_counted_as_failu ASSERT_SINGLE_REPLY(api::PutReply, reply, c.top, _waitTime); EXPECT_EQ(reply->getResult().getResult(), api::ReturnCode::TEST_AND_SET_CONDITION_FAILED); - auto& metrics = thread_metrics_of(*c.manager)->put[defaultLoadType]; + auto& metrics = thread_metrics_of(*c.manager)->put; EXPECT_EQ(metrics.failed.getValue(), 0); EXPECT_EQ(metrics.test_and_set_failed.getValue(), 1); EXPECT_EQ(thread_metrics_of(*c.manager)->failedOperations.getValue(), 0); diff --git a/storage/src/tests/persistence/persistencequeuetest.cpp b/storage/src/tests/persistence/persistencequeuetest.cpp index 61c6e446517..62ba8bd876d 100644 --- a/storage/src/tests/persistence/persistencequeuetest.cpp +++ b/storage/src/tests/persistence/persistencequeuetest.cpp @@ -3,6 +3,7 @@ #include <vespa/persistence/dummyimpl/dummypersistence.h> #include <tests/persistence/common/filestortestfixture.h> #include <tests/persistence/filestorage/forwardingmessagesender.h> +#include <vespa/storage/persistence/filestorage/filestormetrics.h> #include <vespa/document/test/make_document_bucket.h> #include <vespa/document/fieldset/fieldsets.h> #include <vespa/log/log.h> @@ -42,13 +43,13 @@ PersistenceQueueTest::Fixture::Fixture(FileStorTestFixture& parent_) dummyManager(std::make_unique<DummyStorageLink>()), messageSender(*dummyManager), loadTypes("raw:"), - metrics(loadTypes.getMetricLoadTypes()), + metrics(), stripeId(0) { top.push_back(std::move(dummyManager)); top.open(); - metrics.initDiskMetrics(loadTypes.getMetricLoadTypes(), 1, 1); + metrics.initDiskMetrics(1, 1); filestorHandler = std::make_unique<FileStorHandlerImpl>(messageSender, metrics, parent._node->getComponentRegister()); diff --git a/storage/src/tests/persistence/persistencetestutils.cpp b/storage/src/tests/persistence/persistencetestutils.cpp index 278cb36b50c..9e779c5904b 100644 --- a/storage/src/tests/persistence/persistencetestutils.cpp +++ b/storage/src/tests/persistence/persistencetestutils.cpp @@ -52,10 +52,10 @@ PersistenceTestEnvironment::PersistenceTestEnvironment(const std::string & rootO _messageKeeper(), _node(NodeIndex(0), _config.getConfigId()), _component(_node.getComponentRegister(), "persistence test env"), - _metrics(_component.getLoadTypes()->getMetricLoadTypes()) + _metrics() { _node.setupDummyPersistence(); - _metrics.initDiskMetrics(_node.getLoadTypes()->getMetricLoadTypes(), 1, 1); + _metrics.initDiskMetrics(1, 1); _handler = std::make_unique<FileStorHandlerImpl>(_messageKeeper, _metrics, _node.getComponentRegister()); _diskEnv = std::make_unique<PersistenceUtil>(_component, *_handler, *_metrics.disk->threads[0], _node.getPersistenceProvider()); diff --git a/storage/src/tests/persistence/splitbitdetectortest.cpp b/storage/src/tests/persistence/splitbitdetectortest.cpp index 4982383685a..e1a1b6cf11b 100644 --- a/storage/src/tests/persistence/splitbitdetectortest.cpp +++ b/storage/src/tests/persistence/splitbitdetectortest.cpp @@ -7,7 +7,6 @@ #include <vespa/persistence/spi/test.h> #include <vespa/document/base/testdocman.h> #include <vespa/document/bucket/bucketidfactory.h> -#include <vespa/metrics/loadmetric.h> #include <vespa/vespalib/gtest/gtest.h> #include <algorithm> diff --git a/storage/src/tests/storageserver/statereportertest.cpp b/storage/src/tests/storageserver/statereportertest.cpp index c67598dc37b..9a22a02941b 100644 --- a/storage/src/tests/storageserver/statereportertest.cpp +++ b/storage/src/tests/storageserver/statereportertest.cpp @@ -2,6 +2,7 @@ #include <vespa/storageframework/defaultimplementation/clock/fakeclock.h> #include <vespa/storage/persistence/filestorage/filestormanager.h> +#include <vespa/storage/persistence/filestorage/filestormetrics.h> #include <vespa/storage/storageserver/applicationgenerationfetcher.h> #include <vespa/storage/storageserver/statereporter.h> #include <vespa/metrics/metricmanager.h> @@ -91,8 +92,8 @@ void StateReporterTest::SetUp() { documentapi::LoadTypeSet::SP loadTypes(_node->getLoadTypes()); - _filestorMetrics = std::make_shared<FileStorMetrics>(_node->getLoadTypes()->getMetricLoadTypes()); - _filestorMetrics->initDiskMetrics(loadTypes->getMetricLoadTypes(), 1, 1); + _filestorMetrics = std::make_shared<FileStorMetrics>(); + _filestorMetrics->initDiskMetrics(1, 1); _topSet->registerMetric(*_filestorMetrics); _metricManager->init(_config->getConfigId(), _node->getThreadPool()); @@ -223,7 +224,7 @@ TEST_F(StateReporterTest, report_metrics) { LOG(debug, "Adding to get metric"); using documentapi::LoadType; - thread0.get[LoadType::DEFAULT].count.inc(1); + thread0.get.count.inc(1); LOG(debug, "Waiting for 5 minute snapshot to be taken"); // Wait until active metrics have been added to 5 min snapshot and reset @@ -239,7 +240,7 @@ TEST_F(StateReporterTest, report_metrics) { } LOG(debug, "5 minute snapshot should have been taken. Adding put count"); - thread0.put[LoadType::DEFAULT].count.inc(1); + thread0.put.count.inc(1); const int pathCount = 2; const char* paths[pathCount] = { diff --git a/storage/src/tests/visiting/visitortest.cpp b/storage/src/tests/visiting/visitortest.cpp index 9d0d5575993..b362e368b9b 100644 --- a/storage/src/tests/visiting/visitortest.cpp +++ b/storage/src/tests/visiting/visitortest.cpp @@ -127,8 +127,7 @@ protected: // come in and wipe our accumulated failure metrics. // Only 1 visitor thread running, so we know it has the metrics. const auto& metrics = _manager->getThread(0).getMetrics(); - auto loadType = documentapi::LoadType::DEFAULT; - return metrics.visitorDestinationFailureReplies[loadType].getCount(); + return metrics.visitorDestinationFailureReplies.getCount(); } }; |