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

Don't use ChunkRange in _configsvrCommitChunkSplit error message

    • Fully Compatible
    • ALL
    • Sharding 2020-06-15, Sharding 2020-06-29
    • 5

      This code checks split point boundaries for _configsvrCommitChunkSplit:

      // Verify that splitPoints are not repeated
      >if (endKey.woCompare(startKey) == 0) {
          return {ErrorCodes::InvalidOptions,
                  str::stream() << "Split on lower bound of chunk "
                                << ChunkRange(startKey, endKey).toString() << "is not allowed"};
      }
      

      However, constructing a ChunkRange object with identical values is invalid, and is guaranteed to invariant in debug builds:

      ChunkRange::ChunkRange(BSONObj minKey, BSONObj maxKey)
          : _minKey(std::move(minKey)), _maxKey(std::move(maxKey)) {
          dassert(SimpleBSONObjComparator::kInstance.evaluate(_minKey < _maxKey),
                  str::stream() << "Illegal chunk range: " << _minKey.toString() << ", "
                                << _maxKey.toString());
      }
      

      The error message should instead be constructed using startKey and endKey directly, ie:

          return {ErrorCodes::InvalidOptions,
                  str::stream() << "Split on lower bound of chunk [" << startKey.toString() << ", "
                                << endKey.toString() << ") is not allowed"};
      

            Assignee:
            kshitij.gupta@mongodb.com Kshitij Gupta
            Reporter:
            kevin.pulo@mongodb.com Kevin Pulo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: