[SERVER-30128] Remove keyPatternObj from splitChunk and splitChunkCommand logic Created: 13/Jul/17  Updated: 06/Dec/22  Resolved: 01/Dec/21

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

Type: Improvement Priority: Minor - P4
Reporter: Hugh Han Assignee: [DO NOT USE] Backlog - Sharding Team
Resolution: Won't Do Votes: 0
Labels: sharding
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Sharding
Participants:

 Description   

The KeyPattern of a particular shard can be fetched using the following call.

ScopedCollectionMetadata collMetada;
KeyPattern shardKeyPattern(collMetadata->getKeyPattern());

Hence, it is unnecessary that the split chunk command must take in a BSONObj called keyPatternObj, as in the following code block.

BSONObj keyPatternObj;
{
    BSONElement keyPatternElem;
    auto keyPatternStatus =
        bsonExtractTypedField(cmdObj, "keyPattern", Object, &keyPatternElem);
 
    if (!keyPatternStatus.isOK()) {
        errmsg = "need to specify the key pattern the collection is sharded over";
        return false;
    }
    keyPatternObj = keyPatternElem.Obj();
}

This keyPatternObj parameter can most likely be removed completely from the split chunk command.


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