[SERVER-42106] Use auto-generated _ids for config.chunks and config.tags Created: 08/Jul/19  Updated: 29/Oct/23  Resolved: 22/Jul/19

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 4.3.1

Type: Task Priority: Major - P3
Reporter: Jack Mulrow Assignee: James Heppenstall (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-14759 Splitting very close to an existing d... Closed
Duplicate
is duplicated by SERVER-8829 String representation for chunk id is... Closed
Problem/Incident
Backwards Compatibility: Fully Compatible
Sprint: Sharding 2019-07-15, Sharding 2019-07-29
Participants:

 Description   

The _id values for documents in config.chunks and config.tags are currently a concatenation of each document’s namespace and minimum bound. Refining a shard key will change the minimum bound, and because _id is immutable, this would require a delete and insert for each document. To allow updating every document in each collection with a single multi-update, the _id values for these documents will be changed to be auto-generated object ids.

In particular:

  1. Remove all uses of ChunkType::genId() and replace any queries on _id with equivalent queries on ns and min, which should use the existing min_1_ns_1 index.
  2. Store a chunk's _id as a new OID member variable in ChunkType, which corresponds to the existing "name" BSONField
    • e.g. make _id the return value of ChunkType::getName() and allow setting it through ChunkType::setName()
  3. Add a new parser to ChunkType that will not throw if the _id is not found in the given BSONObj and use it in BalanceChunkRequestType::parseFromConfigCommand()
  4. Change moveChunk, mergeChunk, and splitChunk to use the generated _ids of the involved chunks when constructing the updates to config.chunks for their applyOps commands and make splitChunk use OID::gen() to generate _ids for new chunks (necessary because splitChunk uses an upsert to create new chunks)
  5. Replace config.tags queries on _id with equivalent queries on ns and min, which should use the existing min_1_ns_1 index.
  6. Move the logic from ChunkType::genId() to a new method on MigrationType so MigrationType can continue generating its _id by concatenating namespace and min bound.


 Comments   
Comment by Githook User [ 22/Jul/19 ]

Author:

{'name': 'Jamie Heppenstall', 'email': 'jamie.heppenstall@mongodb.com', 'username': 'JamesHeppenstall'}

Message: SERVER-42106 Use auto-generated _ids for config.chunks and config.tags
Branch: master
https://github.com/mongodb/mongo/commit/2455e412e3ee165e71ff6403ac33ac2e8f35d823

Comment by Githook User [ 22/Jul/19 ]

Author:

{'name': 'Jamie Heppenstall', 'email': 'jamie.heppenstall@mongodb.com', 'username': 'JamesHeppenstall'}

Message: SERVER-42106 Use auto-generated _ids for config.chunks and config.tags
Branch: master
https://github.com/mongodb/mongo/commit/cdbb41b4c4663c5263d9351b55e5d285837b17cc

Generated at Thu Feb 08 04:59:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.