summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/s/balancer/balancer.cpp7
-rw-r--r--src/mongo/s/request_types/balancer_collection_status.idl2
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 f7095f96992..a59adce0fba 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 db49dc9f3e9..ff5bec5ac6a 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