Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-2002

mongorestore --oplogReplay failed on createIndexes command

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.0.0-rc0
    • Affects Version/s: 3.6.3
    • Component/s: mongodump, mongorestore
    • None
    • 2
    • v3.6

      I try to make point-of-time recovery by applying oplog to database snapshot.
      Unfortunately mongorestore fails on createIndexes command.

      Server logs:

      2018-04-06T17:57:32.442+0300 I NETWORK  [listener] connection accepted from 127.0.0.1:60784 #3 (1 connection now open)
      2018-04-06T17:57:32.445+0300 E REPL     [conn3] Failed command { createIndexes: "bar", v: 2, key: { a: 1.0, b: 1.0 }, name: "a_1_b_1" } on foo with status InvalidUUID: uuid must be a 16-byte binary field with UUID (4) subtype during oplog application
      2018-04-06T17:57:32.445+0300 I COMMAND  [conn3] applyOps error applying: InvalidUUID: uuid must be a 16-byte binary field with UUID (4) subtype
      2018-04-06T17:57:32.447+0300 I NETWORK  [conn3] end connection 127.0.0.1:60784 (0 connections now open)
      

      Client logs:

      bozaro@ip-192-168-172-62:~$ mongorestore --oplogReplay --oplogFile dump/local/oplog.rs.bson --dir empty
      2018-04-06T17:57:32.443+0300	preparing collections to restore from
      2018-04-06T17:57:32.444+0300	replaying oplog
      2018-04-06T17:57:32.445+0300	Failed: restore error: error applying oplog: applyOps: applyOps had one or more errors applying ops
      

      Oplog content:

      bozaro@ip-192-168-172-62:~$ bsondump dump/local/oplog.rs.bson
      {"ts":{"$timestamp":{"t":1523025563,"i":1}},"h":{"$numberLong":"7088377125738954147"},"v":2,"op":"n","ns":"","wall":{"$date":"2018-04-06T14:39:23.283Z"},"o":{"msg":"initiating set"}}
      {"ts":{"$timestamp":{"t":1523025565,"i":1}},"t":{"$numberLong":"1"},"h":{"$numberLong":"3165455701337222133"},"v":2,"op":"n","ns":"","wall":{"$date":"2018-04-06T14:39:25.370Z"},"o":{"msg":"new primary"}}
      {"ts":{"$timestamp":{"t":1523025565,"i":2}},"t":{"$numberLong":"1"},"h":{"$numberLong":"-905140846109544102"},"v":2,"op":"c","ns":"config.$cmd","ui":{"$binary":"5MOBARk3QtibNc33oVbMAg==","$type":"04"},"wall":{"$date":"2018-04-06T14:39:25.436Z"},"o":{"create":"transactions","idIndex":{"v":2,"key":{"_id":1},"name":"_id_","ns":"config.transactions"}}}
      {"ts":{"$timestamp":{"t":1523025565,"i":3}},"t":{"$numberLong":"1"},"h":{"$numberLong":"8642836913557709929"},"v":2,"op":"c","ns":"admin.$cmd","ui":{"$binary":"KRdkv238TGaBlsPoBoL6Ag==","$type":"04"},"wall":{"$date":"2018-04-06T14:39:25.505Z"},"o":{"create":"system.keys","idIndex":{"v":2,"key":{"_id":1},"name":"_id_","ns":"admin.system.keys"}}}
      {"ts":{"$timestamp":{"t":1523025565,"i":4}},"t":{"$numberLong":"1"},"h":{"$numberLong":"-1917051267983588720"},"v":2,"op":"i","ns":"admin.system.keys","ui":{"$binary":"KRdkv238TGaBlsPoBoL6Ag==","$type":"04"},"wall":{"$date":"2018-04-06T14:39:25.505Z"},"o":{"_id":{"$numberLong":"6541344992646922241"},"purpose":"HMAC","key":{"$binary":"Tahl7hMNmbTBv/xa1PFF0fa7f5c=","$type":"00"},"expiresAt":{"$timestamp":{"t":1530801565,"i":0}}}}
      {"ts":{"$timestamp":{"t":1523025565,"i":5}},"t":{"$numberLong":"1"},"h":{"$numberLong":"-6874457807744212067"},"v":2,"op":"i","ns":"admin.system.keys","ui":{"$binary":"KRdkv238TGaBlsPoBoL6Ag==","$type":"04"},"wall":{"$date":"2018-04-06T14:39:25.531Z"},"o":{"_id":{"$numberLong":"6541344992646922242"},"purpose":"HMAC","key":{"$binary":"+FQ4/IZ6cfV7DsKg0j3jbWiBAkk=","$type":"00"},"expiresAt":{"$timestamp":{"t":1538577565,"i":0}}}}
      {"ts":{"$timestamp":{"t":1523025585,"i":1}},"t":{"$numberLong":"1"},"h":{"$numberLong":"1618131305220388165"},"v":2,"op":"n","ns":"","wall":{"$date":"2018-04-06T14:39:45.444Z"},"o":{"msg":"periodic noop"}}
      {"ts":{"$timestamp":{"t":1523025595,"i":1}},"t":{"$numberLong":"1"},"h":{"$numberLong":"2828349489151786398"},"v":2,"op":"n","ns":"","wall":{"$date":"2018-04-06T14:39:55.447Z"},"o":{"msg":"periodic noop"}}
      {"ts":{"$timestamp":{"t":1523025597,"i":1}},"t":{"$numberLong":"1"},"h":{"$numberLong":"-5096157782949267825"},"v":2,"op":"c","ns":"foo.$cmd","ui":{"$binary":"ji4QhMx+TAyyn4Lud2x02A==","$type":"04"},"wall":{"$date":"2018-04-06T14:39:57.122Z"},"o":{"create":"bar","idIndex":{"v":2,"key":{"_id":1},"name":"_id_","ns":"foo.bar"}}}
      {"ts":{"$timestamp":{"t":1523025597,"i":2}},"t":{"$numberLong":"1"},"h":{"$numberLong":"2167891964410316880"},"v":2,"op":"c","ns":"foo.$cmd","ui":{"$binary":"ji4QhMx+TAyyn4Lud2x02A==","$type":"04"},"wall":{"$date":"2018-04-06T14:39:57.179Z"},"o":{"createIndexes":"bar","v":2,"key":{"a":1.0,"b":1.0},"name":"a_1_b_1"}}
      {"ts":{"$timestamp":{"t":1523025615,"i":1}},"t":{"$numberLong":"1"},"h":{"$numberLong":"-167815867778163089"},"v":2,"op":"n","ns":"","wall":{"$date":"2018-04-06T14:40:15.453Z"},"o":{"msg":"periodic noop"}}
      2018-04-06T18:00:15.150+0300	11 objects found
      

        1. oplog.bson
          2 kB
        2. createIndexes.bson
          0.2 kB

            Assignee:
            david.golden@mongodb.com David Golden
            Reporter:
            bozaro Artem
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: