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

Using regex in _id breaks replication

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.4.4, 2.5.0
    • Affects Version/s: 2.4.3
    • Component/s: Replication
    • None
    • ALL

      Steps to reproduce:

      db.user.insert({ _id: 'DA' })
      db.user.insert({ _id: /^D/ })
      

      And watch secondaries exit with:

       m31001| Mon Apr 29 11:50:07.883 [repl writer worker 1] ERROR: writer worker caught exception: cannot change _id of a document old:{ _id: "DA" } new:{ _id: /^D/ } on: { ts: Timestamp 1367250607000|1, h: 6712383419440993268, v: 2, op: "i", ns: "test.user", o: { _id: /^D/ } }
       m31001| Mon Apr 29 11:50:07.883 [repl writer worker 1]   Fatal Assertion 16360
       m31001| 0x1012d732b 0x1012b1e07 0x1011cc7cf 0x1012b9368 0x101309c25 0x7fff92e9b8bf 0x7fff92e9eb75 
       m31001|  0   mongod                              0x00000001012d732b _ZN5mongo15printStackTraceERSo + 43
       m31001|  1   mongod                              0x00000001012b1e07 _ZN5mongo13fassertFailedEi + 151
       m31001|  2   mongod                              0x00000001011cc7cf _ZN5mongo7replset14multiSyncApplyERKSt6vectorINS_7BSONObjESaIS2_EEPNS0_8SyncTailE + 271
       m31001|  3   mongod                              0x00000001012b9368 _ZN5mongo10threadpool6Worker4loopEv + 138
       m31001|  4   mongod                              0x0000000101309c25 thread_proxy + 229
       m31001|  5   libsystem_c.dylib                   0x00007fff92e9b8bf _pthread_start + 335
       m31001|  6   libsystem_c.dylib                   0x00007fff92e9eb75 thread_start + 13
       m31001| Mon Apr 29 11:50:07.912 [repl writer worker 1] 
       m31001| 
       m31001| ***aborting after fassert() failure
       m31001| 
       m31001| 
       m31001| Mon Apr 29 11:50:07.912 Got signal: 6 (Abort trap: 6).
       m31001| 
       m31001| Mon Apr 29 11:50:07.914 Backtrace:
       m31001| 0x1012d732b 0x100e6fab1 0x7fff92eefcfa 0 0x7fff92e8ea7a 0x1012b1e45 0x1011cc7cf 0x1012b9368 0x101309c25 0x7fff92e9b8bf 0x7fff92e9eb75 
       m31001|  0   mongod                              0x00000001012d732b _ZN5mongo15printStackTraceERSo + 43
       m31001|  1   mongod                              0x0000000100e6fab1 _ZN5mongo10abruptQuitEi + 225
       m31001|  2   libsystem_c.dylib                   0x00007fff92eefcfa _sigtramp + 26
       m31001|  3   ???                                 0x0000000000000000 0x0 + 0
       m31001|  4   libsystem_c.dylib                   0x00007fff92e8ea7a abort + 143
       m31001|  5   mongod                              0x00000001012b1e45 _ZN5mongo13fassertFailedEi + 213
       m31001|  6   mongod                              0x00000001011cc7cf _ZN5mongo7replset14multiSyncApplyERKSt6vectorINS_7BSONObjESaIS2_EEPNS0_8SyncTailE + 271
       m31001|  7   mongod                              0x00000001012b9368 _ZN5mongo10threadpool6Worker4loopEv + 138
       m31001|  8   mongod                              0x0000000101309c25 thread_proxy + 229
       m31001|  9   libsystem_c.dylib                   0x00007fff92e9b8bf _pthread_start + 335
       m31001|  10  libsystem_c.dylib                   0x00007fff92e9eb75 thread_start + 13
      

      Similarly if you have the two documents above in your primary and do:

      db.user.remove({ $type: 11 }, false);
      

      It will be converted into an oplog entry:

      { "ts" : Timestamp(1367252013, 1), "h" : NumberLong("-2940784610233179223"), "v" : 2, "op" : "d", "ns" : "test.user", "b" : true, "o" : { "_id" : /^D/ } }
      

      And deletes the documents matching the regex in the secondaries!

            Assignee:
            milkie@mongodb.com Eric Milkie
            Reporter:
            randolph@mongodb.com Randolph Tan
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: