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 | |
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')
-rw-r--r-- | src/mongo/db/catalog/database_impl.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/commands/dbcommands.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/stats/storage_stats.cpp | 8 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_coll_stats_cmd.cpp | 2 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_db_stats_cmd.cpp | 6 |
5 files changed, 11 insertions, 11 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); diff --git a/src/mongo/s/commands/cluster_coll_stats_cmd.cpp b/src/mongo/s/commands/cluster_coll_stats_cmd.cpp index c9afc8df754..8389409d6ba 100644 --- a/src/mongo/s/commands/cluster_coll_stats_cmd.cpp +++ b/src/mongo/s/commands/cluster_coll_stats_cmd.cpp @@ -138,7 +138,7 @@ public: result.append(e); } else if (fieldIsAnyOf( fieldName, - {"count", "size", "storageSize", "numExtents", "totalIndexSize"})) { + {"count", "size", "storageSize", "totalIndexSize", "totalSize"})) { counts[e.fieldName()] += e.numberLong(); } else if (fieldName == "avgObjSize") { const auto shardAvgObjSize = e.numberLong(); diff --git a/src/mongo/s/commands/cluster_db_stats_cmd.cpp b/src/mongo/s/commands/cluster_db_stats_cmd.cpp index 752cca26976..d7d31e5fd55 100644 --- a/src/mongo/s/commands/cluster_db_stats_cmd.cpp +++ b/src/mongo/s/commands/cluster_db_stats_cmd.cpp @@ -46,7 +46,7 @@ void aggregateResults(int scale, long long unscaledDataSize = 0; long long dataSize = 0; long long storageSize = 0; - long long numExtents = 0; + long long totalSize = 0; long long indexes = 0; long long indexSize = 0; long long fileSize = 0; @@ -59,7 +59,7 @@ void aggregateResults(int scale, unscaledDataSize += b["avgObjSize"].numberLong() * b["objects"].numberLong(); dataSize += b["dataSize"].numberLong(); storageSize += b["storageSize"].numberLong(); - numExtents += b["numExtents"].numberLong(); + totalSize += b["totalSize"].numberLong(); indexes += b["indexes"].numberLong(); indexSize += b["indexSize"].numberLong(); fileSize += b["fileSize"].numberLong(); @@ -73,7 +73,7 @@ void aggregateResults(int scale, output.append("avgObjSize", objects == 0 ? 0 : double(unscaledDataSize) / double(objects)); output.appendNumber("dataSize", dataSize); output.appendNumber("storageSize", storageSize); - output.appendNumber("numExtents", numExtents); + output.appendNumber("totalSize", totalSize); output.appendNumber("indexes", indexes); output.appendNumber("indexSize", indexSize); output.appendNumber("scaleFactor", scale); |