Skip to content

Commit

Permalink
Add incr restore change sender (#9603)
Browse files Browse the repository at this point in the history
  • Loading branch information
Enjection authored Sep 23, 2024
1 parent 866f44f commit bcf8689
Show file tree
Hide file tree
Showing 13 changed files with 1,091 additions and 631 deletions.
2 changes: 2 additions & 0 deletions ydb/core/change_exchange/change_sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace NKikimr::NChangeExchange {

void TChangeSender::LazyCreateSender(THashMap<ui64, TSender>& senders, ui64 partitionId) {
++UninitSenders;
auto res = senders.emplace(partitionId, TSender{});
Y_ABORT_UNLESS(res.second);

Expand All @@ -27,6 +28,7 @@ void TChangeSender::RegisterSender(ui64 partitionId) {

Y_ABORT_UNLESS(!sender.ActorId);
sender.ActorId = ActorOps->RegisterWithSameMailbox(SenderFactory->CreateSender(partitionId));
--UninitSenders;
}

void TChangeSender::CreateMissingSenders(const TVector<ui64>& partitionIds) {
Expand Down
5 changes: 5 additions & 0 deletions ydb/core/change_exchange/change_sender.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ class TChangeSender {
return ReadySenders == Senders.size();
}

inline bool IsAllSendersReadyOrUninit() {
return ReadySenders + UninitSenders == Senders.size();
}

void SetPartitionResolver(IPartitionResolverVisitor* partitionResolver) {
PartitionResolver.Reset(partitionResolver);
}
Expand All @@ -194,6 +198,7 @@ class TChangeSender {

THashMap<ui64, TSender> Senders; // ui64 is partition id
ui64 ReadySenders = 0;
ui64 UninitSenders = 0;
TSet<TEnqueuedRecord> Enqueued;
TSet<TIncompleteRecord> PendingBody;
TMap<ui64, IChangeRecord::TPtr> PendingSent; // ui64 is order
Expand Down
1 change: 1 addition & 0 deletions ydb/core/tx/datashard/change_exchange_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace NDataShard {

IActor* CreateAsyncIndexChangeSender(const TDataShardId& dataShard, const TTableId& userTableId, const TPathId& indexPathId);
IActor* CreateCdcStreamChangeSender(const TDataShardId& dataShard, const TPathId& streamPathId);
IActor* CreateIncrRestoreChangeSender(const TActorId& changeServerActor, const TDataShardId& dataShard, const TTableId& userTableId, const TPathId& restoreTargetPathId);

} // NDataShard
} // NKikimr
Loading

0 comments on commit bcf8689

Please sign in to comment.