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

verify assertion when new version of a document is requested that does not match dotted field expression of original query; excessive logging

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 2.2.1, 2.3.0
    • Affects Version/s: 2.2.0
    • Component/s: Write Ops
    • None
    • Linux

      The update version of findAndModify attempts to find the new version of a document using a modified version of the original query (queryModified). A dotted field expression may be copied from the original query to queryModified, but if that field is changed by the update the constraint on that field may cause the match to fail and prevent the new version of the document from being found. (And this causes the verify to fire.)

      Test

      c = db.c;
      c.drop();
      
      c.save( { a:{ b:1 } } );
      c.findAndModify( { query:{ 'a.b':1 },
                         update:{ $set:{ 'a.b':2 } }, // Ensure the query on 'a.b' no longer matches.          
                         new:true } );
      

      It also looks like there is a debugging log line in the code:

      log() << "queryModified: " << queryModified << endl;
      

      – Aaron

      -----------------------------------------------

      My logs are filled with the following:
      [conn<X>] queryModified:

      { _id: <any id> }

      And, occasionally:
      [conn<M>] queryModified: { _id: <id>, $atomic: true, f.o:

      { $exists: false }

      }
      [conn<N>] <collection> Assertion failure Helpers::findOne( ns.c_str() , queryModified , doc ) src/mongo/db/commands/find_and_modify.cpp 184

      The resulting error is: exception: assertion src/mongo/db/commands/find_and_modify.cpp:184 (response:

      { "errmsg" : "exception: assertion src/mongo/db/commands/find_and_modify.cpp:184", "code" : 0, "ok" : 0.0 }

      )

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            onyxmaster Aristarkh Zagorodnikov
            Votes:
            4 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved: