Skip to content

Commit e70ca08

Browse files
authored
Return consistency settings in description (#13236)
1 parent ef76fc0 commit e70ca08

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed

ydb/core/grpc_services/rpc_replication.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ class TDescribeReplicationRPC: public TRpcSchemeRequestActor<TDescribeReplicatio
131131
}
132132

133133
ConvertConnectionParams(record.GetConnectionParams(), *Result.mutable_connection_params());
134+
ConvertConsistencySettings(record.GetConsistencySettings(), Result);
134135
ConvertState(*record.MutableState(), Result);
135136

136137
for (const auto& target : record.GetTargets()) {
@@ -172,6 +173,26 @@ class TDescribeReplicationRPC: public TRpcSchemeRequestActor<TDescribeReplicatio
172173
to.set_token_secret_name(from.GetTokenSecretName());
173174
}
174175

176+
static void ConvertConsistencySettings(const NKikimrReplication::TConsistencySettings& from, Ydb::Replication::DescribeReplicationResult& to) {
177+
switch (from.GetLevelCase()) {
178+
case NKikimrReplication::TConsistencySettings::kRow:
179+
return ConvertRowConsistencySettings(from.GetRow(), *to.mutable_row_consistency());
180+
case NKikimrReplication::TConsistencySettings::kGlobal:
181+
return ConvertGlobalConsistencySettings(from.GetGlobal(), *to.mutable_global_consistency());
182+
default:
183+
break;
184+
}
185+
}
186+
187+
static void ConvertRowConsistencySettings(const NKikimrReplication::TConsistencySettings::TRowConsistency&, Ydb::Replication::ConsistencyLevelRow&) {
188+
// nop
189+
}
190+
191+
static void ConvertGlobalConsistencySettings(const NKikimrReplication::TConsistencySettings::TGlobalConsistency& from, Ydb::Replication::ConsistencyLevelGlobal& to) {
192+
*to.mutable_commit_interval() = google::protobuf::util::TimeUtil::MillisecondsToDuration(
193+
from.GetCommitIntervalMilliSeconds());
194+
}
195+
175196
static void ConvertItem(const NKikimrReplication::TReplicationConfig::TTargetSpecific::TTarget& from, Ydb::Replication::DescribeReplicationResult::Item& to) {
176197
to.set_id(from.GetId());
177198
to.set_source_path(from.GetSrcPath());

ydb/core/protos/replication.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ message TEvDescribeReplicationResult {
213213

214214
optional EStatus Status = 1;
215215
optional TConnectionParams ConnectionParams = 2;
216+
optional TConsistencySettings ConsistencySettings = 5;
216217
repeated TReplicationConfig.TTargetSpecific.TTarget Targets = 3;
217218
optional TReplicationState State = 4;
218219
}

ydb/core/tx/replication/controller/tx_describe_replication.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ class TController::TTxDescribeReplication: public TTxBase {
187187
Result = MakeHolder<TEvController::TEvDescribeReplicationResult>();
188188
Result->Record.SetStatus(NKikimrReplication::TEvDescribeReplicationResult::SUCCESS);
189189
Result->Record.MutableConnectionParams()->CopyFrom(replication->GetConfig().GetSrcConnectionParams());
190+
Result->Record.MutableConsistencySettings()->CopyFrom(replication->GetConfig().GetConsistencySettings());
190191

191192
using TInitialScanProgress = NYdb::NTable::TChangefeedDescription::TInitialScanProgress;
192193
std::optional<TInitialScanProgress> totalScanProgress;

ydb/public/api/protos/draft/ydb_replication.proto

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ message ConnectionParams {
4545
}
4646
}
4747

48+
message ConsistencyLevelRow {
49+
}
50+
51+
message ConsistencyLevelGlobal {
52+
google.protobuf.Duration commit_interval = 1;
53+
}
54+
4855
message DescribeReplicationResult {
4956
message Stats {
5057
optional google.protobuf.Duration lag = 1;
@@ -72,7 +79,12 @@ message DescribeReplicationResult {
7279

7380
// Description of scheme object.
7481
Ydb.Scheme.Entry self = 1;
82+
7583
ConnectionParams connection_params = 2;
84+
oneof consistency_level {
85+
ConsistencyLevelRow row_consistency = 7;
86+
ConsistencyLevelGlobal global_consistency = 8;
87+
}
7688
repeated Item items = 3;
7789
oneof state {
7890
RunningState running = 4;

0 commit comments

Comments
 (0)