Tokutek / mongo

TokuMX is a high-performance, concurrent, compressing, drop-in replacement engine for MongoDB | Issue tracker: https://tokutek.atlassian.net/browse/MX/ |
http://www.tokutek.com/products/tokumx-for-mongodb/
704 stars 97 forks source link

Unique Background Indexes #1216

Open angelo0000 opened 9 years ago

angelo0000 commented 9 years ago

I am trying to work on a migration from my existing mongo 2.4.x to TokuMX and noticed some odd behavior. My application is a node app that leverages Mongoose as the ORM. When my server starts, I see all my ensure indexes fire off as I would expect when pointing to a vanilla mongo setup. When I point it at a toku instance I don't see all my indexes being created.

After some digging it looks like TokuMX complains when you try to create a unique index that is set to background true. Why is that? Mongo 2.4.x does not have this issue.

I also found this: https://github.com/Tokutek/mongo/issues/1091 (this is the issue where this behavior was added to toku).

angelo0000 commented 9 years ago

It says in the docs for 2.4 that mongo can create multiple bg indexes now without a problem: http://docs.mongodb.org/v2.4/core/index-creation/#behavior

angelo0000 commented 9 years ago

I just setup a docker image with mongo 2.6 and one with mongo 3.0rc8 and it seems it is behaving like toku... not sure what is different in 2.4 vs 2.6+ that would cause this.

michaeldauria commented 9 years ago

This is b/c a unique index requires a collection lock, therefore rather than locking up and not telling you, it won't let you get into a bad situation.

angelo0000 commented 9 years ago

I'm not following you... At the time I wrote this Toku was based on Mongo 2.4 which does allow a unique index to be created as background true. Here is the link to the does that explain this behavior: http://docs.mongodb.org/v2.4/core/index-creation/#behavior

angelo0000 commented 9 years ago

Maybe 2.4 just ignored the bg true and did it in the foreground.