[SERVER-9875] Possible to accidentally create duplicate indexes which corrupts database Created: 07/Jun/13 Updated: 16/Jun/13 Resolved: 07/Jun/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Index Maintenance |
| Affects Version/s: | 2.4.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Jimmy Jones | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
RHEL 5, CentOS 6.4 |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Operating System: | ALL | ||||||||
| Steps To Reproduce: | See attached script - basically it create two slightly different indexes with the same name, which hoses the database. Might need to tweak it to add more records if your server is faster than mine. |
||||||||
| Participants: | |||||||||
| Description |
|
My loader scripts call ensureIndex to allow the database to automatically be generated, however it turns out that the current release of the perl API doesn't support the expiresAfterSecond argument, which I discovered after creating the index. Therefore I remove the index and created one in the background from the mongo console. Meanwhile my script restarted, which resulted in the database becoming corrupted (luckily recover did succeed). Have distilled out the underlying issue in an attached script. |
| Comments |
| Comment by Jimmy Jones [ 16/Jun/13 ] |
|
Thanks - looks as if it went into the release last week (0.701.4) |
| Comment by Asya Kamsky [ 16/Jun/13 ] |
|
jimmyjones2 - the index is called 'expireAfterSeconds' and not 'expiresAfterSeconds' - looks like Perl driver added support for it in April: https://github.com/mongodb/mongo-perl-driver/commit/f7a8846bfa633302b2957f7678ed93c6c87c3b6f#lib/MongoDB/Collection.pm as option "expire_after_seconds". This is unrelated to the actual server bug you found, but in response to creating a TTL index via the Perl driver. |
| Comment by Scott Hernandez (Inactive) [ 07/Jun/13 ] |
|
Thanks for the report. We have this down and scheduled here: The root cause is the (concurrent) background index creation. |