[SERVER-7580] PHP getLastError wrong when Sharding Created: 07/Nov/12 Updated: 15/Feb/13 Resolved: 19/Nov/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 2.2.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Blocker - P1 |
| Reporter: | Dwayne Bull | Assignee: | Kristina Chodorow (Inactive) |
| Resolution: | Duplicate | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Ubuntu |
||
| Issue Links: |
|
||||||||
| Operating System: | Linux | ||||||||
| Participants: | |||||||||
| Description |
|
getLastError returning old/wrong/no data. The code that we are running works 100% when not sharded. We have a 3 shard setup, each shard with 3 servers in a replica set. 3 config servers and 1 mongos running on the application server. All querys are using safemode. After going an update with a query that would match 0 documents the following is returned via getLastError() "singleShard":"Set_01\/db1.test.co.uk,db5.test.co.uk,db9.test.co.uk", , However, no documents will have been updated so n=1 should be wrong as well as updatedExsisting. When using a query that does match a document ( and does successfully update), occasionally we will get the following from getLastError() "singleShard":"Set_02\/db2.test.co.uk,db6.test.co.uk,db7.test.co.uk", , , , "lastOp" is sometimes the same, if that means anything? |
| Comments |
| Comment by Kristina Chodorow (Inactive) [ 19/Nov/12 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Looks like this is a known issue: https://jira.mongodb.org/browse/SERVER-4532, please track/comment there, so we can keep all the info together in one place. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dwayne Bull [ 09/Nov/12 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I've setup the server to log all querys so I should have more data on the 0 docs n=1 soon. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Kristina Chodorow (Inactive) [ 08/Nov/12 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks! You can't reproduce #1 (the update matching 0 documents returning n=1) consistently, though, right? (If I'm correct about that, it would really be helpful to get an explain right after you get an unexpected result, although I understand that can be hard to set up. If not, that's fantastic, it should be fairly easy to track down!) Still looking to 2. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dwayne Bull [ 08/Nov/12 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
1) Here is an Explain on a based on your point 1, I've used the same query as in point 2 ( further down ) but replaced the r.m.c variable so it will not match any documents ( nor will it match anything connected directly ):
2) Here is a result from a successful update but with the wrong error (result is the call to getLastError):
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Kristina Chodorow (Inactive) [ 08/Nov/12 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
1. When you get n=1 on something you don't expect to exist, can you run an explain on the query (db.someColl.find(criteria).explain())? If you connect directly to the shard and repeat the query, does it still exist? 2. What does the update look like for the second example (n=0)? I can't actually find a code path that gives that result. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dwayne Bull [ 08/Nov/12 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I'm afraid not, the issue only appeared once we started hammering the database with real data on our production setup, so we can't isolate all the code needed to reproduce it. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Eliot Horowitz (Inactive) [ 08/Nov/12 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Do you have a test program that can cause this? |