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 ch...@apache.org on 2014/08/11 20:50:57 UTC

svn commit: r1617347 - in /jackrabbit/oak/trunk/oak-run: README.md src/main/js/oak-mongo.js

Author: chetanm
Date: Mon Aug 11 18:50:57 2014
New Revision: 1617347

URL: http://svn.apache.org/r1617347
Log:
OAK-1990 - Utility js methods to manage Oak data in Mongo

Add method to collect important system stats

Modified:
    jackrabbit/oak/trunk/oak-run/README.md
    jackrabbit/oak/trunk/oak-run/src/main/js/oak-mongo.js

Modified: jackrabbit/oak/trunk/oak-run/README.md
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/README.md?rev=1617347&r1=1617346&r2=1617347&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/README.md (original)
+++ jackrabbit/oak/trunk/oak-run/README.md Mon Aug 11 18:50:57 2014
@@ -596,4 +596,9 @@ is provided. It includes some useful fun
     { "count" : 356788, "size" : 127743372, "simple" : "121.83 MB" }
     > oak.getChildStats('/')
     { "count" : 593191, "size" : 302005011, "simple" : "288.01 MB" }
-    >
\ No newline at end of file
+    >
+    
+For reporting any issue related to Oak the script provides a function to collect important stats and 
+can be dumped to a file
+
+    $ mongo localhost/oak --eval "load('/path/to/oak-mongo.js');printjson(oak.systemStats());" --quiet > oak-stats.json
\ No newline at end of file

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=1617347&r1=1617346&r2=1617347&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 Mon Aug 11 18:50:57 2014
@@ -27,6 +27,20 @@ var oak = (function(global){
         print("Oak Mongo Helpers");
     };
 
+    /**
+     * Collects various stats related to Oak usage of Mongo
+     */
+    api.systemStats = function () {
+        var result = {};
+        result.nodeStats = db.nodes.stats(1024 * 1024);
+        result.blobStats = db.blobs.stats(1024 * 1024);
+        result.clusterStats = db.clusterNodes.find().toArray();
+        result.oakIndexes = db.nodes.find({'_id': /^2\:\/oak\:index\//}).toArray();
+        result.hostInfo = db.hostInfo();
+        result.rootDoc = db.nodes.findOne({'_id' : '0:/'});
+        return result;
+    };
+
     api.indexStats = function () {
         var result = [];
         var totalCount = 0;