getLastError Returns Wrong Error

58 views
Skip to first unread message

Keith Bourgoin

unread,
Jul 31, 2012, 12:50:51 PM7/31/12
to mongod...@googlegroups.com
Hey there,

We've been dealing with this problem for a long time and don't know a way around it.  We have a somewhat high traffic database with notablescan turned on.  Sometimes an index won't get there in time, or there's a flat out programming mistake and it throws an error.  This is all well and good and the desired behavior.

The problem we have is that other clients connected to the database get the same error.  Here's the rough sequence of events that just happened to me:
  • ssh into machine, run queries using mongo CLI. Accidentally trigger a tablescan error. Mongo throws an error.
  • A minute later, on a different machine, a cron job starts, fires a query (ensureIndex, IIRC) against a different database and gets the same error.
To reiterate, the script tries to ensure an index on a different database from a different mongos instance, but gets the same error back, crashing the process.

Yes, I can catch this error and retry the operation, and that's generally the approach we've taken, but this behavior seems rather ridiculous.  Is there a way to stop this from happening? I'd really rather not get errors that come from a completely different session and process.

Any help would be greatly appreciated.

Keith.

Stephen Steneker

unread,
Aug 1, 2012, 1:38:43 AM8/1/12
to mongod...@googlegroups.com
The problem we have is that other clients connected to the database get the same error.  Here's the rough sequence of events that just happened to me:
  • ssh into machine, run queries using mongo CLI. Accidentally trigger a tablescan error. Mongo throws an error.
  • A minute later, on a different machine, a cron job starts, fires a query (ensureIndex, IIRC) against a different database and gets the same error.
To reiterate, the script tries to ensure an index on a different database from a different mongos instance, but gets the same error back, crashing the process.

Hi Keith,

What version of MongoDB are you using?

Cheers,
Stephen

Stephen Steneker

unread,
Aug 9, 2012, 5:15:30 AM8/9/12
to mongod...@googlegroups.com
Hi Keith,

A more relevant question I should have asked is what MongoDB driver are you using, and how you managing connections?

If you are using connection pooling and calling the getLastError() command directly, you could be getting the error from a previous command that had used the same connection.

Cheers,
Stephen
Reply all
Reply to author
Forward
0 new messages