[SERVER-67240] TTL monitor races with shard merge importing donor collection step, leading to recipient TTL monitor stopped monitoring imported donor collection with ttl index. Created: 13/Jun/22 Updated: 29/Oct/23 Resolved: 21/Oct/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 6.2.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Suganthi Mani | Assignee: | Christopher Caplinger |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Backwards Compatibility: | Fully Compatible | ||||
| Operating System: | ALL | ||||
| Sprint: | Server Serverless 2022-10-17, Server Serverless 2022-10-31 | ||||
| Participants: | |||||
| Linked BF Score: | 12 | ||||
| Description |
|
Below is the racy scenario: 1) Importer thread: Shard merge imports a donor collection, say 'tenant.foo', with TTL index. Then, it calls ownedCollection->init(opCtx); which initializes the in-memory data structure that holds the collection info (including the indexes info).init() method would in-turn make the *'tenant.foo' donor collection to get registered with TTL monitor *using the donor collection uuid. 2) TTL monitor: Wakes from sleep, do another TTL pass and now notices 'tenant.foo' donor collection to be monitor. So, now it would query the in-memory collection catalog registry using the donor collection uuid to access the in-memory collection info data structure and couldn't find the entry. So, it thinks the collection is dropped and deregisters 'tenant.foo' donor collection' from TTL monitor. 3) Importer thread: Now, this step in import donor collection would make the collection to get registered with in-memory collection catalog registry. |
| Comments |
| Comment by Githook User [ 21/Oct/22 ] |
|
Author: {'name': 'Christopher Caplinger', 'email': 'christopher.caplinger@mongodb.com', 'username': 'UnicodeSnowman'}Message: |
| Comment by Henrik Edin [ 12/Oct/22 ] |
|
Thanks suganthi.mani@mongodb.com. I believe the fix is to register the index with the TTL monitor in a commit handler at which the Collection is fully committed into the CollectionCatalog. |
| Comment by Suganthi Mani [ 11/Oct/22 ] |
|
Just noting down, this is a problem even for live import (Shard merge is a copied code from live import). So CC'ing execution team leads for more visibility louis.williams@mongodb.com henrik.edin@mongodb.com Actually, the live import copied the primary createCollection cmd code logic and it's not a problem over there because when the collection is created initially, there won't be any active index entries in on-disk mdbCatalog collection whereas Shard merge and live import can have it as they use file copy based cloning. |