diff options
Diffstat (limited to 'src/mongo/db/stats/storage_stats.cpp')
-rw-r--r-- | src/mongo/db/stats/storage_stats.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mongo/db/stats/storage_stats.cpp b/src/mongo/db/stats/storage_stats.cpp index 8b290ed2d95..63e5540fdaf 100644 --- a/src/mongo/db/stats/storage_stats.cpp +++ b/src/mongo/db/stats/storage_stats.cpp @@ -61,6 +61,7 @@ Status appendCollectionStorageStats(OperationContext* opCtx, result->appendNumber("size", 0); result->appendNumber("count", 0); result->appendNumber("storageSize", 0); + result->append("totalSize", 0); result->append("nindexes", 0); result->appendNumber("totalIndexSize", 0); result->append("indexDetails", BSONObj()); @@ -80,9 +81,9 @@ Status appendCollectionStorageStats(OperationContext* opCtx, result->append("avgObjSize", collection->averageObjectSize(opCtx)); RecordStore* recordStore = collection->getRecordStore(); - result->appendNumber( - "storageSize", - static_cast<long long>(recordStore->storageSize(opCtx, result, verbose ? 1 : 0)) / scale); + auto storageSize = + static_cast<long long>(recordStore->storageSize(opCtx, result, verbose ? 1 : 0)); + result->appendNumber("storageSize", storageSize / scale); recordStore->appendCustomStats(opCtx, result, scale); @@ -117,6 +118,7 @@ Status appendCollectionStorageStats(OperationContext* opCtx, long long indexSize = collection->getIndexSize(opCtx, &indexSizes, scale); result->appendNumber("totalIndexSize", indexSize / scale); + result->appendNumber("totalSize", (storageSize + indexSize) / scale); result->append("indexSizes", indexSizes.obj()); result->append("scaleFactor", scale); |