0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

if you do w=2 with no write, should just return ok

This commit is contained in:
Eliot Horowitz 2011-01-17 23:44:57 -05:00
parent fd1addeab9
commit c400248eb9

View File

@ -156,6 +156,11 @@ namespace mongo {
while ( 1 ) {
OpTime op(c.getLastOp());
if ( op.isNull() ) {
result.append( "wnote" , "no write has been done on this connection" );
break;
}
// check this first for w=0 or w=1
if ( opReplicatedEnough( op, w ) )
break;
@ -167,10 +172,6 @@ namespace mongo {
return true;
}
if ( op.isNull() ) {
result.append( "err" , "no write has been done on this connection" );
return true;
}
if ( timeout > 0 && t.millis() >= timeout ) {
result.append( "wtimeout" , true );