summaryrefslogtreecommitdiff
path: root/src/mongo/db/dbcommands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/dbcommands.cpp')
-rw-r--r--src/mongo/db/dbcommands.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp
index 8d1eec45eb0..9a1bfca0228 100644
--- a/src/mongo/db/dbcommands.cpp
+++ b/src/mongo/db/dbcommands.cpp
@@ -241,6 +241,13 @@ namespace mongo {
break;
}
+ if ( !_isMaster() ) {
+ // this should be in the while loop in case we step down
+ errmsg = "not master";
+ result.append( "wnote", "no longer primary" );
+ return false;
+ }
+
// check this first for w=0 or w=1
if ( opReplicatedEnough( op, e ) ) {
break;