diff options
-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 0c1e3282cfc..fdb36b34bdf 100644 --- a/src/mongo/db/s/balancer/balancer.cpp +++ b/src/mongo/db/s/balancer/balancer.cpp @@ -1159,7 +1159,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 |