Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-8640

$setOnInsert of field existing in upsert query triggers verify assertion in Mod::apply()

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.4.0-rc1
    • Affects Version/s: None
    • Component/s: Write Ops
    • None
    • ALL

      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
      

            Assignee:
            alerner Alberto Lerner
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: