Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-30128

Remove keyPatternObj from splitChunk and splitChunkCommand logic

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Do
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.5.10
    • Component/s: Sharding
    • Labels:
    • Sharding

      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.

            Assignee:
            backlog-server-sharding [DO NOT USE] Backlog - Sharding Team
            Reporter:
            hugh.han Hugh Han
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: