[SERVER-8640] $setOnInsert of field existing in upsert query triggers verify assertion in Mod::apply() Created: 20/Feb/13  Updated: 11/Jul/16  Resolved: 21/Feb/13

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: None
Fix Version/s: 2.4.0-rc1

Type: Bug Priority: Major - P3
Reporter: Aaron Staple Assignee: Alberto Lerner
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

Test

c = db.c;
c.drop();
c.update( { a:1 }, { $setOnInsert:{ a:2 } }, true );

Output

Wed Feb 20 13:51:16.234 [conn1] CMD: drop test.c
Wed Feb 20 13:51:31.011 [conn1]  test.c Assertion failure false src/mongo/db/ops/update_internal.cpp 121
0x10bce9c55 0x10bcad16b 0x10bc8b829 0x10b8ba258 0x10b8d4bfa 0x10b8bfe2a 0x10b8c07cb 0x10b8c149f 0x10b8c1e23 0x10b8aed1a 0x10b8afdf0 0x10b7fa014 0x10b7ff73d 0x10b4032bf 0x10bcce910 0x10bcccee1 0x10bcccf46 0x10bcccf81 0x10bd5f439 0x7fff8514f8bf 
 0   mongod                              0x000000010bce9c55 _ZN5mongo15printStackTraceERSo + 37
 1   mongod                              0x000000010bcad16b _ZN5mongo10logContextEPKc + 123
 2   mongod                              0x000000010bc8b829 _ZN5mongo12verifyFailedEPKcS1_j + 409
 3   mongod                              0x000000010b8ba258 _ZNK5mongo3Mod5applyERNS_15BSONBuilderBaseENS_11BSONElementERNS_8ModStateE + 352
 4   mongod                              0x000000010b8d4bfa _ZN5mongo8ModState5applyERNS_15BSONBuilderBaseENS_11BSONElementE + 74
 5   mongod                              0x000000010b8bfe2a _ZN5mongo11ModSetState17createNewFromModsERKSsRNS_15BSONBuilderBaseERNS_18BSONIteratorSortedERKSt4pairIKSt17_Rb_tree_iteratorIS7_IS1_N5boost10shared_ptrINS_8ModStateEEEEESF_ERKNS_9LexNumCmpE + 5618
 6   mongod                              0x000000010b8c07cb _ZN5mongo11ModSetState20createNewObjFromModsERKSsRNS_14BSONObjBuilderERKNS_7BSONObjE + 167
 7   mongod                              0x000000010b8c149f _ZN5mongo11ModSetState17createNewFromModsEv + 181
 8   mongod                              0x000000010b8c1e23 _ZN5mongo6ModSet18createNewFromQueryERKNS_7BSONObjE + 1767
 9   mongod                              0x000000010b8aed1a _ZN5mongo14_updateObjectsEbPKcRKNS_7BSONObjES4_bbbRNS_7OpDebugEPNS_11RemoveSaverEbRKNS_24QueryPlanSelectionPolicyEb + 11642
 10  mongod                              0x000000010b8afdf0 _ZN5mongo13updateObjectsEPKcRKNS_7BSONObjES4_bbbRNS_7OpDebugEbRKNS_24QueryPlanSelectionPolicyE + 224
 11  mongod                              0x000000010b7fa014 _ZN5mongo14receivedUpdateERNS_7MessageERNS_5CurOpE + 2052
 12  mongod                              0x000000010b7ff73d _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 2445
 13  mongod                              0x000000010b4032bf _ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE + 261
 14  mongod                              0x000000010bcce910 _ZN5mongo17PortMessageServer17handleIncomingMsgEPv + 2384
 15  mongod                              0x000000010bcccee1 _ZN5boost3_bi5list1INS0_5valueIPN5mongo17PortMessageServer22HandleIncomingMsgParamEEEEclIPvPFSA_SA_ENS0_5list0EEET_NS0_4typeISE_EERT0_RT1_l + 79
 16  mongod                              0x000000010bcccf46 _ZN5boost3_bi6bind_tIPvPFS2_S2_ENS0_5list1INS0_5valueIPN5mongo17PortMessageServer22HandleIncomingMsgParamEEEEEEclEv + 82
 17  mongod                              0x000000010bcccf81 _ZN5boost6detail11thread_dataINS_3_bi6bind_tIPvPFS4_S4_ENS2_5list1INS2_5valueIPN5mongo17PortMessageServer22HandleIncomingMsgParamEEEEEEEE3runEv + 37
 18  mongod                              0x000000010bd5f439 thread_proxy + 169
 19  libsystem_c.dylib                   0x00007fff8514f8bf _pthread_start + 335
Wed Feb 20 13:51:31.060 [conn1] update test.c query: { a: 1.0 } update: { $setOnInsert: { a: 2.0 } } nscanned:0 keyUpdates:0 exception: assertion src/mongo/db/ops/update_internal.cpp:121 locks(micros) w:50020 50ms



 Comments   
Comment by auto [ 21/Feb/13 ]

Author:

{u'date': u'2013-02-21T16:53:37Z', u'name': u'Alberto Lerner', u'email': u'alerner@10gen.com'}

Message: SERVER-8640 Took $setOnInsert test out of the sharding passthrough suite.
Branch: master
https://github.com/mongodb/mongo/commit/a8b4d76306f231df8a1c85625a8d9ee20ae1d2cf

Comment by auto [ 21/Feb/13 ]

Author:

{u'date': u'2013-02-21T00:47:13Z', u'name': u'Alberto Lerner', u'email': u'alerner@10gen.com'}

Message: SERVER-8640 Fixed $setOnInsert over a field created by the query portion of an upsert.
Branch: master
https://github.com/mongodb/mongo/commit/d856f64418940934a2e0c110c6da05b3ba0f4549

Generated at Thu Feb 08 03:17:58 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.