diff options
author | Maria van Keulen <maria@mongodb.com> | 2019-06-25 14:17:17 -0400 |
---|---|---|
committer | Maria van Keulen <maria@mongodb.com> | 2019-06-28 14:38:04 -0400 |
commit | 47ee8f8cde1d1e116caf223458c15b4af10943d6 (patch) | |
tree | f7a89e5fa98ac325cb73788004df05d43d10eef1 /src/mongo/db/stats | |
parent | 3ac05eb3fbfaacc1219054e5e765cba4926e7223 (diff) | |
download | mongo-47ee8f8cde1d1e116caf223458c15b4af10943d6.tar.gz |
SERVER-16917 Add totalSize field to dbStats and collStats
This commit also removes the now obsolete numExtents field.
Diffstat (limited to 'src/mongo/db/stats')
-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); |