Skip to content

Commit 29491e2

Browse files
authored
Merge ab4089e into a4e2878
2 parents a4e2878 + ab4089e commit 29491e2

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

ydb/core/persqueue/read_balancer.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,27 @@ void TPersQueueReadBalancer::Handle(TEvPersQueue::TEvUpdateBalancerConfig::TPtr
450450
Path = std::move(record.GetPath());
451451
TxId = record.GetTxId();
452452
TabletConfig = std::move(record.GetTabletConfig());
453+
454+
if (!TabletConfig.GetAllPartitions().size()) {
455+
for (auto& p : record.GetPartitions()) {
456+
auto* ap = TabletConfig.AddAllPartitions();
457+
ap->SetPartitionId(p.GetPartition());
458+
ap->SetTabletId(p.GetTabletId());
459+
ap->SetCreateVersion(p.GetCreateVersion());
460+
ap->MutableKeyRange()->SetFromBound(p.GetKeyRange().GetFromBound());
461+
ap->MutableKeyRange()->SetToBound(p.GetKeyRange().GetToBound());
462+
ap->SetStatus(p.GetStatus());
463+
ap->MutableParentPartitionIds()->Reserve(p.GetParentPartitionIds().size());
464+
for (const auto parent : p.GetParentPartitionIds()) {
465+
ap->MutableParentPartitionIds()->AddAlreadyReserved(parent);
466+
}
467+
ap->MutableChildPartitionIds()->Reserve(p.GetChildPartitionIds().size());
468+
for (const auto children : p.GetChildPartitionIds()) {
469+
ap->MutableChildPartitionIds()->AddAlreadyReserved(children);
470+
}
471+
}
472+
}
473+
453474
Migrate(TabletConfig);
454475

455476
SchemeShardId = record.GetSchemeShardId();
@@ -832,7 +853,7 @@ void TPersQueueReadBalancer::UpdateConfigCounters() {
832853
return;
833854
}
834855

835-
size_t inactiveCount = std::count_if(TabletConfig.GetPartitions().begin(), TabletConfig.GetPartitions().end(), [](auto& p) {
856+
size_t inactiveCount = std::count_if(TabletConfig.GetAllPartitions().begin(), TabletConfig.GetAllPartitions().end(), [](auto& p) {
836857
return p.GetStatus() == NKikimrPQ::ETopicPartitionStatus::Inactive;
837858
});
838859

0 commit comments

Comments
 (0)