mirror of https://github.com/mongodb/mongo
Co-authored-by: auto-revert-processor <devprod-si-team@mongodb.com> GitOrigin-RevId: bc20b36c7eb19edb7556791b3000462cced15aa0
This commit is contained in:
parent
b5e3d1c2f6
commit
2dec5f5579
|
|
@ -578,6 +578,7 @@ data_movement:
|
|||
- src/mongo/s/commands/*move_chunk*
|
||||
- src/mongo/s/request_types/auto_split_vector.idl
|
||||
- src/mongo/s/request_types/migration_secondary_throttle*
|
||||
- src/mongo/s/request_types/repair_sharded_collection_chunks_history.idl
|
||||
- src/mongo/s/request_types/cleanup_orphaned.idl
|
||||
- src/mongo/s/migration_blocking_operation/migration_blocking_operation*
|
||||
|
||||
|
|
|
|||
|
|
@ -421,15 +421,6 @@ idl_generator(
|
|||
],
|
||||
)
|
||||
|
||||
idl_generator(
|
||||
name = "repair_sharded_collection_chunks_history_gen",
|
||||
src = "repair_sharded_collection_chunks_history.idl",
|
||||
deps = [
|
||||
"//src/mongo/db:basic_types_gen",
|
||||
"//src/mongo/idl:generic_argument_gen",
|
||||
],
|
||||
)
|
||||
|
||||
idl_generator(
|
||||
name = "list_shards_gen",
|
||||
src = "list_shards.idl",
|
||||
|
|
|
|||
|
|
@ -40,13 +40,13 @@
|
|||
#include "mongo/db/auth/resource_pattern.h"
|
||||
#include "mongo/db/commands.h"
|
||||
#include "mongo/db/database_name.h"
|
||||
#include "mongo/db/global_catalog/ddl/repair_sharded_collection_chunks_history_gen.h"
|
||||
#include "mongo/db/namespace_string.h"
|
||||
#include "mongo/db/operation_context.h"
|
||||
#include "mongo/db/service_context.h"
|
||||
#include "mongo/db/sharding_environment/client/shard.h"
|
||||
#include "mongo/db/sharding_environment/grid.h"
|
||||
#include "mongo/db/topology/shard_registry.h"
|
||||
#include "mongo/s/request_types/repair_sharded_collection_chunks_history_gen.h"
|
||||
#include "mongo/util/assert_util.h"
|
||||
|
||||
#include <string>
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@
|
|||
#include "mongo/db/database_name.h"
|
||||
#include "mongo/db/global_catalog/catalog_cache/catalog_cache.h"
|
||||
#include "mongo/db/global_catalog/catalog_cache/routing_information_cache.h"
|
||||
#include "mongo/db/global_catalog/ddl/repair_sharded_collection_chunks_history_gen.h"
|
||||
#include "mongo/db/global_catalog/ddl/sharding_catalog_manager.h"
|
||||
#include "mongo/db/logical_time.h"
|
||||
#include "mongo/db/namespace_string.h"
|
||||
|
|
@ -52,6 +51,7 @@
|
|||
#include "mongo/db/service_context.h"
|
||||
#include "mongo/db/topology/cluster_role.h"
|
||||
#include "mongo/db/vector_clock/vector_clock.h"
|
||||
#include "mongo/s/request_types/repair_sharded_collection_chunks_history_gen.h"
|
||||
#include "mongo/util/assert_util.h"
|
||||
#include "mongo/util/namespace_string_util.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -41,4 +41,3 @@ commands:
|
|||
api_version: ""
|
||||
type: namespacestring
|
||||
strict: false
|
||||
mod_visibility: public
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
#include "mongo/db/namespace_string.h"
|
||||
#include "mongo/db/operation_context.h"
|
||||
#include "mongo/util/assert_util.h"
|
||||
#include "mongo/util/modules.h"
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
#include "mongo/stdx/mutex.h"
|
||||
#include "mongo/stdx/unordered_map.h"
|
||||
#include "mongo/util/concurrency/thread_pool.h"
|
||||
#include "mongo/util/modules.h"
|
||||
#include "mongo/util/uuid.h"
|
||||
|
||||
#include <memory>
|
||||
|
|
@ -54,8 +53,7 @@ namespace mongo {
|
|||
* and terminated on stepDown.
|
||||
*/
|
||||
|
||||
class MONGO_MOD_NEEDS_REPLACEMENT BalancerStatsRegistry
|
||||
: public ReplicaSetAwareServiceShardSvr<BalancerStatsRegistry> {
|
||||
class BalancerStatsRegistry : public ReplicaSetAwareServiceShardSvr<BalancerStatsRegistry> {
|
||||
|
||||
BalancerStatsRegistry(const BalancerStatsRegistry&) = delete;
|
||||
BalancerStatsRegistry& operator=(const BalancerStatsRegistry&) = delete;
|
||||
|
|
@ -75,11 +73,11 @@ public:
|
|||
*
|
||||
* If the registy is not initialized this function will be a noop.
|
||||
*/
|
||||
MONGO_MOD_PRIVATE void updateOrphansCount(const UUID& collectionUUID, long long delta);
|
||||
void updateOrphansCount(const UUID& collectionUUID, long long delta);
|
||||
void onRangeDeletionTaskInsertion(const UUID& collectionUUID, long long numOrphanDocs);
|
||||
void onRangeDeletionTaskDeletion(const UUID& collectionUUID, long long numOrphanDocs);
|
||||
|
||||
MONGO_MOD_PRIVATE long long getCollNumOrphanDocs(const UUID& collectionUUID) const;
|
||||
long long getCollNumOrphanDocs(const UUID& collectionUUID) const;
|
||||
|
||||
/**
|
||||
* Retrieves the numOrphanDocs from the balancer stats registry if initialized or runs an
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@
|
|||
#include "mongo/db/sharding_environment/shard_id.h"
|
||||
#include "mongo/db/versioning_protocol/chunk_version.h"
|
||||
#include "mongo/s/resharding/common_types_gen.h"
|
||||
#include "mongo/util/modules.h"
|
||||
#include "mongo/util/string_map.h"
|
||||
#include "mongo/util/uuid.h"
|
||||
|
||||
|
|
@ -66,7 +65,7 @@ struct SplitPolicyParams {
|
|||
ShardId primaryShardId;
|
||||
};
|
||||
|
||||
class MONGO_MOD_PUBLIC InitialSplitPolicy {
|
||||
class InitialSplitPolicy {
|
||||
public:
|
||||
virtual ~InitialSplitPolicy() {}
|
||||
|
||||
|
|
@ -124,7 +123,7 @@ public:
|
|||
/**
|
||||
* Default optimization strategy where we create a single chunk on the primary shard.
|
||||
*/
|
||||
class MONGO_MOD_PUBLIC SingleChunkOnPrimarySplitPolicy : public InitialSplitPolicy {
|
||||
class SingleChunkOnPrimarySplitPolicy : public InitialSplitPolicy {
|
||||
public:
|
||||
ShardCollectionConfig createFirstChunks(OperationContext* opCtx,
|
||||
const ShardKeyPattern& shardKeyPattern,
|
||||
|
|
@ -134,7 +133,7 @@ public:
|
|||
/**
|
||||
* Create a single chunk on a specified shard.
|
||||
*/
|
||||
class MONGO_MOD_PUBLIC SingleChunkOnShardSplitPolicy : public InitialSplitPolicy {
|
||||
class SingleChunkOnShardSplitPolicy : public InitialSplitPolicy {
|
||||
public:
|
||||
SingleChunkOnShardSplitPolicy(OperationContext* opCtx, ShardId dataShard);
|
||||
|
||||
|
|
@ -150,7 +149,7 @@ private:
|
|||
* Split point building strategy to be used when the appropriate splitpoints can be trivially
|
||||
* deduced from the shard key.
|
||||
*/
|
||||
class MONGO_MOD_PUBLIC SplitPointsBasedSplitPolicy : public InitialSplitPolicy {
|
||||
class SplitPointsBasedSplitPolicy : public InitialSplitPolicy {
|
||||
public:
|
||||
/**
|
||||
* Constructor used when generating split points for a hashed-prefix shard key.
|
||||
|
|
@ -217,7 +216,7 @@ private:
|
|||
/**
|
||||
* In this strategy we directly generate a single chunk for each tag range.
|
||||
*/
|
||||
class MONGO_MOD_PUBLIC SingleChunkPerTagSplitPolicy : public AbstractTagsBasedSplitPolicy {
|
||||
class SingleChunkPerTagSplitPolicy : public AbstractTagsBasedSplitPolicy {
|
||||
public:
|
||||
SingleChunkPerTagSplitPolicy(
|
||||
OperationContext* opCtx,
|
||||
|
|
@ -237,7 +236,7 @@ private:
|
|||
* case, we generate one chunk per tag range and then further split each of these using the hashed
|
||||
* field of the shard key.
|
||||
*/
|
||||
class MONGO_MOD_PUBLIC PresplitHashedZonesSplitPolicy : public AbstractTagsBasedSplitPolicy {
|
||||
class PresplitHashedZonesSplitPolicy : public AbstractTagsBasedSplitPolicy {
|
||||
public:
|
||||
PresplitHashedZonesSplitPolicy(
|
||||
OperationContext* opCtx,
|
||||
|
|
@ -259,7 +258,7 @@ private:
|
|||
/**
|
||||
* Split point building strategy for resharding.
|
||||
*/
|
||||
class MONGO_MOD_PUBLIC SamplingBasedSplitPolicy : public InitialSplitPolicy {
|
||||
class SamplingBasedSplitPolicy : public InitialSplitPolicy {
|
||||
public:
|
||||
using SampleDocumentPipeline = std::unique_ptr<Pipeline>;
|
||||
|
||||
|
|
@ -320,14 +319,13 @@ public:
|
|||
|
||||
static constexpr int kDefaultSamplesPerChunk = 10;
|
||||
|
||||
// TODO This should ideally be file_private.
|
||||
MONGO_MOD_NEEDS_REPLACEMENT static std::unique_ptr<SampleDocumentSource>
|
||||
makePipelineDocumentSource_forTest(OperationContext* opCtx,
|
||||
boost::intrusive_ptr<DocumentSource> initialSource,
|
||||
const NamespaceString& ns,
|
||||
const ShardKeyPattern& shardKey,
|
||||
int numInitialChunks,
|
||||
int samplesPerChunk);
|
||||
static std::unique_ptr<SampleDocumentSource> makePipelineDocumentSource_forTest(
|
||||
OperationContext* opCtx,
|
||||
boost::intrusive_ptr<DocumentSource> initialSource,
|
||||
const NamespaceString& ns,
|
||||
const ShardKeyPattern& shardKey,
|
||||
int numInitialChunks,
|
||||
int samplesPerChunk);
|
||||
|
||||
private:
|
||||
static std::unique_ptr<SampleDocumentSource> _makePipelineDocumentSource(
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
#include "mongo/bson/bsonobj.h"
|
||||
#include "mongo/db/local_catalog/shard_role_api/shard_role.h"
|
||||
#include "mongo/util/modules.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
|
|
|||
|
|
@ -383,7 +383,6 @@ mongo_cc_library(
|
|||
"//src/mongo/db/global_catalog/ddl:move_primary_gen",
|
||||
"//src/mongo/db/global_catalog/ddl:placement_history_commands_gen",
|
||||
"//src/mongo/db/global_catalog/ddl:remove_shard_from_zone_request_type.cpp",
|
||||
"//src/mongo/db/global_catalog/ddl:repair_sharded_collection_chunks_history_gen",
|
||||
"//src/mongo/db/global_catalog/ddl:set_allow_migrations_gen",
|
||||
"//src/mongo/db/global_catalog/ddl:sharded_ddl_commands_gen",
|
||||
"//src/mongo/db/global_catalog/ddl:shardsvr_join_ddl_coordinators_request_gen",
|
||||
|
|
@ -414,6 +413,7 @@ mongo_cc_library(
|
|||
"//src/mongo/s/request_types:get_stats_for_balancing_gen",
|
||||
"//src/mongo/s/request_types:migration_secondary_throttle_options.cpp",
|
||||
"//src/mongo/s/request_types:move_range_request_gen",
|
||||
"//src/mongo/s/request_types:repair_sharded_collection_chunks_history_gen",
|
||||
"//src/mongo/s/request_types:reshard_collection_gen",
|
||||
"//src/mongo/s/request_types:resharding_operation_time_gen",
|
||||
"//src/mongo/s/request_types:transition_from_dedicated_config_server_gen",
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
#include "mongo/s/balancer_configuration_gen.h"
|
||||
#include "mongo/s/request_types/migration_secondary_throttle_options.h"
|
||||
#include "mongo/stdx/mutex.h"
|
||||
#include "mongo/util/modules.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
|
@ -75,7 +74,7 @@ class StatusWith;
|
|||
* TODO SERVER-107399 Remove this class once done, as users should no longer directly update this
|
||||
* document.
|
||||
*/
|
||||
class MONGO_MOD_PUBLIC BalancerSettingsType {
|
||||
class BalancerSettingsType {
|
||||
public:
|
||||
/**
|
||||
* Part of schema to enforce on config.settings document relating to documents with _id:
|
||||
|
|
@ -105,7 +104,7 @@ private:
|
|||
*
|
||||
* chunksize: { value: <value in MB between 1 and 1024> }
|
||||
*/
|
||||
class MONGO_MOD_PUBLIC ChunkSizeSettingsType {
|
||||
class ChunkSizeSettingsType {
|
||||
public:
|
||||
// The key under which this setting is stored on the config server
|
||||
static const char kKey[];
|
||||
|
|
@ -160,7 +159,7 @@ private:
|
|||
*
|
||||
* automerge: { enabled: <true|false> }
|
||||
*/
|
||||
class MONGO_MOD_PUBLIC AutoMergeSettingsType {
|
||||
class AutoMergeSettingsType {
|
||||
public:
|
||||
// The key under which this setting is stored on the config server
|
||||
static const char kKey[];
|
||||
|
|
@ -191,7 +190,7 @@ private:
|
|||
/**
|
||||
* Contains settings, which control the behaviour of the balancer.
|
||||
*/
|
||||
class MONGO_MOD_PUBLIC BalancerConfiguration {
|
||||
class BalancerConfiguration {
|
||||
BalancerConfiguration(const BalancerConfiguration&) = delete;
|
||||
BalancerConfiguration& operator=(const BalancerConfiguration&) = delete;
|
||||
|
||||
|
|
@ -209,37 +208,37 @@ public:
|
|||
* Non-blocking method, which checks whether the balancer is enabled (without checking for the
|
||||
* balancing window).
|
||||
*/
|
||||
MONGO_MOD_PRIVATE mongo::BalancerModeEnum getBalancerMode() const;
|
||||
mongo::BalancerModeEnum getBalancerMode() const;
|
||||
|
||||
/**
|
||||
* Synchronous method, which writes the balancer mode to the configuration data.
|
||||
*/
|
||||
MONGO_MOD_PRIVATE Status setBalancerMode(OperationContext* opCtx, mongo::BalancerModeEnum mode);
|
||||
Status setBalancerMode(OperationContext* opCtx, mongo::BalancerModeEnum mode);
|
||||
|
||||
/**
|
||||
* Returns whether balancing is allowed based on both the enabled state of the balancer and the
|
||||
* balancing window.
|
||||
*/
|
||||
MONGO_MOD_PRIVATE bool shouldBalance(OperationContext* opCtx) const;
|
||||
MONGO_MOD_PRIVATE bool shouldBalanceForAutoMerge(OperationContext* opCtx) const;
|
||||
bool shouldBalance(OperationContext* opCtx) const;
|
||||
bool shouldBalanceForAutoMerge(OperationContext* opCtx) const;
|
||||
|
||||
/**
|
||||
* Returns the secondary throttle options for the balancer.
|
||||
*/
|
||||
MONGO_MOD_PRIVATE MigrationSecondaryThrottleOptions getSecondaryThrottle() const;
|
||||
MigrationSecondaryThrottleOptions getSecondaryThrottle() const;
|
||||
|
||||
/**
|
||||
* Returns whether the balancer should wait for deletion of orphaned chunk data at the end of
|
||||
* each migration.
|
||||
*/
|
||||
MONGO_MOD_PRIVATE bool waitForDelete() const;
|
||||
bool waitForDelete() const;
|
||||
|
||||
/**
|
||||
* Returns whether the balancer should attempt to schedule migrations of 'large' chunks. If
|
||||
* false, the balancer will instead mark these chunks as 'jumbo', meaning they will not be
|
||||
* scheduled for any split or move in the future.
|
||||
*/
|
||||
MONGO_MOD_PRIVATE bool attemptToBalanceJumboChunks() const;
|
||||
bool attemptToBalanceJumboChunks() const;
|
||||
|
||||
/**
|
||||
* Returns the max chunk size after which a chunk would be considered jumbo.
|
||||
|
|
@ -251,9 +250,9 @@ public:
|
|||
/**
|
||||
* Change the cluster wide auto merge settings.
|
||||
*/
|
||||
MONGO_MOD_PRIVATE Status changeAutoMergeSettings(OperationContext* opCtx, bool enable);
|
||||
Status changeAutoMergeSettings(OperationContext* opCtx, bool enable);
|
||||
|
||||
MONGO_MOD_PRIVATE bool shouldAutoMerge() const {
|
||||
bool shouldAutoMerge() const {
|
||||
return _shouldAutoMerge.loadRelaxed();
|
||||
}
|
||||
|
||||
|
|
@ -266,31 +265,30 @@ public:
|
|||
* This method is thread-safe but it doesn't make sense to be called from more than one thread
|
||||
* at a time.
|
||||
*/
|
||||
MONGO_MOD_NEEDS_REPLACEMENT Status refreshAndCheck(OperationContext* opCtx);
|
||||
Status refreshAndCheck(OperationContext* opCtx);
|
||||
|
||||
/**
|
||||
* Constructs a settings object with the default values. To be used when no balancer settings
|
||||
* have been specified.
|
||||
*/
|
||||
MONGO_MOD_PRIVATE BalancerSettings createDefaultSettings();
|
||||
BalancerSettings createDefaultSettings();
|
||||
|
||||
/**
|
||||
* Interprets the BSON content as balancer settings and extracts the respective values.
|
||||
*/
|
||||
MONGO_MOD_PRIVATE StatusWith<BalancerSettings> getSettingsFromBSON(OperationContext* opCtx,
|
||||
const BSONObj& obj);
|
||||
StatusWith<BalancerSettings> getSettingsFromBSON(OperationContext* opCtx, const BSONObj& obj);
|
||||
|
||||
/**
|
||||
* Returns true if either 'now' is in the balancing window or if no balancing window exists.
|
||||
*/
|
||||
MONGO_MOD_PRIVATE bool isTimeInBalancingWindow(OperationContext* opCtx,
|
||||
const boost::posix_time::ptime& now) const;
|
||||
bool isTimeInBalancingWindow(OperationContext* opCtx,
|
||||
const boost::posix_time::ptime& now) const;
|
||||
|
||||
|
||||
/**
|
||||
* Modify the balancer settings directly. This is used for testing purposes only.
|
||||
*/
|
||||
MONGO_MOD_PRIVATE void setBalancerSettingsForTest(const BalancerSettings& settings) {
|
||||
void setBalancerSettingsForTest(const BalancerSettings& settings) {
|
||||
stdx::lock_guard<stdx::mutex> lk(_balancerSettingsMutex);
|
||||
_balancerSettings = settings;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@
|
|||
# it in the license file.
|
||||
|
||||
global:
|
||||
mod_visibility: private
|
||||
cpp_namespace: "mongo"
|
||||
cpp_includes:
|
||||
- "mongo/s/request_types/migration_secondary_throttle_options.h"
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
# Feature flags for balancer functionality.
|
||||
|
||||
global:
|
||||
mod_visibility: private
|
||||
cpp_namespace: "mongo::feature_flags"
|
||||
|
||||
imports:
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ types:
|
|||
structs:
|
||||
AutoSplitVectorResponse:
|
||||
description: "The reply of an autoSplitVector command."
|
||||
mod_visibility: public
|
||||
strict: false
|
||||
is_command_reply: true
|
||||
fields:
|
||||
|
|
@ -65,7 +64,6 @@ commands:
|
|||
strict: false
|
||||
namespace: concatenate_with_db
|
||||
api_version: ""
|
||||
mod_visibility: public
|
||||
fields:
|
||||
keyPattern:
|
||||
type: object_owned
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
# _configsvrBalancerCollectionStatus and balancerCollectionStatus IDL File
|
||||
|
||||
global:
|
||||
mod_visibility: private
|
||||
cpp_namespace: "mongo"
|
||||
|
||||
imports:
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
#
|
||||
|
||||
global:
|
||||
mod_visibility: private
|
||||
cpp_namespace: "mongo"
|
||||
|
||||
imports:
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
# _configsvrConfigureCollectionBalancing and configureCollectionBalancing IDL File
|
||||
|
||||
global:
|
||||
mod_visibility: private
|
||||
cpp_namespace: "mongo"
|
||||
|
||||
imports:
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
#
|
||||
|
||||
global:
|
||||
mod_visibility: private
|
||||
cpp_namespace: "mongo"
|
||||
|
||||
imports:
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
#
|
||||
|
||||
global:
|
||||
mod_visibility: private
|
||||
cpp_namespace: "mongo"
|
||||
cpp_includes:
|
||||
- "mongo/s/request_types/update_zone_key_range_serialization.h"
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "mongo/bson/bsonobjbuilder.h"
|
||||
#include "mongo/util/modules.h"
|
||||
|
||||
#include <boost/optional/optional.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ structs:
|
|||
ResumeTokenOplogTimestamp:
|
||||
description: "Token format which facilitates resuming from the most recently-observed timestamp in the oplog"
|
||||
strict: true
|
||||
mod_visibility: public
|
||||
fields:
|
||||
ts:
|
||||
type: timestamp
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ structs:
|
|||
# required for resharding because durable state from all resharding operations is cleaned up
|
||||
# before the upgrade or downgrade can complete.
|
||||
strict: false
|
||||
mod_visibility: public
|
||||
fields:
|
||||
tempNs:
|
||||
cpp_name: tempReshardingNss
|
||||
|
|
@ -64,7 +63,6 @@ structs:
|
|||
# required for resharding because durable state from all resharding operations is cleaned up
|
||||
# before the upgrade or downgrade can complete.
|
||||
strict: false
|
||||
mod_visibility: public
|
||||
fields:
|
||||
cloneTimestamp:
|
||||
type: timestamp
|
||||
|
|
@ -104,7 +102,6 @@ structs:
|
|||
# required for resharding because durable state from all resharding operations is cleaned up
|
||||
# before the upgrade or downgrade can complete.
|
||||
strict: false
|
||||
mod_visibility: public
|
||||
fields:
|
||||
uuid:
|
||||
cpp_name: reshardingUUID
|
||||
|
|
|
|||
Loading…
Reference in New Issue