[SERVER-48211] Don't use ChunkRange in _configsvrCommitChunkSplit error message Created: 14/May/20  Updated: 29/Oct/23  Resolved: 23/Jun/20

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

Type: Bug Priority: Minor - P4
Reporter: Kevin Pulo Assignee: Kshitij Gupta
Resolution: Fixed Votes: 0
Labels: sharding-interns-2020
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding 2020-06-15, Sharding 2020-06-29
Participants:
Linked BF Score: 5

 Description   

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"};



 Comments   
Comment by Githook User [ 23/Jun/20 ]

Author:

{'name': 'Kshitij Gupta', 'email': 'kshitij.gupta@mongodb.com', 'username': 'kshitijng'}

Message: SERVER-48211: Fix incorrect usage of ChunkRange
Branch: master
https://github.com/mongodb/mongo/commit/5d604bc927c8143ce73d3cd664f1c50ea03e4e6e

Generated at Thu Feb 08 05:16:28 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.