[SERVER-14527] MongoDB servers processes should only setLastError when wire writes or write commands fail. Created: 10/Jul/14 Updated: 11/Sep/14 Resolved: 14/Jul/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | 2.7.4 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Andy Schwerin | Assignee: | Andy Schwerin |
| Resolution: | Done | Votes: | 1 |
| Labels: | cap-ticket-needed | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Minor Change | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
MongoDB servers only promise that getLastError returns meaningful information about errors in wire-protocol writes or write commands. For finds, getmores and all other commands, the error component of getLastError has unspecified meaning. By setting the lastError information higher in the call stack, when we know they won't be swallowed, we can make lastError more sensible, and also break the triangle dependency between the lasterror, network and foundation libraries. This changes the behavior from prior versions of MongoDB, in which servers occasionally set the last error information in non-write commands and failed find operations. However, the servers were not consistent about the conditions in which they would set the information, as drivers were not expected to consult it. |
| Comments |
| Comment by Andy Schwerin [ 14/Jul/14 ] |
|
The change effected in this ticket alters the error-checking behavior of getLastError only in cases where its behavior is unspecified (after non-write commands and regular finds and getmores). |
| Comment by Githook User [ 14/Jul/14 ] |
|
Author: {u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}Message: MongoD and MongoS set it explicitly for write commands and wire writes, and in the |
| Comment by Githook User [ 14/Jul/14 ] |
|
Author: {u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}Message: Also in the forceerror command. These are the only places where we promise to set |
| Comment by Githook User [ 14/Jul/14 ] |
|
Author: {u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@mongodb.com'}Message: Commands are not guaranteed to set last error, except for the write commands and forceerror. |