summaryrefslogtreecommitdiff
path: root/src/mongo/s/chunk.cpp
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
commit4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch)
tree1682a647d4463397c119183369ae6f750d5fdcff /src/mongo/s/chunk.cpp
parentaa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff)
parent8f0827553e09872941945a093b647a4211a9db7f (diff)
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0' with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
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