summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergi Mateo Bellido <sergi.mateo-bellido@mongodb.com>2022-03-31 12:26:42 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-03-31 13:07:34 +0000
commit1dd40ad6ed8aa8a636e7de003185444d04810f75 (patch)
treef06fd62de1eacf46c49d8c75bacafa27f1f4eb8e /src
parentb38acb905dfbfa2be7df1d0b786c0a274e68b0df (diff)
downloadmongo-1dd40ad6ed8aa8a636e7de003185444d04810f75.tar.gz
Revert "SERVER-63363 Fixing parsing of ChunkVersion"
This reverts commit e98dc4a89c55c0c391b1a6d1ef6a4be92328cfe9. Looking for a different way of fixing this problem!
Diffstat (limited to 'src')
-rw-r--r--src/mongo/s/chunk_version.cpp16
-rw-r--r--src/mongo/s/chunk_version_test.cpp2
2 files changed, 5 insertions, 13 deletions
diff --git a/src/mongo/s/chunk_version.cpp b/src/mongo/s/chunk_version.cpp
index 2a075c2937b..e162bed1a72 100644
--- a/src/mongo/s/chunk_version.cpp
+++ b/src/mongo/s/chunk_version.cpp
@@ -92,11 +92,9 @@ ChunkVersion ChunkVersion::_parseArrayOrObjectPositionalFormat(const BSONObj& ob
timestamp =
(epoch == UNSHARDED().epoch() ? UNSHARDED().getTimestamp() : IGNORED().getTimestamp());
} else {
- // TODO (SERVER-64813): remove this code once 6.0 becomes lastLTS
- // Hack to solve a complex problem related to the addition of the timestamp in 5.0
- uasserted(ErrorCodes::StaleShardVersion,
- str::stream() << "Failed to parse " << obj.toString()
- << " as a ChunkVersion because it is missing the timestamp field.");
+ uasserted(ErrorCodes::TypeMismatch,
+ str::stream() << "Invalid type " << nextElem.type()
+ << " for version timestamp part.");
}
ChunkVersion version;
@@ -164,13 +162,7 @@ StatusWith<ChunkVersion> ChunkVersion::_parseLegacyWithField(const BSONObj& obj,
timestamp = (epoch == UNSHARDED().epoch() ? UNSHARDED().getTimestamp()
: IGNORED().getTimestamp());
} else {
- // TODO (SERVER-64813): remove this code once 6.0 becomes lastLTS
- // Hack to solve a complex problem related to the addition of the timestamp in 5.0
- uasserted(ErrorCodes::StaleShardVersion,
- str::stream()
- << "Failed to parse { epoch: " << epoch->toString()
- << ", combined: " << combined
- << "} as a ChunkVersion because it is missing the timestamp field.");
+ uasserted(6278300, "Timestamp must be present if epoch exists.");
}
} else if (!epoch && timestamp) {
uasserted(6278301, "Epoch must be present if timestamp exists.");
diff --git a/src/mongo/s/chunk_version_test.cpp b/src/mongo/s/chunk_version_test.cpp
index e44ce5064ec..d61c99de813 100644
--- a/src/mongo/s/chunk_version_test.cpp
+++ b/src/mongo/s/chunk_version_test.cpp
@@ -99,7 +99,7 @@ TEST(ChunkVersionParsing, FromBSONMissingTimestamp) {
BSON("testVersionField" << BSON_ARRAY(
Timestamp(Seconds(2), 3) << OID::gen()))["testVersionField"]),
DBException,
- ErrorCodes::StaleShardVersion);
+ ErrorCodes::TypeMismatch);
}
TEST(ChunkVersionParsing, FromBSON) {