summaryrefslogtreecommitdiff
path: root/src/mongo/shell
diff options
context:
space:
mode:
authorBilly Donahue <billy.donahue@mongodb.com>2017-11-14 13:08:28 -0500
committerBilly Donahue <billy.donahue@mongodb.com>2017-11-27 17:06:59 -0500
commit42fe228abc27664f630cbafe932ffaf2b12eccb8 (patch)
treea48e3a9081ce2952ada601028cd0e377374a1441 /src/mongo/shell
parent64ec315a09f162772b7d0191a03267c23231a7e8 (diff)
downloadmongo-42fe228abc27664f630cbafe932ffaf2b12eccb8.tar.gz
SERVER-30062 remove storageDetails wrappers from shell
Diffstat (limited to 'src/mongo/shell')
-rw-r--r--src/mongo/shell/collection.js166
1 files changed, 0 insertions, 166 deletions
diff --git a/src/mongo/shell/collection.js b/src/mongo/shell/collection.js
index 452a2361f30..072700fbf49 100644
--- a/src/mongo/shell/collection.js
+++ b/src/mongo/shell/collection.js
@@ -143,10 +143,6 @@ DBCollection.prototype.help = function() {
".unsetWriteConcern( <write concern doc> ) - unsets the write concern for writes to the collection");
print("\tdb." + shortName +
".latencyStats() - display operation latency histograms for this collection");
- // print("\tdb." + shortName + ".getDiskStorageStats({...}) - prints a summary of disk usage
- // statistics");
- // print("\tdb." + shortName + ".getPagesInRAM({...}) - prints a summary of storage pages
- // currently in physical memory");
return __magicNoPrint;
};
@@ -807,168 +803,6 @@ DBCollection.prototype.validate = function(full) {
return res;
};
-/**
- * Invokes the storageDetails command to provide aggregate and (if requested) detailed information
- * regarding the layout of records and deleted records in the collection extents.
- * getDiskStorageStats provides a human-readable summary of the command output
- */
-DBCollection.prototype.diskStorageStats = function(opt) {
- var cmd = {storageDetails: this.getName(), analyze: 'diskStorage'};
- if (typeof(opt) == 'object')
- Object.extend(cmd, opt);
-
- var res = this._db.runCommand(cmd);
- if (!res.ok && res.errmsg.match(/no such cmd/)) {
- print("this command requires starting mongod with --enableExperimentalStorageDetailsCmd");
- }
- return res;
-};
-
-// Refer to diskStorageStats
-DBCollection.prototype.getDiskStorageStats = function(params) {
- var stats = this.diskStorageStats(params);
- if (!stats.ok) {
- print("error executing storageDetails command: " + stats.errmsg);
- return;
- }
-
- print("\n " + "size".pad(9) + " " + "# recs".pad(10) + " " +
- "[===occupied by BSON=== ---occupied by padding--- free ]" + " " +
- "bson".pad(8) + " " + "rec".pad(8) + " " + "padding".pad(8));
- print();
-
- var BAR_WIDTH = 70;
-
- var formatSliceData = function(data) {
- var bar = _barFormat(
- [
- [data.bsonBytes / data.onDiskBytes, "="],
- [(data.recBytes - data.bsonBytes) / data.onDiskBytes, "-"]
- ],
- BAR_WIDTH);
-
- return sh._dataFormat(data.onDiskBytes).pad(9) + " " + data.numEntries.toFixed(0).pad(10) +
- " " + bar + " " + (data.bsonBytes / data.onDiskBytes).toPercentStr().pad(8) + " " +
- (data.recBytes / data.onDiskBytes).toPercentStr().pad(8) + " " +
- (data.recBytes / data.bsonBytes).toFixed(4).pad(8);
- };
-
- var printExtent = function(ex, rng) {
- print("--- extent " + rng + " ---");
- print("tot " + formatSliceData(ex));
- print();
- if (ex.slices) {
- for (var c = 0; c < ex.slices.length; c++) {
- var slice = ex.slices[c];
- print(("" + c).pad(3) + " " + formatSliceData(slice));
- }
- print();
- }
- };
-
- if (stats.extents) {
- print("--- extent overview ---\n");
- for (var i = 0; i < stats.extents.length; i++) {
- var ex = stats.extents[i];
- print(("" + i).pad(3) + " " + formatSliceData(ex));
- }
- print();
- if (params && (params.granularity || params.numberOfSlices)) {
- for (var i = 0; i < stats.extents.length; i++) {
- printExtent(stats.extents[i], i);
- }
- }
- } else {
- printExtent(stats, "range " + stats.range);
- }
-
-};
-
-/**
- * Invokes the storageDetails command to report the percentage of virtual memory pages of the
- * collection storage currently in physical memory (RAM).
- * getPagesInRAM provides a human-readable summary of the command output
- */
-DBCollection.prototype.pagesInRAM = function(opt) {
- var cmd = {storageDetails: this.getName(), analyze: 'pagesInRAM'};
- if (typeof(opt) == 'object')
- Object.extend(cmd, opt);
-
- var res = this._db.runCommand(cmd);
- if (!res.ok && res.errmsg.match(/no such cmd/)) {
- print("this command requires starting mongod with --enableExperimentalStorageDetailsCmd");
- }
- return res;
-};
-
-// Refer to pagesInRAM
-DBCollection.prototype.getPagesInRAM = function(params) {
- var stats = this.pagesInRAM(params);
- if (!stats.ok) {
- print("error executing storageDetails command: " + stats.errmsg);
- return;
- }
-
- var BAR_WIDTH = 70;
- var formatExtentData = function(data) {
- return "size".pad(8) + " " + _barFormat([[data.inMem, '=']], BAR_WIDTH) + " " +
- data.inMem.toPercentStr().pad(7);
- };
-
- var printExtent = function(ex, rng) {
- print("--- extent " + rng + " ---");
- print("tot " + formatExtentData(ex));
- print();
- if (ex.slices) {
- print("\tslices, percentage of pages in memory (< .1% : ' ', <25% : '.', " +
- "<50% : '_', <75% : '=', >75% : '#')");
- print();
- print("\t" + "offset".pad(8) + " [slices...] (each slice is " +
- sh._dataFormat(ex.sliceBytes) + ")");
- line = "\t" + ("" + 0).pad(8) + " [";
- for (var c = 0; c < ex.slices.length; c++) {
- if (c % 80 == 0 && c != 0) {
- print(line + "]");
- line = "\t" + sh._dataFormat(ex.sliceBytes * c).pad(8) + " [";
- }
- var inMem = ex.slices[c];
- if (inMem <= .001)
- line += " ";
- else if (inMem <= .25)
- line += ".";
- else if (inMem <= .5)
- line += "_";
- else if (inMem <= .75)
- line += "=";
- else
- line += "#";
- }
- print(line + "]");
- print();
- }
- };
-
- if (stats.extents) {
- print("--- extent overview ---\n");
- for (var i = 0; i < stats.extents.length; i++) {
- var ex = stats.extents[i];
- print(("" + i).pad(3) + " " + formatExtentData(ex));
- }
- print();
- if (params && (params.granularity || params.numberOfSlices)) {
- for (var i = 0; i < stats.extents.length; i++) {
- printExtent(stats.extents[i], i);
- }
- } else {
- print("use getPagesInRAM({granularity: _bytes_}) or " +
- "getPagesInRAM({numberOfSlices: _num_} for details");
- print("use pagesInRAM(...) for json output, same parameters apply");
- }
- } else {
- printExtent(stats, "range " + stats.range);
- }
-};
-
DBCollection.prototype.getShardVersion = function() {
return this._db._adminCommand({getShardVersion: this._fullName});
};