diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-12-26 00:23:52 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-12-26 00:24:07 -0500 |
commit | 199a261ba1c12fe7264205e51ce6d49abc326c99 (patch) | |
tree | 290f66e4c23fca0496617d2f2cd08a137965d3c7 /db | |
parent | f68273ffd74fcbb5238146008141336ea214eb4c (diff) | |
download | mongo-199a261ba1c12fe7264205e51ce6d49abc326c99.tar.gz |
fix getLastError handling for non-repl nodes
Diffstat (limited to 'db')
-rw-r--r-- | db/dbcommands.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/db/dbcommands.cpp b/db/dbcommands.cpp index facacf5827f..12049dced7c 100644 --- a/db/dbcommands.cpp +++ b/db/dbcommands.cpp @@ -147,21 +147,27 @@ namespace mongo { Timer t; int w = e.numberInt(); - + long long passes = 0; char buf[32]; while ( 1 ){ OpTime op(c.getLastOp()); + + if ( opReplicatedEnough( op, w ) ) + break; + // if replication isn't enabled (e.g., config servers) - if ( op.isNull() ) { + if ( ! anyReplEnabled() ){ errmsg = "replication not enabled"; result.append( "err", "norepl" ); return true; } - if ( opReplicatedEnough( op, w ) ) - break; - + 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 ); errmsg = "timed out waiting for slaves"; |