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

mongooplog skips drop operations

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.2.0-rc1
    • Affects Version/s: None
    • Component/s: Tools
    • Labels:
      None
    • ALL

      Not sure if this is "works as designed" but if so, it should probably be documented as such because it seems like it has the potential to create an unexpected state on the destination host.

      I create two replica sets: replset0 has a primary on localhost:4000 and replset1 has a primary on localhost:4003.

      On replset0, i insert a bunch of docs, drop the collection, insert a bunch more docs:

      replset0:PRIMARY> for(var i=0;i<100;i++){ db.test.insert({"x":i}) }
      replset0:PRIMARY> db.test.count()
      100
      replset0:PRIMARY> db.test.drop()
      true
      replset0:PRIMARY> db.test.count()
      0
      replset0:PRIMARY> for(var i=0;i<100;i++){ db.test.insert({"x":i}) }
      replset0:PRIMARY> db.test.count()
      100
      

      Then replay operations from replset0 onto replset1:

      mongooplog --from localhost:4000 --host localhost:4003
      connected to: localhost:4003
      Fri Jul 27 16:14:57 [oplogreplay] going to connect
      Fri Jul 27 16:14:57 [oplogreplay] connected
      Fri Jul 27 16:14:57 [oplogreplay] starting from Jul 26 16:14:57:0
      skipping: { ts: Timestamp 1343420072000|1, h: -2847272704779079313, op: "c", ns: "test.$cmd", o: { drop: "test" } }
      

      Not clear on why it is "skipping" the drop operation here.

      Then I check the contents of the collection on replset1:

      connecting to: localhost:4003/test
      replset1:PRIMARY> db.test.count()
      200
      

      I expected the destination host to have the same # of docs (100) as the source, but it has more because the drop operation was apparently not executed.

      Edit:
      It looks like database drop commands are skipped as well:

      connected to: localhost:4003
      Sat Jul 28 15:23:57 [oplogreplay] going to connect
      Sat Jul 28 15:23:57 [oplogreplay] connected
      Sat Jul 28 15:23:57 [oplogreplay] starting from Jul 27 15:23:57:0
      skipping: { ts: Timestamp 1343503437000|1, h: 3555166822529716989, op: "c", ns: "test.$cmd", o: { dropDatabase: 1 } }
      F
      ======================================================================
      FAIL: test_drops (__main__.TestMongoOplogTool)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "./rs2test.py", line 131, in test_drops
          self.assertNotIn("test", self.y_primary.database_names())
      AssertionError: 'test' unexpectedly found in [u'local', u'test', u'admin']
      

            Assignee:
            randolph@mongodb.com Randolph Tan
            Reporter:
            mikeo@mongodb.com Michael O'Brien
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: