@@ -39,6 +39,21 @@ namespace NPDisk {
39
39
40
40
LWTRACE_USING (BLOBSTORAGE_PROVIDER);
41
41
42
+ void CreatePDiskActor (
43
+ TGenericExecutorThread& executorThread,
44
+ const TIntrusivePtr<::NMonitoring::TDynamicCounters>& counters,
45
+ const TIntrusivePtr<TPDiskConfig> &cfg,
46
+ const NPDisk::TMainKey &mainKey,
47
+ ui32 pDiskID, ui32 poolId, ui32 nodeId
48
+ ) {
49
+
50
+ TActorId actorId = executorThread.RegisterActor (CreatePDisk (cfg, mainKey, counters), TMailboxType::ReadAsFilled, poolId);
51
+
52
+ TActorId pDiskServiceId = MakeBlobStoragePDiskID (nodeId, pDiskID);
53
+
54
+ executorThread.ActorSystem ->RegisterLocalService (pDiskServiceId, actorId);
55
+ }
56
+
42
57
// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
43
58
// PDisk Actor
44
59
// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -993,29 +1008,48 @@ class TPDiskActor : public TActorBootstrapped<TPDiskActor> {
993
1008
return ;
994
1009
}
995
1010
1011
+ if (PendingRestartResponse) {
1012
+ PendingRestartResponse (restartAllowed, ev->Get ()->Details );
1013
+ PendingRestartResponse = {};
1014
+ }
1015
+
996
1016
if (restartAllowed) {
997
- MainKey = ev->Get ()->MainKey ;
1017
+ NPDisk::TMainKey newMainKey = ev->Get ()->MainKey ;
1018
+
998
1019
SecureWipeBuffer ((ui8*)ev->Get ()->MainKey .Keys .data (), sizeof (NPDisk::TKey) * ev->Get ()->MainKey .Keys .size ());
1020
+
999
1021
LOG_NOTICE_S (*TlsActivationContext, NKikimrServices::BS_PDISK, " PDiskId# " << PDisk->PDiskId
1000
1022
<< " Going to restart PDisk since recieved TEvAskWardenRestartPDiskResult" );
1001
1023
1024
+ const TActorIdentity& thisActorId = SelfId ();
1025
+ ui32 nodeId = thisActorId.NodeId ();
1026
+ ui32 poolId = thisActorId.PoolID ();
1027
+ ui32 pdiskId = PDisk->PDiskId ;
1028
+
1002
1029
PDisk->Stop ();
1003
1030
1031
+ TIntrusivePtr<TPDiskConfig> actorCfg = std::move (Cfg);
1032
+
1004
1033
auto & newCfg = ev->Get ()->Config ;
1034
+
1005
1035
if (newCfg) {
1006
- Y_VERIFY_S (Cfg->PDiskId == PDisk->PDiskId ,
1007
- " New config's PDiskId# " << newCfg->PDiskId << " is not equal to real PDiskId# " << PDisk->PDiskId );
1008
- Cfg = std::move (newCfg);
1036
+ Y_VERIFY_S (newCfg->PDiskId == pdiskId,
1037
+ " New config's PDiskId# " << newCfg->PDiskId << " is not equal to real PDiskId# " << pdiskId);
1038
+
1039
+ actorCfg = std::move (newCfg);
1009
1040
}
1010
1041
1011
- StartPDiskThread ();
1042
+ const TActorContext& actorCtx = ActorContext ();
1012
1043
1013
- Send (ev->Sender , new TEvBlobStorage::TEvNotifyWardenPDiskRestarted (PDisk->PDiskId ));
1014
- }
1044
+ auto & counters = AppData (actorCtx)->Counters ;
1015
1045
1016
- if (PendingRestartResponse) {
1017
- PendingRestartResponse (restartAllowed, ev->Get ()->Details );
1018
- PendingRestartResponse = {};
1046
+ TGenericExecutorThread& executorThread = actorCtx.ExecutorThread ;
1047
+
1048
+ PassAway ();
1049
+
1050
+ CreatePDiskActor (executorThread, counters, actorCfg, newMainKey, pdiskId, poolId, nodeId);
1051
+
1052
+ Send (ev->Sender , new TEvBlobStorage::TEvNotifyWardenPDiskRestarted (pdiskId));
1019
1053
}
1020
1054
}
1021
1055
@@ -1290,10 +1324,7 @@ IActor* CreatePDisk(const TIntrusivePtr<TPDiskConfig> &cfg, const NPDisk::TMainK
1290
1324
1291
1325
void TRealPDiskServiceFactory::Create (const TActorContext &ctx, ui32 pDiskID,
1292
1326
const TIntrusivePtr<TPDiskConfig> &cfg, const NPDisk::TMainKey &mainKey, ui32 poolId, ui32 nodeId) {
1293
- TActorId actorId = ctx.ExecutorThread .RegisterActor (
1294
- CreatePDisk (cfg, mainKey, AppData (ctx)->Counters ), TMailboxType::ReadAsFilled, poolId);
1295
- TActorId pDiskServiceId = MakeBlobStoragePDiskID (nodeId, pDiskID);
1296
- ctx.ExecutorThread .ActorSystem ->RegisterLocalService (pDiskServiceId, actorId);
1327
+ CreatePDiskActor (ctx.ExecutorThread , AppData (ctx)->Counters , cfg, mainKey, pDiskID, poolId, nodeId);
1297
1328
}
1298
1329
1299
1330
} // NKikimr
0 commit comments