[SERVER-1585] block for replication with wtimeout throws OperationFailure exception Created: 06/Aug/10  Updated: 12/Jul/16  Resolved: 10/Nov/10

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: 1.6.0
Fix Version/s: 1.7.3

Type: Bug Priority: Major - P3
Reporter: Nick Leippe Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

ubuntu 10.4, x86_64


Backwards Compatibility: Minor Change
Operating System: ALL
Participants:

 Description   

python code:

err = db.command("getlasterror",
w = 2, # replicate to at least one slave
wtimeout = 1000 * timeout_s
)

Rather than return an error to be tested, if the above timesout, I get:

File "build/bdist.linux-x86_64/egg/pymongo/database.py", line 294, in command
pymongo.errors.OperationFailure: command SON([('getlasterror', 1), ('wtimeout', 2000), ('w', 2)]) failed: timed out waiting for slaves

If a wtimeout is supplied, that indicates that a timeout is expected behavior--not exceptional behavior.
It should simply return the result in the error object for examination, not throw OperationFailure.



 Comments   
Comment by auto [ 10/Nov/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: on w timeout, don't set ok=0, but set ok=1 and set err SERVER-1585
/mongodb/mongo/commit/5a9526231e9a541adfae8e03b33dc1ba33cc76de

Comment by Eliot Horowitz (Inactive) [ 06/Aug/10 ]

Will change to make ok=1 and set err

Comment by Nick Leippe [ 06/Aug/10 ]

When run in the shell I get:
> db.runCommand(

{"getlasterror": 1, "w": 2, "wtimeout": 2000}

)
{
"err" : null,
"n" : 0,
"wtimeout" : true,
"waited" : 2000,
"errmsg" : "timed out waiting for slaves",
"ok" : 0
}

So this may be a pymongo python driver issue.
My guess is that the driver is looking only at "ok", and not "err" or "n" also.

Comment by Nick Leippe [ 06/Aug/10 ]

Similar to SERVER-1572 inspecting the exception to discover it's simply a timeout is messy.

Generated at Thu Feb 08 02:57:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.