summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorMaria van Keulen <maria@mongodb.com>2019-06-25 14:17:17 -0400
committerMaria van Keulen <maria@mongodb.com>2019-06-28 14:38:04 -0400
commit47ee8f8cde1d1e116caf223458c15b4af10943d6 (patch)
treef7a89e5fa98ac325cb73788004df05d43d10eef1 /src/mongo/db
parent3ac05eb3fbfaacc1219054e5e765cba4926e7223 (diff)
downloadmongo-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')
-rw-r--r--src/mongo/db/catalog/database_impl.cpp4
-rw-r--r--src/mongo/db/commands/dbcommands.cpp2
-rw-r--r--src/mongo/db/stats/storage_stats.cpp8
3 files changed, 7 insertions, 7 deletions
diff --git a/src/mongo/db/catalog/database_impl.cpp b/src/mongo/db/catalog/database_impl.cpp
index 08add96be59..12853dd15bc 100644
--- a/src/mongo/db/catalog/database_impl.cpp
+++ b/src/mongo/db/catalog/database_impl.cpp
@@ -242,7 +242,6 @@ void DatabaseImpl::getStats(OperationContext* opCtx, BSONObjBuilder* output, dou
long long objects = 0;
long long size = 0;
long long storageSize = 0;
- long long numExtents = 0;
long long indexes = 0;
long long indexSize = 0;
@@ -259,7 +258,6 @@ void DatabaseImpl::getStats(OperationContext* opCtx, BSONObjBuilder* output, dou
BSONObjBuilder temp;
storageSize += collection->getRecordStore()->storageSize(opCtx, &temp);
- numExtents += temp.obj()["numExtents"].numberInt(); // XXX
indexes += collection->getIndexCatalog()->numIndexesTotal(opCtx);
indexSize += collection->getIndexSize(opCtx);
@@ -275,9 +273,9 @@ void DatabaseImpl::getStats(OperationContext* opCtx, BSONObjBuilder* output, dou
output->append("avgObjSize", objects == 0 ? 0 : double(size) / double(objects));
output->appendNumber("dataSize", size / scale);
output->appendNumber("storageSize", storageSize / scale);
- output->appendNumber("numExtents", numExtents);
output->appendNumber("indexes", indexes);
output->appendNumber("indexSize", indexSize / scale);
+ output->appendNumber("totalSize", (storageSize + indexSize) / scale);
output->appendNumber("scaleFactor", scale);
if (!opCtx->getServiceContext()->getStorageEngine()->isEphemeral()) {
diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp
index 6df61000eac..ba34046a899 100644
--- a/src/mongo/db/commands/dbcommands.cpp
+++ b/src/mongo/db/commands/dbcommands.cpp
@@ -694,7 +694,7 @@ public:
result.append("avgObjSize", 0);
result.appendNumber("dataSize", 0);
result.appendNumber("storageSize", 0);
- result.appendNumber("numExtents", 0);
+ result.appendNumber("totalSize", 0);
result.appendNumber("indexes", 0);
result.appendNumber("indexSize", 0);
result.appendNumber("scaleFactor", scale);
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);