Skip to content

Commit d61c12b

Browse files
authored
Re-request tx ids during handshake (#13059)
1 parent d996c04 commit d61c12b

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

ydb/core/tx/replication/service/service.cpp

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,30 @@ class TSessionInfo {
5151
return Generation;
5252
}
5353

54-
void Update(const TActorId& actorId, ui64 generation) {
54+
void Handle(IActorOps* ops, TEvService::TEvHandshake::TPtr& ev) {
55+
const ui64 generation = ev->Get()->Record.GetController().GetGeneration();
5556
Y_ABORT_UNLESS(Generation <= generation);
56-
ActorId = actorId;
57+
58+
ActorId = ev->Sender;
5759
Generation = generation;
60+
61+
auto status = MakeHolder<TEvService::TEvStatus>();
62+
auto& record = status->Record;
63+
64+
for (const auto& [id, _] : Workers) {
65+
id.Serialize(*record.AddWorkers());
66+
}
67+
68+
ops->Send(ActorId, status.Release());
69+
70+
TVector<TRowVersion> versionsWithoutTxId;
71+
for (const auto& [version, _] : PendingTxId) {
72+
versionsWithoutTxId.push_back(version);
73+
}
74+
75+
if (versionsWithoutTxId) {
76+
ops->Send(ActorId, new TEvService::TEvGetTxId(versionsWithoutTxId));
77+
}
5878
}
5979

6080
bool HasWorker(const TWorkerId& id) const {
@@ -116,17 +136,6 @@ class TSessionInfo {
116136
ops->Send(ActorId, new TEvService::TEvWorkerStatus(id, std::forward<Args>(args)...));
117137
}
118138

119-
void SendStatus(IActorOps* ops) const {
120-
auto ev = MakeHolder<TEvService::TEvStatus>();
121-
auto& record = ev->Record;
122-
123-
for (const auto& [id, _] : Workers) {
124-
id.Serialize(*record.AddWorkers());
125-
}
126-
127-
ops->Send(ActorId, ev.Release());
128-
}
129-
130139
void SendWorkerDataEnd(IActorOps* ops, const TWorkerId& id, ui64 partitionId,
131140
const TVector<ui64>&& adjacentPartitionsIds, const TVector<ui64>&& childPartitionsIds)
132141
{
@@ -350,8 +359,7 @@ class TReplicationService: public TActorBootstrapped<TReplicationService> {
350359
return;
351360
}
352361

353-
session.Update(ev->Sender, controller.GetGeneration());
354-
session.SendStatus(this);
362+
session.Handle(this, ev);
355363
}
356364

357365
template <typename... Args>

0 commit comments

Comments
 (0)