summaryrefslogtreecommitdiff
path: root/src/mongo/s/catalog/type_chunk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/catalog/type_chunk.cpp')
-rw-r--r--src/mongo/s/catalog/type_chunk.cpp51
1 files changed, 1 insertions, 50 deletions
diff --git a/src/mongo/s/catalog/type_chunk.cpp b/src/mongo/s/catalog/type_chunk.cpp
index b9736e478b4..9e78e767649 100644
--- a/src/mongo/s/catalog/type_chunk.cpp
+++ b/src/mongo/s/catalog/type_chunk.cpp
@@ -47,7 +47,6 @@ const NamespaceString ChunkType::ConfigNS("config.chunks");
const std::string ChunkType::ShardNSPrefix = "config.cache.chunks.";
const BSONField<OID> ChunkType::name("_id");
-const BSONField<std::string> ChunkType::legacyName("_id");
const BSONField<BSONObj> ChunkType::minShardID("_id");
const BSONField<std::string> ChunkType::ns("ns");
const BSONField<BSONObj> ChunkType::min("min");
@@ -216,14 +215,9 @@ StatusWith<ChunkType> ChunkType::parseFromConfigBSONCommand(const BSONObj& sourc
Status status = bsonExtractOIDField(source, name.name(), &chunkID);
if (status.isOK()) {
chunk._id = chunkID;
- } else if (status == ErrorCodes::NoSuchKey || status == ErrorCodes::TypeMismatch) {
+ } else if (status == ErrorCodes::NoSuchKey) {
// Ignore NoSuchKey because when chunks are sent in commands they are not required to
// include it.
- //
- // Ignore TypeMismatch for compatibility with binaries 4.2 and earlier, since the _id
- // type was changed from string to OID.
- //
- // TODO SERVER-44034: Stop ignoring TypeMismatch.
} else {
return status;
}
@@ -308,11 +302,6 @@ StatusWith<ChunkType> ChunkType::fromConfigBSON(const BSONObj& source) {
Status status = bsonExtractOIDField(source, name.name(), &chunkID);
if (status.isOK()) {
chunk._id = chunkID;
- } else if (status == ErrorCodes::TypeMismatch) {
- // The format of _id changed between 4.2 and 4.4 so for compatibility with chunks
- // created in earlier versions we ignore TypeMismatch.
- //
- // TODO SERVER-44034: Stop ignoring TypeMismatch.
} else {
return status;
}
@@ -342,26 +331,6 @@ BSONObj ChunkType::toConfigBSON() const {
return builder.obj();
}
-BSONObj ChunkType::toConfigBSONLegacyID() const {
- BSONObjBuilder builder;
- if (_nss && _min)
- builder.append(name.name(), genLegacyID(*_nss, *_min));
- if (_nss)
- builder.append(ns.name(), getNS().ns());
- if (_min)
- builder.append(min.name(), getMin());
- if (_max)
- builder.append(max.name(), getMax());
- if (_shard)
- builder.append(shard.name(), getShard().toString());
- if (_version)
- _version->appendLegacyWithField(&builder, ChunkType::lastmod());
- if (_jumbo)
- builder.append(jumbo.name(), getJumbo());
- addHistoryToBSON(builder);
- return builder.obj();
-}
-
StatusWith<ChunkType> ChunkType::fromShardBSON(const BSONObj& source, const OID& epoch) {
ChunkType chunk;
@@ -547,22 +516,4 @@ std::string ChunkType::toString() const {
return toConfigBSON().toString();
}
-std::string ChunkType::genLegacyID(const NamespaceString& nss, const BSONObj& o) {
- StringBuilder buf;
- buf << nss.ns() << "-";
-
- BSONObjIterator i(o);
- while (i.more()) {
- BSONElement e = i.next();
- buf << e.fieldName() << "_" << e.toString(false, true);
- }
-
- return buf.str();
-}
-
-std::string ChunkType::getLegacyName() const {
- invariant(_nss && _min);
- return genLegacyID(*_nss, *_min);
-}
-
} // namespace mongo