[SERVER-80886] $out may fail with a StaleDbVersion after a movePrimary Created: 08/Sep/23  Updated: 29/Dec/23  Resolved: 03/Oct/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 7.0.1, 4.4.24, 6.0.10, 5.0.21, 7.1.0-rc2
Fix Version/s: 7.1.1, 7.2.0-rc0, 7.0.3, 6.0.12, 5.0.24, 4.4.28

Type: Bug Priority: Major - P3
Reporter: Silvia Surroca Assignee: Jordi Serra Torrens
Resolution: Fixed Votes: 0
Labels: shardingemea-qw
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Assigned Teams:
Sharding EMEA
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.1, v7.0, v6.0, v5.0, v4.4
Sprint: Sharding EMEA 2023-10-02, Sharding EMEA 2023-10-16
Participants:
Story Points: 3

 Description   

If $out runs over a sharded collection after a movePrimary operation, $out will fail constantly with a StaleDbVersion until another operation refreshes the DbVersion on the new primary shard.

Events sequence leading to the bug:

  • shard0 is the primary shard for mydb database.
  • The sharded collection mydb.collA has chunks on shard0 and shard1
  • A movePrimary for mydb is executed and the new primary is shard1.
  • A $out operation over mydb.collA is launched and is redirected to shard1 as the primary of mydb.
  • $out executes listCollection command here targeting shard0 because shard1 thinks it's the primary shard for mydb.
  • The listCollection command fails with StaleDbVersion as expected and shard1 forwards the error to the router, so it never refreshes the DbVersion.


 Comments   
Comment by Githook User [ 29/Dec/23 ]

Author:

{'name': 'Jordi Serra Torrens', 'email': 'jordi.serra-torrens@mongodb.com', 'username': 'jordist'}

Message: SERVER-80886 Wrap ShardServerProcessInterface routing-like code with shardVersionRetry

(cherry picked from commit 060c42eccc4006a96db28f0b498ce9920e718783)

GitOrigin-RevId: 1df48bc5aae460ca39c107463f9a3edbcd3e4d20
Branch: v4.4
https://github.com/mongodb/mongo/commit/b4b3ae12a1566a5141efd59d51f2731baa66dec7

Comment by Githook User [ 29/Dec/23 ]

Author:

{'name': 'Jordi Serra Torrens', 'email': 'jordist@users.noreply.github.com', 'username': 'jordist'}

Message: SERVER-80886 Wrap ShardServerProcessInterface routing-like code with shardVersionRetry (#17802)

GitOrigin-RevId: 060c42eccc4006a96db28f0b498ce9920e718783
Branch: v5.0
https://github.com/mongodb/mongo/commit/2ac17898ea22572ac686ca26b1fc68750ae83a17

Comment by Githook User [ 19/Oct/23 ]

Author:

{'name': 'Jordi Serra Torrens', 'email': 'jordi.serra-torrens@mongodb.com', 'username': 'jordist'}

Message: SERVER-80886 Wrap ShardServerProcessInterface routing-like code with DBPrimaryRouter

(cherry picked from commit fff4dbf400d1f85e47fe84b21c668d4d26570f3a)
Branch: v6.0
https://github.com/mongodb/mongo/commit/e513cd7df412a9d8c2b656ff88035160b1085457

Comment by Githook User [ 19/Oct/23 ]

Author:

{'name': 'Jordi Serra Torrens', 'email': 'jordi.serra-torrens@mongodb.com', 'username': 'jordist'}

Message: SERVER-80886 Wrap ShardServerProcessInterface routing-like code with DBPrimaryRouter

(cherry picked from commit fff4dbf400d1f85e47fe84b21c668d4d26570f3a)
Branch: v7.1
https://github.com/mongodb/mongo/commit/b301df7c32728102a2e42508c1b79fb90f84e1de

Comment by Githook User [ 19/Oct/23 ]

Author:

{'name': 'Jordi Serra Torrens', 'email': 'jordi.serra-torrens@mongodb.com', 'username': 'jordist'}

Message: SERVER-80886 Wrap ShardServerProcessInterface routing-like code with DBPrimaryRouter

(cherry picked from commit fff4dbf400d1f85e47fe84b21c668d4d26570f3a)
Branch: v7.0
https://github.com/mongodb/mongo/commit/5445fe8e9237d85a17cb840e8a1c54f8b28a0337

Comment by Githook User [ 03/Oct/23 ]

Author:

{'name': 'Jordi Serra Torrens', 'email': 'jordi.serra-torrens@mongodb.com', 'username': 'jordist'}

Message: SERVER-80886 Wrap ShardServerProcessInterface routing-like code with DBPrimaryRouter
Branch: master
https://github.com/mongodb/mongo/commit/fff4dbf400d1f85e47fe84b21c668d4d26570f3a

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