[SERVER-58104] config.system.sessions collection can end up with invalid chunks if it is dropped and re-sharded with a shard key other than _id Created: 25/Jun/21  Updated: 29/Oct/23  Resolved: 08/Oct/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 3.6 Required, 4.2.18, 4.0.28, 4.4.10

Type: Bug Priority: Major - P3
Reporter: Cheahuychou Mao Assignee: Jonathan Lee
Resolution: Fixed Votes: 0
Labels: sharding-wfbf-day
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Problem/Incident
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4, v4.2, v4.0, v3.6
Sprint: Sharding 2021-09-20, Sharding 2021-10-04, Sharding 2021-10-18
Participants:
Linked BF Score: 85

 Description   

The balancer assumes that the sessions collection is always sharded by _id. So the split points it uses are always computed based on _id.id. So if a the sessions collection is dropped, and re-sharded with a shard key other than _id, the balancer will end up creating invalid chunks (the _configsvrCommitChunkSplit command does not verify that the requested split points have the expected shard key pattern). This issue exists in 3.6, 4.0, 4.2 and 4.4 since prior to SERVER-35804 users are not banned from dropping collections in the config database.

We can solve this by doing one of the following:



 Comments   
Comment by Githook User [ 07/Oct/21 ]

Author:

{'name': 'Jonathan Lee', 'email': 'jonathan.lee@mongodb.com', 'username': 'jonatlee'}

Message: SERVER-58104 Prevent the balancer from calculating split points in sessions collection if shard key is not _id

(cherry picked from commit 9a12a55346e0da77acc94797bf5a558b001188e0)
Branch: v4.0
https://github.com/mongodb/mongo/commit/db0d66c2fe43edffeb3aa72f6f51aa23e5882036

Comment by Githook User [ 07/Oct/21 ]

Author:

{'name': 'Jonathan Lee', 'email': 'jonathan.lee@mongodb.com', 'username': 'jonatlee'}

Message: Revert "SERVER-58104 Prevent the balancer from calculating split points in sessions collection if shard key is not _id"

This reverts commit 01549c7e5d425f48c5c9533d2655e20d992d9eef.
Branch: v4.0
https://github.com/mongodb/mongo/commit/932f1c7180a0bdae321bdccefaecb2bf15053761

Comment by Githook User [ 06/Oct/21 ]

Author:

{'name': 'Jonathan Lee', 'email': 'jonathan.lee@mongodb.com', 'username': 'jonatlee'}

Message: SERVER-58104 Prevent the balancer from calculating split points in sessions collection if shard key is not _id

(cherry picked from commit 9a12a55346e0da77acc94797bf5a558b001188e0)
Branch: v4.0
https://github.com/mongodb/mongo/commit/01549c7e5d425f48c5c9533d2655e20d992d9eef

Comment by Githook User [ 17/Sep/21 ]

Author:

{'name': 'Jonathan Lee', 'email': 'jonathan.lee@mongodb.com', 'username': 'jonatlee'}

Message: SERVER-58104 Prevent the balancer from calculating split points in sessions collection if shard key is not _id

(cherry picked from commit 9a12a55346e0da77acc94797bf5a558b001188e0)
Branch: v4.2
https://github.com/mongodb/mongo/commit/ea6a39b5dce5b3f1a34a3259f3c8534a218ccff1

Comment by Githook User [ 17/Sep/21 ]

Author:

{'name': 'Jonathan Lee', 'email': 'jonathan.lee@mongodb.com', 'username': 'jonatlee'}

Message: SERVER-58104 Prevent the balancer from calculating split points in sessions collection if shard key is not _id
Branch: v4.4
https://github.com/mongodb/mongo/commit/9a12a55346e0da77acc94797bf5a558b001188e0

Generated at Thu Feb 08 05:43:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.