|
19 | 19 | #include <ydb/core/base/feature_flags.h>
|
20 | 20 | #include <ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_iter.h>
|
21 | 21 | #include <ydb/core/blobstorage/vdisk/localrecovery/localrecovery_public.h>
|
| 22 | +#include <ydb/core/blobstorage/vdisk/balance/balancing_actor.h> |
22 | 23 | #include <ydb/core/blobstorage/vdisk/hullop/blobstorage_hull.h>
|
23 | 24 | #include <ydb/core/blobstorage/vdisk/hullop/blobstorage_hulllog.h>
|
24 | 25 | #include <ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge.h>
|
@@ -1711,6 +1712,7 @@ namespace NKikimr {
|
1711 | 1712 | ReplDone = true;
|
1712 | 1713 | }
|
1713 | 1714 | UpdateReplState();
|
| 1715 | + RunBalancing(ctx); |
1714 | 1716 | }
|
1715 | 1717 |
|
1716 | 1718 | void SkeletonErrorState(const TActorContext &ctx,
|
@@ -2449,6 +2451,20 @@ namespace NKikimr {
|
2449 | 2451 | ev->Get()->Callback({}, "replication is not in progress");
|
2450 | 2452 | }
|
2451 | 2453 |
|
| 2454 | + void RunBalancing(const TActorContext &ctx) { |
| 2455 | + if (!Config->FeatureFlags.GetUseVDisksBalancing()) { |
| 2456 | + return; |
| 2457 | + } |
| 2458 | + if (BalancingId) { |
| 2459 | + ActiveActors.Erase(BalancingId); |
| 2460 | + } |
| 2461 | + auto balancingCtx = std::make_shared<TBalancingCtx>( |
| 2462 | + VCtx, PDiskCtx, SelfId(), Hull->GetHullDs()->GetIndexSnapshot(), Config, GInfo |
| 2463 | + ); |
| 2464 | + BalancingId = ctx.Register(CreateBalancingActor(balancingCtx)); |
| 2465 | + ActiveActors.Insert(BalancingId, __FILE__, __LINE__, ctx, NKikimrServices::BLOBSTORAGE); |
| 2466 | + } |
| 2467 | + |
2452 | 2468 | // NOTES: we have 4 state functions, one of which is an error state (StateDatabaseError) and
|
2453 | 2469 | // others are good: StateLocalRecovery, StateSyncGuidRecovery, StateNormal
|
2454 | 2470 | // We switch between states in the following manner:
|
@@ -2622,6 +2638,7 @@ namespace NKikimr {
|
2622 | 2638 | hFunc(NPDisk::TEvChunkForgetResult, Handle)
|
2623 | 2639 | FFunc(TEvPrivate::EvCheckSnapshotExpiration, CheckSnapshotExpiration)
|
2624 | 2640 | hFunc(TEvReplInvoke, Handle)
|
| 2641 | + CFunc(TEvStartBalancing::EventType, RunBalancing) |
2625 | 2642 | )
|
2626 | 2643 |
|
2627 | 2644 | STRICT_STFUNC(StateDatabaseError,
|
@@ -2730,6 +2747,7 @@ namespace NKikimr {
|
2730 | 2747 | bool CommenceRepl = false;
|
2731 | 2748 | TActorId ScrubId;
|
2732 | 2749 | TActorId DefragId;
|
| 2750 | + TActorId BalancingId; |
2733 | 2751 | bool HasUnreadableBlobs = false;
|
2734 | 2752 | std::unique_ptr<TVDiskCompactionState> VDiskCompactionState;
|
2735 | 2753 | TMemorizableControlWrapper EnableVPatch;
|
|
0 commit comments