Created
June 20, 2013 09:51
-
-
Save thanosa75/5821569 to your computer and use it in GitHub Desktop.
fsyncLock and Unlock are stackable!!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mongo localhost:27018 | |
MongoDB shell version: 2.4.3 | |
connecting to: localhost:27018/test | |
dev-mcs-01:SECONDARY> serverIsLocked = function () { | |
... var co = db.currentOp(); | |
... if (co && co.fsyncLock) { | |
... return true; | |
... } | |
... return false; | |
... } | |
function () { | |
var co = db.currentOp(); | |
if (co && co.fsyncLock) { | |
return true; | |
} | |
return false; | |
} | |
dev-mcs-01:SECONDARY> serverIsLocked() | |
false <---- the server reports not locked | |
dev-mcs-01:SECONDARY> db.fsyncLock() | |
{ | |
"info" : "now locked against writes, use db.fsyncUnlock() to unlock", | |
"seeAlso" : "http://dochub.mongodb.org/core/fsynccommand", | |
"ok" : 1 | |
} | |
dev-mcs-01:SECONDARY> serverIsLocked() | |
true <---- server is now LOCKED | |
dev-mcs-01:SECONDARY> db.fsyncUnlock() | |
{ "ok" : 1, "info" : "unlock completed" } | |
dev-mcs-01:SECONDARY> serverIsLocked() | |
false <---- server is UNLOCKED, all cool. | |
dev-mcs-01:SECONDARY> db.fsyncLock() | |
{ | |
"info" : "now locked against writes, use db.fsyncUnlock() to unlock", | |
"seeAlso" : "http://dochub.mongodb.org/core/fsynccommand", | |
"ok" : 1 | |
} <---- one lock | |
dev-mcs-01:SECONDARY> db.fsyncLock() | |
{ | |
"info" : "now locked against writes, use db.fsyncUnlock() to unlock", | |
"seeAlso" : "http://dochub.mongodb.org/core/fsynccommand", | |
"ok" : 1 | |
} <---- two locks | |
dev-mcs-01:SECONDARY> db.fsyncLock() | |
{ | |
"info" : "now locked against writes, use db.fsyncUnlock() to unlock", | |
"seeAlso" : "http://dochub.mongodb.org/core/fsynccommand", | |
"ok" : 1 | |
} <---- three locks | |
dev-mcs-01:SECONDARY> serverIsLocked() | |
true <---- server is locked, cool!!! | |
dev-mcs-01:SECONDARY> db.fsyncUnlock() | |
{ "ok" : 1, "info" : "unlock completed" } | |
dev-mcs-01:SECONDARY> serverIsLocked() | |
true <---- NOT COOL, fsyncUnlock() reports "unlock completed" and "ok" : 1 but not unlocked!!!! | |
dev-mcs-01:SECONDARY> db.fsyncUnlock() | |
{ "ok" : 1, "info" : "unlock completed" } | |
dev-mcs-01:SECONDARY> serverIsLocked() | |
true <---- NOT COOL, fsyncUnlock() reports "unlock completed" and "ok" : 1 but not unlocked!!!! | |
dev-mcs-01:SECONDARY> db.fsyncUnlock() | |
{ "ok" : 1, "info" : "unlock completed" } | |
dev-mcs-01:SECONDARY> serverIsLocked() | |
false <---- 3 locks need 3 unlocks!!!!!! NOT MENTIONED ANYWHERE!!!!!! | |
dev-mcs-01:SECONDARY> db.fsyncUnlock() | |
{ "ok" : 0, "errmsg" : "not locked" } | |
dev-mcs-01:SECONDARY> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment