diff options
author | Pierlauro Sciarelli <pierlauro.sciarelli@mongodb.com> | 2022-11-09 15:06:48 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-11-09 16:07:54 +0000 |
commit | e570e79c4761bc09b6814eb3c4cc175c2dfd8462 (patch) | |
tree | 070003bfc48ec83c1364cf9a4c219a288ce0e3c2 | |
parent | 78d555f1c06d73df273fc0b47ac4d2b69e7a618e (diff) | |
download | mongo-e570e79c4761bc09b6814eb3c4cc175c2dfd8462.tar.gz |
SERVER-67898 Add chunk size in bytes to BalancerCollectionStatusResponse
-rw-r--r-- | src/mongo/db/s/balancer/balancer.cpp | 7 | ||||
-rw-r--r-- | src/mongo/s/request_types/balancer_collection_status.idl | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/mongo/db/s/balancer/balancer.cpp b/src/mongo/db/s/balancer/balancer.cpp index ff763612920..d8363aba30f 100644 --- a/src/mongo/db/s/balancer/balancer.cpp +++ b/src/mongo/db/s/balancer/balancer.cpp @@ -1151,7 +1151,12 @@ BalancerCollectionStatusResponse Balancer::getBalancerStatusForNs(OperationConte uasserted(ErrorCodes::NamespaceNotSharded, "Collection unsharded or undefined"); } - const auto maxChunkSizeMB = getMaxChunkSizeMB(opCtx, coll); + + const auto maxChunkSizeBytes = getMaxChunkSizeBytes(opCtx, coll); + double maxChunkSizeMB = (double)maxChunkSizeBytes / (1024 * 1024); + // Keep only 2 decimal digits to return a readable value + maxChunkSizeMB = std::ceil(maxChunkSizeMB * 100.0) / 100.0; + BalancerCollectionStatusResponse response(maxChunkSizeMB, true /*balancerCompliant*/); auto setViolationOnResponse = [&response](const StringData& reason, const boost::optional<BSONObj>& details = diff --git a/src/mongo/s/request_types/balancer_collection_status.idl b/src/mongo/s/request_types/balancer_collection_status.idl index 53e86886562..a821222f933 100644 --- a/src/mongo/s/request_types/balancer_collection_status.idl +++ b/src/mongo/s/request_types/balancer_collection_status.idl @@ -40,7 +40,7 @@ structs: strict: false fields: chunkSize: - type: safeInt64 + type: safeDouble description: "Configured chunk size in MiB for this collection" balancerCompliant: type: bool |