diff options
author | Geir Storli <geirst@oath.com> | 2018-02-20 10:17:27 +0000 |
---|---|---|
committer | Geir Storli <geirst@oath.com> | 2018-02-20 10:17:27 +0000 |
commit | 47c87fe4cb8e8eb8e52aa9afaaca0e9427e6bf50 (patch) | |
tree | ea99a28c38b7aa29c744a1c90d3bd2b04a2b52a4 | |
parent | 6d7b65adfcd1e918da8173dab25bf701074f3cdc (diff) |
Align bucket spaces json format with what is expected by clustercontroller.
3 files changed, 18 insertions, 14 deletions
diff --git a/protocols/getnodestate/distributor.json b/protocols/getnodestate/distributor.json index ceed1a1b5c3..970fd09f253 100644 --- a/protocols/getnodestate/distributor.json +++ b/protocols/getnodestate/distributor.json @@ -13,13 +13,17 @@ "bucket-spaces" : [ { "name": "default", - "total": 11, - "pending": 3 + "buckets": { + "total": 11, + "pending": 3 + } }, { "name": "global", - "total": 13, - "pending": 5 + "buckets": { + "total": 13, + "pending": 5 + } } ] }, @@ -34,9 +38,7 @@ }, "bucket-spaces" : [ { - "name": "default", - "total": 17, - "pending": 7 + "name": "default" } ] } diff --git a/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp b/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp index 14df6ee5016..64df05acb8f 100644 --- a/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp +++ b/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp @@ -149,8 +149,9 @@ DistributorHostInfoReporterTest::verifyBucketSpaceStats(const vespalib::Slime& r size_t bucketsPending) { const auto &stats = getBucketSpaceStats(root, nodeIndex, bucketSpaceName); - CPPUNIT_ASSERT_EQUAL(bucketsTotal, static_cast<size_t>(stats["total"].asLong())); - CPPUNIT_ASSERT_EQUAL(bucketsPending, static_cast<size_t>(stats["pending"].asLong())); + const auto &buckets = stats["buckets"]; + CPPUNIT_ASSERT_EQUAL(bucketsTotal, static_cast<size_t>(buckets["total"].asLong())); + CPPUNIT_ASSERT_EQUAL(bucketsPending, static_cast<size_t>(buckets["pending"].asLong())); } void @@ -159,8 +160,7 @@ DistributorHostInfoReporterTest::verifyBucketSpaceStats(const vespalib::Slime& r const vespalib::string& bucketSpaceName) { const auto &stats = getBucketSpaceStats(root, nodeIndex, bucketSpaceName); - CPPUNIT_ASSERT(!stats["total"].valid()); - CPPUNIT_ASSERT(!stats["pending"].valid()); + CPPUNIT_ASSERT(!stats["buckets"].valid()); } struct Fixture { @@ -233,7 +233,7 @@ DistributorHostInfoReporterTest::generateExampleJson() PerNodeBucketSpacesStats stats; stats[0]["default"] = BucketSpaceStats(11, 3); stats[0]["global"] = BucketSpaceStats(13, 5); - stats[5]["default"] = BucketSpaceStats(17, 7); + stats[5]["default"] = BucketSpaceStats(); f.bucketSpacesStatsProvider.stats = stats; vespalib::asciistream json; diff --git a/storage/src/vespa/storage/distributor/distributor_host_info_reporter.cpp b/storage/src/vespa/storage/distributor/distributor_host_info_reporter.cpp index 5929f02c04b..8d2e45655d2 100644 --- a/storage/src/vespa/storage/distributor/distributor_host_info_reporter.cpp +++ b/storage/src/vespa/storage/distributor/distributor_host_info_reporter.cpp @@ -49,8 +49,10 @@ writeBucketSpacesStats(vespalib::JsonStream& stream, for (const auto& elem : stats) { stream << Object() << "name" << elem.first; if (elem.second.valid()) { - stream << "total" << elem.second.bucketsTotal() - << "pending" << elem.second.bucketsPending(); + stream << "buckets" << Object() + << "total" << elem.second.bucketsTotal() + << "pending" << elem.second.bucketsPending() + << End(); } stream << End(); } |