[SERVER-54507] Can't execute $merge if sharding catalog cache is empty Created: 12/Feb/21 Updated: 29/Oct/23 Resolved: 07/May/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 4.4.4 |
| Fix Version/s: | 5.0.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Tommaso Tocci | Assignee: | Eric Cox (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||
| Backport Requested: |
v4.9, v4.4, v4.2, v4.0
|
||||||||||||||||||||||||
| Steps To Reproduce: | Even though it can be reproduced by a far more easy test case, I've been able to reproduce consistently this bug by just flushing the cache for the target collection in jstests/sharding/query/merge_write_concern.js before to execute the $merge aggregation command. |
||||||||||||||||||||||||
| Sprint: | Query Execution 2021-03-08, Query Execution 2021-03-22, Query Execution 2021-04-05, Query Execution 2021-04-19, Query Execution 2021-05-03, Query Execution 2021-05-17 | ||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Linked BF Score: | 145 | ||||||||||||||||||||||||
| Description |
|
Manifestation of the bug: The impossibility to execute the $merge pipeline stage Consider the case in which the $merge pipeline stage is executed in a shard that:
(This is possible because the sharding catalog cache is a LRU cache in which not frequently used entries can be evicted.) The shard executes DocumentSourceMerge::createFromBson() that triggers a call to MongoProcessInterface::ensureFieldsUniqueOrResolveDocumentKey(). This function in the end throws a StaleConfigInfo because the target collection is not present in the cache. The error is correctly handled by the shard that will execute the onShardVersionMismatch() procedure. Since the CollectionShardingState already contains the latest shard version for the target collection no action will be taken and no refresh of the catalog cache will be triggered. In other words if the CollectionShardingState is up to date, the StaleConfigInfo won't guarantee that the catalog cache will be refreshed. |
| Comments |
| Comment by Githook User [ 01/Jul/21 ] |
|
Author: {'name': 'Eric Cox', 'email': 'eric.cox@mongodb.com', 'username': 'ericox'}Message: |
| Comment by Githook User [ 07/May/21 ] |
|
Author: {'name': 'Eric Cox', 'email': 'eric.cox@mongodb.com', 'username': 'ericox'}Message: |