summaryrefslogtreecommitdiff
path: root/src/mongo/shell
diff options
context:
space:
mode:
authorAdam Midvidy <amidvidy@gmail.com>2015-03-24 10:45:04 -0400
committerAdam Midvidy <amidvidy@gmail.com>2015-03-25 15:00:03 -0400
commit5c48ea0d3fd6556eb0ba7686a9da6159f0814d08 (patch)
tree6c32840fcf8d45a4ee70adf419ca2bb7390171c2 /src/mongo/shell
parentbbe95e94bc7231a0b06c395a52c6575d7d23e03e (diff)
downloadmongo-5c48ea0d3fd6556eb0ba7686a9da6159f0814d08.tar.gz
SERVER-7775 refactor fsyncUnlock to execute through standard command path
Diffstat (limited to 'src/mongo/shell')
-rw-r--r--src/mongo/shell/db.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/shell/db.js b/src/mongo/shell/db.js
index 48e086ad9f6..9a6c5399067 100644
--- a/src/mongo/shell/db.js
+++ b/src/mongo/shell/db.js
@@ -975,7 +975,14 @@ DB.prototype.fsyncLock = function() {
}
DB.prototype.fsyncUnlock = function() {
- return this.getSiblingDB("admin").$cmd.sys.unlock.findOne()
+ var res = this.adminCommand({fsyncUnlock: 1});
+ if (!res.ok &&
+ // handle both error messages for nonexistent command...
+ (res.errmsg.startsWith("no such cmd") || res.errmsg.startsWith("no such command"))) {
+ // fallback for old servers
+ res = this.getSiblingDB("admin").$cmd.sys.unlock.findOne();
+ }
+ return res;
}
DB.autocomplete = function(obj){