MongoDB 3.2.10 Index rebuilding did not complete: 11000 E11000 duplicate key error collection

errorsmongodbreplication

MongoDB 3.2.10

Getting the following error when adding a replica set as WiredTiger. This is sharded cluster ( 3 shards nodes ).

2 Shards replica sets created using wiredTiger storage so only 1 shard is having a problem when creating the replica set.

2016-11-11T00:51:55.005+0000 I -     [initandlisten]   Index Build: 39291000/39372845 99%
2016-11-11T00:51:58.032+0000 I -     [initandlisten]   Index Build: 39345000/39372845 99%
2016-11-11T00:52:04.696+0000 E INDEX [initandlisten] Index rebuilding did not complete: 11000 E11000 duplicate key error collection: XYZ.ALBUM index: _id_                                                                         dup key: { : 59000012923579 }
2016-11-11T00:52:04.696+0000 I INDEX [initandlisten] note: restart the server with --noIndexBuildRetry to skip index rebuilds
2016-11-11T00:52:04.696+0000 I -     [initandlisten] Fatal Assertion 26100
2016-11-11T00:52:04.696+0000 I -     [initandlisten]

I did not have issue when I was using mmapv1 replica set but now I have dropped old replica set.

How to fix this issue?

Best Answer

I have deleted all data from dbpath and again restarted replica set sync and it looks it is going fine now. I was trying to restart a failed replica set sync and it looks like MongoDB was not able to handle it, once I cleaned up failed replica set data and restart mongo and looks like it is passed point where it was failing before.

Basically,I have removed host from relica set configuration, cleanup dbpath, restarted mongo and again added host in replica set configuration.