summaryrefslogtreecommitdiff
path: root/src/mongo/s/chunk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/chunk.cpp')
-rw-r--r--src/mongo/s/chunk.cpp36
1 files changed, 4 insertions, 32 deletions
diff --git a/src/mongo/s/chunk.cpp b/src/mongo/s/chunk.cpp
index e141cfea226..e59c9143ecf 100644
--- a/src/mongo/s/chunk.cpp
+++ b/src/mongo/s/chunk.cpp
@@ -107,32 +107,16 @@ void ChunkInfo::throwIfMovedSince(const Timestamp& ts) const {
}
bool ChunkInfo::containsKey(const BSONObj& shardKey) const {
- return _range.containsKey(shardKey);
+ return getMin().woCompare(shardKey) <= 0 && shardKey.woCompare(getMax()) < 0;
}
std::string ChunkInfo::toString() const {
- return toBSON().toString();
-}
-
-BSONObj ChunkInfo::toBSON() const {
- BSONObjBuilder bob;
- _range.append(&bob);
- bob.append("maxKeyString", _maxKeyString);
- bob.append("shardId", _shardId);
- _lastmod.serializeToBSON("lastmod", &bob);
- bob.append("jumbo", _jumbo.load());
- bob.append("bytesWritten", (long long)_writesTracker->getBytesWritten());
-
- BSONArrayBuilder historyArr{bob.subarrayStart("history")};
- for (const auto& historyEntry : _history) {
- historyArr.append(historyEntry.toBSON());
- }
- historyArr.doneFast();
- return bob.obj();
+ return str::stream() << ChunkType::shard() << ": " << _shardId << ", " << ChunkType::lastmod()
+ << ": " << _lastmod.toString() << ", " << _range.toString();
}
void ChunkInfo::markAsJumbo() {
- _jumbo.store(true);
+ _jumbo = true;
}
void Chunk::throwIfMoved() const {
@@ -143,16 +127,4 @@ void Chunk::throwIfMoved() const {
_chunkInfo.throwIfMovedSince(*_atClusterTime);
}
-std::string Chunk::toString() const {
- return toBSON().toString();
-}
-
-BSONObj Chunk::toBSON() const {
- BSONObjBuilder bob;
- bob.append("chunkInfo", _chunkInfo.toBSON());
- bob.append("atClusterTime", _atClusterTime ? _atClusterTime->toBSON() : BSONObj());
- return bob.obj();
-}
-
-
} // namespace mongo