[SERVER-74380] Router role retry loop should allow namespaces different from the one it was created for Created: 24/Feb/23  Updated: 03/Nov/23  Resolved: 10/Apr/23

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 6.0.0-rc0, 6.1.0-rc0, 6.2.0-rc0, 6.3.0-rc0, 7.0.0-rc0
Fix Version/s: 7.0.0-rc0, 6.0.6, 7.0.0-rc1, 6.3.2

Type: Bug Priority: Critical - P2
Reporter: Kevin Cherkauer Assignee: Kaloian Manassiev
Resolution: Fixed Votes: 0
Labels: PM-2144-Milestone-0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File aggregate_3_levels_repro.js    
Issue Links:
Backports
Depends
Related
related to SERVER-74197 StaleConfig exceptions should not esc... Closed
related to SERVER-75923 Complete TODO listed in SERVER-74380 Closed
related to SERVER-75888 Rename StaleEpoch to StaleUpstreamRouter Backlog
Assigned Teams:
Query Execution
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.0, v6.3, v6.0
Steps To Reproduce:

The following steps (or the attached file reproduce the problem):

var st = new ShardingTest({config:1, mongos:1, shards: 1});
var D = st.s0.getDB('D');
 
D.A.insert({Key:1, Value:1});
D.B.insert({Key:1, Value:1});
D.C.insert({Key:1, Value:1});
D.D.insert({Key:1, Value:1});
 
const aggPipeline = [{$lookup: {from: "B", localField: "Key", foreignField: "Value", as:"Joined", pipeline: [{$lookup: {from: "C", localField: "Key", foreignField: "Value", as: "Joined"}},{$lookup: {from: "D", localField: "Key", foreignField: "Value", as: "Joined"}}]}}];
 
// Won't crash
D.A.aggregate(aggPipeline);
 
st.restartShardRS(0);
 
// Will crash
D.A.aggregate(aggPipeline);

Sprint: Sharding EMEA 2023-04-17
Participants:
Linked BF Score: 107

 Description   

Latest analysis in comment

https://jira.mongodb.org/browse/SERVER-74380?focusedCommentId=5307859&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-5307859

is that this problem was injected by Sharding ticket SERVER-63759.



 Comments   
Comment by Githook User [ 25/Apr/23 ]

Author:

{'name': 'Kaloian Manassiev', 'email': 'kaloian.manassiev@mongodb.com', 'username': 'kaloianm'}

Message: SERVER-74380 Do not enforce ErrorExtraInfo for StaleEpoch errors

(cherry picked from commit 24f7e2e1596c0032bc30c2ec03e33f79d31a2e95)
Branch: v6.0
https://github.com/mongodb/mongo/commit/8e3902575657e62c51230d3b0c0ec082839c6341

Comment by Githook User [ 25/Apr/23 ]

Author:

{'name': 'Kaloian Manassiev', 'email': 'kaloian.manassiev@mongodb.com', 'username': 'kaloianm'}

Message: SERVER-74380 Do not enforce ErrorExtraInfo for StaleEpoch errors

(cherry picked from commit 24f7e2e1596c0032bc30c2ec03e33f79d31a2e95)
Branch: v6.3
https://github.com/mongodb/mongo/commit/4024c99abdd5f2f0619f69efb779b788e662fded

Comment by Githook User [ 25/Apr/23 ]

Author:

{'name': 'Kaloian Manassiev', 'email': 'kaloian.manassiev@mongodb.com', 'username': 'kaloianm'}

Message: SERVER-74380 Do not enforce ErrorExtraInfo for StaleEpoch errors

(cherry picked from commit 24f7e2e1596c0032bc30c2ec03e33f79d31a2e95)
Branch: v7.0
https://github.com/mongodb/mongo/commit/132226f0dd4fcf3898523d020f094cdddfab38a4

Comment by Githook User [ 25/Apr/23 ]

Author:

{'name': 'Kaloian Manassiev', 'email': 'kaloian.manassiev@mongodb.com', 'username': 'kaloianm'}

Message: SERVER-74380 Do not enforce ErrorExtraInfo for StaleEpoch errors
Branch: master
https://github.com/mongodb/mongo/commit/24f7e2e1596c0032bc30c2ec03e33f79d31a2e95

Comment by Githook User [ 24/Apr/23 ]

Author:

{'name': 'Kaloian Manassiev', 'email': 'kaloian.manassiev@mongodb.com', 'username': 'kaloianm'}

Message: SERVER-74380 Make the router loop not invariant on unexpected namespaces
Branch: v6.3
https://github.com/mongodb/mongo/commit/47f0809077f85846db4db9e246ad3e8c77720bb6

Comment by Githook User [ 20/Apr/23 ]

Author:

{'name': 'Kaloian Manassiev', 'email': 'kaloian.manassiev@mongodb.com', 'username': 'kaloianm'}

Message: SERVER-74380 Make the router loop not invariant on unexpected namespaces
Branch: v6.0
https://github.com/mongodb/mongo/commit/d3baa192c0048b643e9f664ced15a0fe1cd49e08

Comment by Githook User [ 10/Apr/23 ]

Author:

{'name': 'Kaloian Manassiev', 'email': 'kaloian.manassiev@mongodb.com', 'username': 'kaloianm'}

Message: SERVER-74380 Make the router loop not invariant on unexpected namespaces
Branch: master
https://github.com/mongodb/mongo/commit/1df22fe12f7b5df1a9b215163bdb16f7b5b68235

Comment by Kaloian Manassiev [ 07/Apr/23 ]

After some investigation it appears that the exception on a different namespace comes from the secondary namespaces resolution here. Since the incoming aggregation comes on NS:A, but it contains namespaces B, C and D as secondary namespaces, during this resolution and check whether any of them is unsharded, it is possible that the stale config exception comes not on A, even though the loop specified so.

This is an indication that the current API as implemented in the loop is insufficient since it doesn't provide ability to version multiple collections.

For 6.0 and 7.0, we will just remove the invariants. But for 7.1+ we will have to introduce a better API.

Comment by Kevin Cherkauer [ 29/Mar/23 ]

Injection by SERVER-63759 means this is not a Day One bug but was injected 2022-03-15 into 6.0.0-rc0.

Comment by Kevin Cherkauer [ 14/Mar/23 ]

Possibly related to SERVER-74816.

Generated at Thu Feb 08 06:27:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.