Skip to content

Commit

Permalink
Add source_changefeed_name to DescribeReplicationResult (#4974)
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberROFL authored May 29, 2024
1 parent 8ab9f12 commit a9bc8ef
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ydb/core/grpc_services/rpc_replication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ class TDescribeReplicationRPC: public TRpcSchemeRequestActor<TDescribeReplicatio
static void ConvertItem(const NKikimrReplication::TReplicationConfig::TTargetSpecific::TTarget& from, Ydb::Replication::DescribeReplicationResult::Item& to) {
to.set_source_path(from.GetSrcPath());
to.set_destination_path(from.GetDstPath());
if (from.HasSrcStreamName()) {
to.set_source_changefeed_name(from.GetSrcStreamName());
}
}

static void ConvertState(NKikimrReplication::TReplicationState& from, Ydb::Replication::DescribeReplicationResult& to) {
Expand Down
1 change: 1 addition & 0 deletions ydb/core/protos/replication.proto
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ message TReplicationConfig {
message TTarget {
optional string SrcPath = 1;
optional string DstPath = 2;
optional string SrcStreamName = 3;
}

repeated TTarget Targets = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ class TController::TTxDescribeReplication: public TTxBase {
auto& item = *Result->Record.AddTargets();
item.SetSrcPath(target->GetSrcPath());
item.SetDstPath(target->GetDstPath());
if (target->GetStreamName()) {
item.SetSrcStreamName(target->GetStreamName());
}
}

auto& state = *Result->Record.MutableState();
Expand Down
1 change: 1 addition & 0 deletions ydb/public/api/protos/draft/ydb_replication.proto
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ message DescribeReplicationResult {
message Item {
string source_path = 1;
string destination_path = 2;
optional string source_changefeed_name = 3;
}

message RunningState {
Expand Down
8 changes: 6 additions & 2 deletions ydb/public/lib/ydb_cli/commands/ydb_service_scheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,13 @@ int TCommandDescribe::PrintReplicationResponsePretty(const NYdb::NReplication::T
}

if (const auto& items = desc.GetItems()) {
Cout << Endl << "Items (source => destination):";
Cout << Endl << "Items (source [changefeed] => destination):";
for (const auto& item : items) {
Cout << Endl << " " << item.SrcPath << " => " << item.DstPath;
Cout << Endl << " " << item.SrcPath;
if (item.SrcChangefeedName) {
Cout << " [" << *item.SrcChangefeedName << "]";
}
Cout << " => " << item.DstPath;
}
}

Expand Down
2 changes: 2 additions & 0 deletions ydb/public/sdk/cpp/client/draft/ydb_replication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ TReplicationDescription::TReplicationDescription(const Ydb::Replication::Describ
Items_.push_back(TItem{
.SrcPath = item.source_path(),
.DstPath = item.destination_path(),
.SrcChangefeedName = item.has_source_changefeed_name()
? std::make_optional(item.source_changefeed_name()) : std::nullopt,
});
}

Expand Down
3 changes: 3 additions & 0 deletions ydb/public/sdk/cpp/client/draft/ydb_replication.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#include <util/generic/vector.h>

#include <optional>

namespace Ydb::Replication {
class ConnectionParams;
class DescribeReplicationResult;
Expand Down Expand Up @@ -76,6 +78,7 @@ class TReplicationDescription {
struct TItem {
TString SrcPath;
TString DstPath;
std::optional<TString> SrcChangefeedName;
};

enum class EState {
Expand Down

0 comments on commit a9bc8ef

Please sign in to comment.