ISSUE SUMMARY
A write command error message contains an incorrect collection name when a collection creation fails.
USER IMPACT
Error diagnosis confusion. Users relying on the write error return strings can parse the wrong collection name.
WORKAROUNDS
None.
RESOLUTION
Corrected the collection name in the error message.
AFFECTED VERSIONS
Version 2.6.0 is affected by this bug.
PATCHES
The patch is included in the 2.6.1 production release.
Original description
On line 939, the 'could not create collection' message appends request->getNS(). It should append request->getTargetingNS() instead, given the preceding createCollection call.
I don't see an obvious way to trigger the bug, so I just manually patched batch_executor.cpp to verify that the wrong namespace is being used in the message.
src/mongo/db/commands/write_commands/batch_executor.cpp:
932 _collection = database->getCollection(request->getTargetingNS()); 933 if (!_collection) { 934 // Implicitly create if it doesn't exist 935 _collection = database->createCollection(request->getTargetingNS()); 936 if (!_collection) { 937 result->setError( 938 toWriteError(Status(ErrorCodes::InternalError, 939 "could not create collection " + request->getNS()))); 940 return false; 941 } }
Version: bafd9c7e0e39f86d251271517f518a24acb853c5
- links to