You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by mr...@apache.org on 2014/09/18 09:07:18 UTC
svn commit: r1625898 - /jackrabbit/oak/trunk/oak-run/src/main/js/oak-mongo.js
Author: mreutegg
Date: Thu Sep 18 07:07:18 2014
New Revision: 1625898
URL: http://svn.apache.org/r1625898
Log:
OAK-2105: Review padding for blobs collection
Add function to get stats about blobs collection
Modified:
jackrabbit/oak/trunk/oak-run/src/main/js/oak-mongo.js
Modified: jackrabbit/oak/trunk/oak-run/src/main/js/oak-mongo.js
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/js/oak-mongo.js?rev=1625898&r1=1625897&r2=1625898&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/js/oak-mongo.js (original)
+++ jackrabbit/oak/trunk/oak-run/src/main/js/oak-mongo.js Thu Sep 18 07:07:18 2014
@@ -146,6 +146,24 @@ var oak = (function(global){
return checkOrFixLastRevs(path, clusterId, false);
}
+ /**
+ * Returns statistics about the blobs collection in the current database.
+ * The stats include the combined BSON size of all documents. The time to
+ * run this command therefore heavily depends on the size of the collection.
+ */
+ api.blobStats = function() {
+ var result = {};
+ var stats = db.blobs.stats(1024 * 1024);
+ var bsonSize = 0;
+ db.blobs.find().forEach(function(doc){bsonSize += Object.bsonsize(doc)});
+ result.count = stats.count;
+ result.size = stats.size;
+ result.storageSize = stats.storageSize;
+ result.bsonSize = Math.round(bsonSize / (1024 * 1024));
+ result.indexSize = stats.totalIndexSize;
+ return result;
+ }
+
//~--------------------------------------------------< internal >
var checkOrFixLastRevs = function(path, clusterId, dryRun) {