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

Remove keyPatternObj from splitChunk and splitChunkCommand logic

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor - P4
    • Resolution: Unresolved
    • Affects Version/s: 3.5.10
    • Fix Version/s: Backlog
    • Component/s: Sharding
    • Labels:
    • Backwards Compatibility:
      Fully Compatible

      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.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: