aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozhikhov <akozhikhov@yandex-team.com>2024-08-16 23:11:20 +0300
committerakozhikhov <akozhikhov@yandex-team.com>2024-08-16 23:20:21 +0300
commit5644ad411b1c871b97bf329c99632736dc64ef2e (patch)
tree8aaedb835bd844129f8a9917e6dc294fa3740520
parent2fcc3532d5bfd8ccb3fb5b884088c01376c7888d (diff)
downloadydb-5644ad411b1c871b97bf329c99632736dc64ef2e.tar.gz
YT-15939: Replication collocation options
bde1508e2f78e25933120823a3bfce2969065497
-rw-r--r--yt/yt/client/tablet_client/config.cpp17
-rw-r--r--yt/yt/client/tablet_client/config.h19
-rw-r--r--yt/yt/client/tablet_client/public.h1
3 files changed, 28 insertions, 9 deletions
diff --git a/yt/yt/client/tablet_client/config.cpp b/yt/yt/client/tablet_client/config.cpp
index 7a070967c8..6e30181969 100644
--- a/yt/yt/client/tablet_client/config.cpp
+++ b/yt/yt/client/tablet_client/config.cpp
@@ -67,17 +67,25 @@ void TRetryingRemoteDynamicStoreReaderConfig::Register(TRegistrar registrar)
////////////////////////////////////////////////////////////////////////////////
-void TReplicatedTableOptions::Register(TRegistrar registrar)
+void TReplicationCollocationOptions::Register(TRegistrar registrar)
{
- registrar.Parameter("enable_replicated_table_tracker", &TThis::EnableReplicatedTableTracker)
- .Default(false);
+ registrar.Parameter("preferred_sync_replica_clusters", &TThis::PreferredSyncReplicaClusters)
+ .Default(std::nullopt);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void TReplicatedTableOptions::Register(TRegistrar registrar)
+{
registrar.Parameter("max_sync_replica_count", &TThis::MaxSyncReplicaCount)
.Alias("sync_replica_count")
.Optional();
registrar.Parameter("min_sync_replica_count", &TThis::MinSyncReplicaCount)
.Optional();
+ registrar.Parameter("enable_replicated_table_tracker", &TThis::EnableReplicatedTableTracker)
+ .Default(false);
+
registrar.Parameter("sync_replica_lag_threshold", &TThis::SyncReplicaLagThreshold)
.Default(TDuration::Minutes(10));
@@ -91,9 +99,6 @@ void TReplicatedTableOptions::Register(TRegistrar registrar)
registrar.Parameter("incomplete_preload_grace_period", &TThis::IncompletePreloadGracePeriod)
.Default(TDuration::Minutes(5));
- registrar.Parameter("preferred_sync_replica_clusters", &TThis::PreferredSyncReplicaClusters)
- .Default(std::nullopt);
-
registrar.Postprocessor([] (TThis* config) {
if (config->MaxSyncReplicaCount && config->MinSyncReplicaCount && *config->MinSyncReplicaCount > *config->MaxSyncReplicaCount) {
THROW_ERROR_EXCEPTION("\"min_sync_replica_count\" must be less or equal to \"max_sync_replica_count\"");
diff --git a/yt/yt/client/tablet_client/config.h b/yt/yt/client/tablet_client/config.h
index 501a80dce6..91c314ad63 100644
--- a/yt/yt/client/tablet_client/config.h
+++ b/yt/yt/client/tablet_client/config.h
@@ -84,10 +84,25 @@ DEFINE_REFCOUNTED_TYPE(TRetryingRemoteDynamicStoreReaderConfig)
////////////////////////////////////////////////////////////////////////////////
-class TReplicatedTableOptions
+class TReplicationCollocationOptions
: public NYTree::TYsonStruct
{
public:
+ std::optional<std::vector<TString>> PreferredSyncReplicaClusters;
+
+ REGISTER_YSON_STRUCT(TReplicationCollocationOptions);
+
+ static void Register(TRegistrar registrar);
+};
+
+DEFINE_REFCOUNTED_TYPE(TReplicationCollocationOptions)
+
+////////////////////////////////////////////////////////////////////////////////
+
+class TReplicatedTableOptions
+ : public TReplicationCollocationOptions
+{
+public:
bool EnableReplicatedTableTracker;
std::optional<int> MaxSyncReplicaCount;
@@ -102,8 +117,6 @@ public:
bool EnablePreloadStateCheck;
TDuration IncompletePreloadGracePeriod;
- std::optional<std::vector<TString>> PreferredSyncReplicaClusters;
-
std::tuple<int, int> GetEffectiveMinMaxReplicaCount(int replicaCount) const;
REGISTER_YSON_STRUCT(TReplicatedTableOptions);
diff --git a/yt/yt/client/tablet_client/public.h b/yt/yt/client/tablet_client/public.h
index c0fe8449a5..44dbc18ddc 100644
--- a/yt/yt/client/tablet_client/public.h
+++ b/yt/yt/client/tablet_client/public.h
@@ -243,6 +243,7 @@ DECLARE_REFCOUNTED_CLASS(TTableMountCacheDynamicConfig)
DECLARE_REFCOUNTED_CLASS(TRemoteDynamicStoreReaderConfig)
DECLARE_REFCOUNTED_CLASS(TRetryingRemoteDynamicStoreReaderConfig)
DECLARE_REFCOUNTED_CLASS(TReplicatedTableOptions)
+DECLARE_REFCOUNTED_CLASS(TReplicationCollocationOptions)
DECLARE_REFCOUNTED_STRUCT(TTableMountInfo)
DECLARE_REFCOUNTED_STRUCT(TTabletInfo)