summaryrefslogtreecommitdiff
path: root/src/mongo/s
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s')
-rw-r--r--src/mongo/s/SConscript1
-rw-r--r--src/mongo/s/catalog/type_chunk.cpp63
-rw-r--r--src/mongo/s/catalog/type_chunk.h29
-rw-r--r--src/mongo/s/catalog/type_chunk_base.idl44
-rw-r--r--src/mongo/s/chunk.cpp1
-rw-r--r--src/mongo/s/chunk.h2
-rw-r--r--src/mongo/s/request_types/commit_chunk_migration_request_test.cpp10
-rw-r--r--src/mongo/s/request_types/commit_chunk_migration_request_type.cpp19
-rw-r--r--src/mongo/s/request_types/commit_chunk_migration_request_type.h9
-rw-r--r--src/mongo/s/request_types/merge_chunk_request_test.cpp4
-rw-r--r--src/mongo/s/request_types/merge_chunk_request_type.cpp30
-rw-r--r--src/mongo/s/request_types/merge_chunk_request_type.h9
12 files changed, 12 insertions, 209 deletions
diff --git a/src/mongo/s/SConscript b/src/mongo/s/SConscript
index 59aeadf2017..6b668e0c4ca 100644
--- a/src/mongo/s/SConscript
+++ b/src/mongo/s/SConscript
@@ -130,7 +130,6 @@ env.Library(
'request_types/update_zone_key_range_request_type.cpp',
'shard_id.cpp',
'versioning.cpp',
- env.Idlc('catalog/type_chunk_base.idl')[0],
env.Idlc('request_types/create_collection.idl')[0],
env.Idlc('request_types/create_database.idl')[0],
env.Idlc('request_types/flush_routing_table_cache_updates.idl')[0],
diff --git a/src/mongo/s/catalog/type_chunk.cpp b/src/mongo/s/catalog/type_chunk.cpp
index 5aa3132a78e..58a181240a9 100644
--- a/src/mongo/s/catalog/type_chunk.cpp
+++ b/src/mongo/s/catalog/type_chunk.cpp
@@ -54,7 +54,6 @@ const BSONField<std::string> ChunkType::shard("shard");
const BSONField<bool> ChunkType::jumbo("jumbo");
const BSONField<Date_t> ChunkType::lastmod("lastmod");
const BSONField<OID> ChunkType::epoch("lastmodEpoch");
-const BSONField<BSONObj> ChunkType::history("history");
namespace {
@@ -158,23 +157,6 @@ ChunkRange ChunkRange::unionWith(ChunkRange const& other) const {
le(_maxKey, other._maxKey) ? other._maxKey : _maxKey);
}
-StatusWith<std::vector<ChunkHistory>> ChunkHistory::fromBSON(const BSONArray& source) {
- std::vector<ChunkHistory> values;
-
- for (const auto& arrayElement : source) {
- if (arrayElement.type() == Object) {
- IDLParserErrorContext tempContext("chunk history array");
- values.emplace_back(ChunkHistoryBase::parse(tempContext, arrayElement.Obj()));
- } else {
- return {ErrorCodes::BadValue,
- str::stream() << "array element does not have the object type: "
- << arrayElement.type()};
- }
- }
-
- return values;
-}
-
// ChunkType
ChunkType::ChunkType() = default;
@@ -235,22 +217,6 @@ StatusWith<ChunkType> ChunkType::fromConfigBSON(const BSONObj& source) {
chunk._version = std::move(versionStatus.getValue());
}
- {
- BSONElement historyObj;
- Status status = bsonExtractTypedField(source, history.name(), Array, &historyObj);
- if (status.isOK()) {
- auto history = std::move(ChunkHistory::fromBSON(BSONArray(historyObj.Obj())));
- if (!history.isOK())
- return history.getStatus();
-
- chunk._history = std::move(history.getValue());
- } else if (status == ErrorCodes::NoSuchKey) {
- // History is missing, so it will be presumed empty
- } else {
- return status;
- }
- }
-
return chunk;
}
@@ -270,7 +236,7 @@ BSONObj ChunkType::toConfigBSON() const {
_version->appendForChunk(&builder);
if (_jumbo)
builder.append(jumbo.name(), getJumbo());
- addHistoryToBSON(builder);
+
return builder.obj();
}
@@ -317,22 +283,6 @@ StatusWith<ChunkType> ChunkType::fromShardBSON(const BSONObj& source, const OID&
chunk._version = std::move(statusWithChunkVersion.getValue());
}
- {
- BSONElement historyObj;
- Status status = bsonExtractTypedField(source, history.name(), Array, &historyObj);
- if (status.isOK()) {
- auto history = std::move(ChunkHistory::fromBSON(BSONArray(historyObj.Obj())));
- if (!history.isOK())
- return history.getStatus();
-
- chunk._history = std::move(history.getValue());
- } else if (status == ErrorCodes::NoSuchKey) {
- // History is missing, so it will be presumed empty
- } else {
- return status;
- }
- }
-
return chunk;
}
@@ -346,7 +296,6 @@ BSONObj ChunkType::toShardBSON() const {
builder.append(max.name(), getMax());
builder.append(shard.name(), getShard().toString());
builder.appendTimestamp(lastmod.name(), _version->toLong());
- addHistoryToBSON(builder);
return builder.obj();
}
@@ -385,16 +334,6 @@ void ChunkType::setJumbo(bool jumbo) {
_jumbo = jumbo;
}
-void ChunkType::addHistoryToBSON(BSONObjBuilder& builder) const {
- if (_history.size()) {
- BSONArrayBuilder arrayBuilder(builder.subarrayStart(history.name()));
- for (const auto& item : _history) {
- BSONObjBuilder subObjBuilder(arrayBuilder.subobjStart());
- item.serialize(&subObjBuilder);
- }
- }
-}
-
std::string ChunkType::genID(const NamespaceString& nss, const BSONObj& o) {
StringBuilder buf;
buf << nss.ns() << "-";
diff --git a/src/mongo/s/catalog/type_chunk.h b/src/mongo/s/catalog/type_chunk.h
index 139e2d1dfa9..b4998af3c9a 100644
--- a/src/mongo/s/catalog/type_chunk.h
+++ b/src/mongo/s/catalog/type_chunk.h
@@ -33,7 +33,6 @@
#include "mongo/bson/bsonobj.h"
#include "mongo/db/namespace_string.h"
-#include "mongo/s/catalog/type_chunk_base_gen.h"
#include "mongo/s/chunk_version.h"
#include "mongo/s/shard_id.h"
@@ -105,22 +104,6 @@ private:
BSONObj _maxKey;
};
-class ChunkHistory : public ChunkHistoryBase {
-public:
- ChunkHistory() : ChunkHistoryBase() {}
- ChunkHistory(mongo::Timestamp ts, mongo::ShardId shard) : ChunkHistoryBase() {
- setValidAfter(std::move(ts));
- setShard(std::move(shard));
- }
- ChunkHistory(const ChunkHistoryBase& b) : ChunkHistoryBase(b) {}
-
- static StatusWith<std::vector<ChunkHistory>> fromBSON(const BSONArray& source);
-
- bool operator==(const ChunkHistory& other) const {
- return getValidAfter() == other.getValidAfter() && getShard() == other.getShard();
- }
-};
-
/**
* This class represents the layouts and contents of documents contained in the config server's
* config.chunks and shard server's config.chunks.uuid collections. All manipulation of documents
@@ -179,7 +162,6 @@ public:
static const BSONField<bool> jumbo;
static const BSONField<Date_t> lastmod;
static const BSONField<OID> epoch;
- static const BSONField<BSONObj> history;
ChunkType();
ChunkType(NamespaceString nss, ChunkRange range, ChunkVersion version, ShardId shardId);
@@ -254,15 +236,6 @@ public:
}
void setJumbo(bool jumbo);
- void setHistory(std::vector<ChunkHistory>&& history) {
- _history = std::move(history);
- }
- const std::vector<ChunkHistory>& getHistory() const {
- return _history;
- }
-
- void addHistoryToBSON(BSONObjBuilder& builder) const;
-
/**
* Generates chunk id based on the namespace name and the lower bound of the chunk.
*/
@@ -294,8 +267,6 @@ private:
boost::optional<ShardId> _shard;
// (O)(C) too big to move?
boost::optional<bool> _jumbo;
- // history of the chunk
- std::vector<ChunkHistory> _history;
};
} // namespace mongo
diff --git a/src/mongo/s/catalog/type_chunk_base.idl b/src/mongo/s/catalog/type_chunk_base.idl
deleted file mode 100644
index c1741a14f3f..00000000000
--- a/src/mongo/s/catalog/type_chunk_base.idl
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (C) 2018 MongoDB Inc.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License, version 3,
-# as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-
-# ChunkTypeBase type
-
-global:
- cpp_namespace: "mongo"
- cpp_includes:
- - "mongo/s/shard_id.h"
-
-imports:
- - "mongo/idl/basic_types.idl"
-
-types:
- shardid:
- bson_serialization_type: string
- description: "A BSON UTF-8 string"
- cpp_type: "ShardId"
- deserializer: "mongo::BSONElement::str"
- serializer: "mongo::ShardId::toString"
-
-structs:
- ChunkHistoryBase:
- description: "An element of a chunk history array. The array holds the history ordered from
- the most recent (the index 0) to the oldest supported."
- fields:
- validAfter:
- type: timestamp
- description: The time after which this chunk is at this shard.
- shard:
- type: shardid
- description: Shard this chunk lives in, starting at the "validAfter" time.
diff --git a/src/mongo/s/chunk.cpp b/src/mongo/s/chunk.cpp
index 21067acd7e0..527440594eb 100644
--- a/src/mongo/s/chunk.cpp
+++ b/src/mongo/s/chunk.cpp
@@ -61,7 +61,6 @@ Chunk::Chunk(const ChunkType& from)
: _range(from.getMin(), from.getMax()),
_shardId(from.getShard()),
_lastmod(from.getVersion()),
- _history(from.getHistory()),
_jumbo(from.getJumbo()),
_dataWritten(mkDataWritten()) {
invariantOK(from.validate());
diff --git a/src/mongo/s/chunk.h b/src/mongo/s/chunk.h
index 31205aefc25..540238463b5 100644
--- a/src/mongo/s/chunk.h
+++ b/src/mongo/s/chunk.h
@@ -98,8 +98,6 @@ private:
const ChunkVersion _lastmod;
- const std::vector<ChunkHistory> _history;
-
// Indicates whether this chunk should be treated as jumbo and not attempted to be moved or
// split
mutable bool _jumbo;
diff --git a/src/mongo/s/request_types/commit_chunk_migration_request_test.cpp b/src/mongo/s/request_types/commit_chunk_migration_request_test.cpp
index afc887745f0..9c5f513ac60 100644
--- a/src/mongo/s/request_types/commit_chunk_migration_request_test.cpp
+++ b/src/mongo/s/request_types/commit_chunk_migration_request_test.cpp
@@ -65,16 +65,13 @@ TEST(CommitChunkMigrationRequest, WithControlChunk) {
controlChunk.setMax(kKey3);
boost::optional<ChunkType> controlChunkOpt = controlChunk;
- Timestamp validAfter{1};
-
CommitChunkMigrationRequest::appendAsCommand(&builder,
kNamespaceString,
kShardId0,
kShardId1,
migratedChunk,
controlChunkOpt,
- fromShardCollectionVersion,
- validAfter);
+ fromShardCollectionVersion);
BSONObj cmdObj = builder.obj();
@@ -101,16 +98,13 @@ TEST(CommitChunkMigrationRequest, WithoutControlChunk) {
ChunkVersion fromShardCollectionVersion(1, 2, OID::gen());
- Timestamp validAfter{1};
-
CommitChunkMigrationRequest::appendAsCommand(&builder,
kNamespaceString,
kShardId0,
kShardId1,
migratedChunk,
boost::none,
- fromShardCollectionVersion,
- validAfter);
+ fromShardCollectionVersion);
BSONObj cmdObj = builder.obj();
diff --git a/src/mongo/s/request_types/commit_chunk_migration_request_type.cpp b/src/mongo/s/request_types/commit_chunk_migration_request_type.cpp
index 463ee0d4a92..1f1125529cb 100644
--- a/src/mongo/s/request_types/commit_chunk_migration_request_type.cpp
+++ b/src/mongo/s/request_types/commit_chunk_migration_request_type.cpp
@@ -41,7 +41,6 @@ const char kToShard[] = "toShard";
const char kMigratedChunk[] = "migratedChunk";
const char kControlChunk[] = "controlChunk";
const char kFromShardCollectionVersion[] = "fromShardCollectionVersion";
-const char kValidAfter[] = "validAfter";
/**
* Attempts to parse a (range-only!) ChunkType from "field" in "source".
@@ -133,20 +132,6 @@ StatusWith<CommitChunkMigrationRequest> CommitChunkMigrationRequest::createFromC
request._collectionEpoch = statusWithChunkVersion.getValue().epoch();
}
- {
- Timestamp validAfter;
- auto status = bsonExtractTimestampField(obj, kValidAfter, &validAfter);
- if (!status.isOK() && status != ErrorCodes::NoSuchKey) {
- return status;
- }
-
- if (status.isOK()) {
- request._validAfter = validAfter;
- } else {
- request._validAfter = boost::none;
- }
- }
-
return request;
}
@@ -156,8 +141,7 @@ void CommitChunkMigrationRequest::appendAsCommand(BSONObjBuilder* builder,
const ShardId& toShard,
const ChunkType& migratedChunk,
const boost::optional<ChunkType>& controlChunk,
- const ChunkVersion& fromShardCollectionVersion,
- const Timestamp& validAfter) {
+ const ChunkVersion& fromShardCollectionVersion) {
invariant(builder->asTempObj().isEmpty());
invariant(nss.isValid());
@@ -170,7 +154,6 @@ void CommitChunkMigrationRequest::appendAsCommand(BSONObjBuilder* builder,
if (controlChunk) {
builder->append(kControlChunk, controlChunk->toConfigBSON());
}
- builder->append(kValidAfter, validAfter);
}
} // namespace mongo
diff --git a/src/mongo/s/request_types/commit_chunk_migration_request_type.h b/src/mongo/s/request_types/commit_chunk_migration_request_type.h
index f403572e46e..919db71870d 100644
--- a/src/mongo/s/request_types/commit_chunk_migration_request_type.h
+++ b/src/mongo/s/request_types/commit_chunk_migration_request_type.h
@@ -60,8 +60,7 @@ struct CommitChunkMigrationRequest {
const ShardId& toShard,
const ChunkType& migratedChunkType,
const boost::optional<ChunkType>& controlChunkType,
- const ChunkVersion& fromShardChunkVersion,
- const Timestamp& validAfter);
+ const ChunkVersion& fromShardChunkVersion);
const NamespaceString& getNss() const {
return _nss;
@@ -81,9 +80,6 @@ struct CommitChunkMigrationRequest {
const OID& getCollectionEpoch() {
return _collectionEpoch;
}
- const boost::optional<Timestamp>& getValidAfter() {
- return _validAfter;
- }
// The collection for which this request applies.
NamespaceString _nss;
@@ -101,9 +97,6 @@ struct CommitChunkMigrationRequest {
boost::optional<ChunkType> _controlChunk;
OID _collectionEpoch;
-
- // The time of the move
- boost::optional<Timestamp> _validAfter;
};
} // namespace mongo
diff --git a/src/mongo/s/request_types/merge_chunk_request_test.cpp b/src/mongo/s/request_types/merge_chunk_request_test.cpp
index ce8b7366a9e..de9ecd7990c 100644
--- a/src/mongo/s/request_types/merge_chunk_request_test.cpp
+++ b/src/mongo/s/request_types/merge_chunk_request_test.cpp
@@ -64,9 +64,7 @@ TEST(MergeChunkRequest, ConfigCommandtoBSON) {
<< "chunkBoundaries"
<< BSON_ARRAY(BSON("a" << 1) << BSON("a" << 5) << BSON("a" << 10))
<< "shard"
- << "shard0000"
- << "validAfter"
- << Timestamp{100});
+ << "shard0000");
BSONObj writeConcernObj = BSON("writeConcern" << BSON("w"
<< "majority"));
diff --git a/src/mongo/s/request_types/merge_chunk_request_type.cpp b/src/mongo/s/request_types/merge_chunk_request_type.cpp
index abace857a99..64200b85460 100644
--- a/src/mongo/s/request_types/merge_chunk_request_type.cpp
+++ b/src/mongo/s/request_types/merge_chunk_request_type.cpp
@@ -40,19 +40,17 @@ const char kConfigsvrMergeChunk[] = "_configsvrCommitChunkMerge";
const char kCollEpoch[] = "collEpoch";
const char kChunkBoundaries[] = "chunkBoundaries";
const char kShardName[] = "shard";
-const char kValidAfter[] = "validAfter";
+
} // namespace
MergeChunkRequest::MergeChunkRequest(NamespaceString nss,
std::string shardName,
OID epoch,
- std::vector<BSONObj> chunkBoundaries,
- boost::optional<Timestamp> validAfter)
+ std::vector<BSONObj> chunkBoundaries)
: _nss(std::move(nss)),
_epoch(std::move(epoch)),
_chunkBoundaries(std::move(chunkBoundaries)),
- _shardName(std::move(shardName)),
- _validAfter(validAfter) {}
+ _shardName(std::move(shardName)) {}
StatusWith<MergeChunkRequest> MergeChunkRequest::parseFromConfigCommand(const BSONObj& cmdObj) {
std::string ns;
@@ -105,24 +103,8 @@ StatusWith<MergeChunkRequest> MergeChunkRequest::parseFromConfigCommand(const BS
}
}
- boost::optional<Timestamp> validAfter = boost::none;
- {
- Timestamp ts{0};
- auto status = bsonExtractTimestampField(cmdObj, kValidAfter, &ts);
- if (!status.isOK() && status != ErrorCodes::NoSuchKey) {
- return status;
- }
-
- if (status.isOK()) {
- validAfter = ts;
- }
- }
-
- return MergeChunkRequest(std::move(nss),
- std::move(shardName),
- std::move(epoch),
- std::move(chunkBoundaries),
- validAfter);
+ return MergeChunkRequest(
+ std::move(nss), std::move(shardName), std::move(epoch), std::move(chunkBoundaries));
}
BSONObj MergeChunkRequest::toConfigCommandBSON(const BSONObj& writeConcern) {
@@ -145,8 +127,6 @@ void MergeChunkRequest::appendAsConfigCommand(BSONObjBuilder* cmdBuilder) {
}
}
cmdBuilder->append(kShardName, _shardName);
- invariant(_validAfter.is_initialized());
- cmdBuilder->append(kValidAfter, _validAfter.get());
}
} // namespace mongo
diff --git a/src/mongo/s/request_types/merge_chunk_request_type.h b/src/mongo/s/request_types/merge_chunk_request_type.h
index 2722c53b057..2ead5f3a9b1 100644
--- a/src/mongo/s/request_types/merge_chunk_request_type.h
+++ b/src/mongo/s/request_types/merge_chunk_request_type.h
@@ -46,8 +46,7 @@ public:
MergeChunkRequest(NamespaceString nss,
std::string shardName,
OID epoch,
- std::vector<BSONObj> chunkBoundaries,
- boost::optional<Timestamp> validAfter);
+ std::vector<BSONObj> chunkBoundaries);
/**
* Parses the provided BSON content as the internal _configsvrCommitChunkMerge command, and if
@@ -95,10 +94,6 @@ public:
return _shardName;
}
- const boost::optional<Timestamp>& getValidAfter() const {
- return _validAfter;
- }
-
private:
NamespaceString _nss;
OID _epoch;
@@ -107,8 +102,6 @@ private:
std::vector<BSONObj> _chunkBoundaries;
std::string _shardName;
-
- boost::optional<Timestamp> _validAfter;
};
} // namespace mongo