Michael Conigliaro
unread,Apr 7, 2011, 3:11:24 PM4/7/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongodb-user
So I just had MongoDB segfault on me while it was building an index.
Replica set failover worked properly, but the index did not exist yet
on the slave (which is now the master), so I decided to recreate the
index on that machine manually.
Next I looked at the old master (now the slave) and found that the
index actually did exist, despite the fact that it never finished
getting built. So I attempted to drop and recreate that index
manually. Of course, this didn't work, because setSlaveOk never works
for anything useful I want to do on a slave...
db.getMongo().setSlaveOk();
db.userEventsJournal.dropIndex({"adId":1, "eventId":1, "variationId":
1});
{ "errmsg" : "not master", "ok" : 0 }
OK, so then I decided to try the reindex command on the collection:
3:SECONDARY> db.runCommand( { reIndex :
'userEventsJournal' } )
{
"nIndexesWas" : 2,
"msg" : "indexes dropped for collection",
"errmsg" : "exception: no index name specified",
"code" : 12523,
"ok" : 0
}
3:SECONDARY>
db.userEventsJournal.getIndexes()
[ ]
Oops! So apparently, MongoDB will allow you to drop indexes on a
slave, but it won't actually let you create them. Wonderful. Anyone
have any tips for me? Or do I definitely have to promote this machine
to a master before recreating the indexes?