Add shell helpers db.fsyncLock() and db.fsyncUnlock() and clean up messages SERVER-2789
This commit is contained in:
@@ -111,7 +111,7 @@ namespace mongo {
|
||||
unsigned x = lockedForWriting;
|
||||
if( x ) {
|
||||
b.append("fsyncLock", x);
|
||||
b.append("info", "use db.$cmd.sys.unlock.findOne() to terminate the fsync write/snapshot lock");
|
||||
b.append("info", "use db.fsyncUnlock() to terminate the fsync write/snapshot lock");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,9 +144,12 @@ namespace mongo {
|
||||
|
||||
void unlockFsync(const char *ns, Message& m, DbResponse &dbresponse) {
|
||||
BSONObj obj;
|
||||
if( ! cc().isAdmin() || strncmp(ns, "admin.", 6) != 0 ) {
|
||||
if ( ! cc().isAdmin() ) { // checks auth
|
||||
obj = fromjson("{\"err\":\"unauthorized\"}");
|
||||
}
|
||||
else if (strncmp(ns, "admin.", 6) != 0 ) {
|
||||
obj = fromjson("{\"err\":\"unauthorized - this command must be run against the admin DB\"}");
|
||||
}
|
||||
else {
|
||||
if( lockedForWriting ) {
|
||||
log() << "command: unlock requested" << endl;
|
||||
|
||||
Reference in New Issue
Block a user