[SERVER-52911] A lock-free read must not be able to acquire old in-memory Collection state and new on-disk collection state between a MODE_X operation storage write and onCommit handler CollectionCatalog updates Created: 17/Nov/20 Updated: 27/Oct/23 Resolved: 04/Dec/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Storage |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Dianna Hohensee (Inactive) | Assignee: | Henrik Edin |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Sprint: | Execution Team 2020-12-14 |
| Participants: |
| Description |
|
This will only be a problem for lock-free reads, that bypass the atomicity of a collection MODE_X locked catalog operation A lock free read can momentarily see an old version of the in-memory Collection state and a newer version of the on-disk collection state |
| Comments |
| Comment by Henrik Edin [ 04/Dec/20 ] |
|
Closing this as WAD. Has brainstormed with Dianna and Benety and don't believe this is causing any issue with lock free reads. createIndex: the index would be avaliable in the storage snapshot but not in the in-memory collection/index catalog. A query would simply not use the index which is fine. createCollection is protected by Collection::isCommitted and is not causing a problem. dropIndex/dropCollection is using the ident reaper and we're still holding a reference to the ident so it won't actually be removed from the storage engine collMod operations are affecting writes not reads, like the Validator. If this does not match it is not causing a problem. Last when we assert that durable state is matching the in-memory catalog we are holding locks so this is not affecting lock free reads. Example: https://github.com/mongodb/mongo/blob/46befe17d5d41b52808af01ef680a3405e113792/src/mongo/db/catalog/database_impl.cpp#L498-L499 |