@@ -44,7 +44,9 @@ namespace NKikimr::NBsController {
44
44
void TBlobStorageController::TConsoleInteraction::Handle (TEvTabletPipe::TEvClientConnected::TPtr& /* ev*/ ) {
45
45
}
46
46
47
- void TBlobStorageController::TConsoleInteraction::Handle (TEvTabletPipe::TEvClientDestroyed::TPtr& /* ev*/ ) {
47
+ void TBlobStorageController::TConsoleInteraction::Handle (TEvTabletPipe::TEvClientDestroyed::TPtr& ev) {
48
+ STLOG (PRI_DEBUG, BS_CONTROLLER, BSC33, " Console pipe destroyed" , (ConsolePipe, ConsolePipe),
49
+ (ClientId, ev->Get ()->ClientId ), (Working, Working));
48
50
ConsolePipe = {};
49
51
if (Working) {
50
52
if (ClientId) {
@@ -56,17 +58,13 @@ namespace NKikimr::NBsController {
56
58
}
57
59
58
60
void TBlobStorageController::TConsoleInteraction::MakeGetBlock () {
61
+ STLOG (PRI_DEBUG, BS_CONTROLLER, BSC34, " Issuing GetBlock for BSC" );
59
62
auto ev = std::make_unique<TEvBlobStorage::TEvGetBlock>(Self.TabletID (), TInstant::Max ());
60
63
auto bsProxyEv = CreateEventForBSProxy (Self.SelfId (), Self.Info ()->GroupFor (0 , Self.Executor ()->Generation ()),
61
64
ev.release (), 0 );
62
65
TActivationContext::Schedule (TDuration::MilliSeconds (GetBlockBackoff.NextBackoffMs ()), bsProxyEv);
63
66
}
64
67
65
- void TBlobStorageController::TConsoleInteraction::MakeRetrySession () {
66
- NeedRetrySession = false ;
67
- Start ();
68
- }
69
-
70
68
void TBlobStorageController::TConsoleInteraction::Handle (TEvBlobStorage::TEvControllerProposeConfigResponse::TPtr &ev) {
71
69
if (!Working) {
72
70
return ;
@@ -186,8 +184,10 @@ namespace NKikimr::NBsController {
186
184
}
187
185
188
186
void TBlobStorageController::TConsoleInteraction::Stop () {
187
+ STLOG (PRI_DEBUG, BS_CONTROLLER, BSC35, " Stopping console interaction" , (ConsolePipe, ConsolePipe), (Working, Working));
189
188
if (ConsolePipe) {
190
189
NTabletPipe::CloseClient (Self.SelfId (), ConsolePipe);
190
+ ConsolePipe = {};
191
191
}
192
192
Working = false ;
193
193
}
@@ -200,8 +200,8 @@ namespace NKikimr::NBsController {
200
200
auto & record = ev->Get ()->Record ;
201
201
switch (auto status = record.GetStatus ()) {
202
202
case NKikimrBlobStorage::TEvControllerConsoleCommitResponse::SessionMismatch:
203
+ NTabletPipe::CloseAndForgetClient (Self.SelfId (), ConsolePipe);
203
204
MakeGetBlock ();
204
- NeedRetrySession = true ;
205
205
break ;
206
206
207
207
case NKikimrBlobStorage::TEvControllerConsoleCommitResponse::NotCommitted:
@@ -226,10 +226,13 @@ namespace NKikimr::NBsController {
226
226
auto & record = ev->Get ()->Record ;
227
227
228
228
const bool reasonOngoingCommit = CommitInProgress || (ClientId && ClientId != ev->Sender );
229
- if (reasonOngoingCommit || (!Self.EnableConfigV2 && !record.GetSwitchEnableConfigV2 ())) {
229
+ if (!ConsolePipe || reasonOngoingCommit || (!Self.EnableConfigV2 && !record.GetSwitchEnableConfigV2 ())) {
230
230
// reply to newly came query
231
231
const TActorId temp = std::exchange (ClientId, ev->Sender );
232
- if (reasonOngoingCommit) {
232
+ if (!ConsolePipe) {
233
+ IssueGRpcResponse (NKikimrBlobStorage::TEvControllerReplaceConfigResponse::SessionClosed,
234
+ " connection to Console tablet terminated" );
235
+ } else if (reasonOngoingCommit) {
233
236
IssueGRpcResponse (NKikimrBlobStorage::TEvControllerReplaceConfigResponse::OngoingCommit, " ongoing commit" );
234
237
} else {
235
238
IssueGRpcResponse (NKikimrBlobStorage::TEvControllerReplaceConfigResponse::InvalidRequest, " configuration v2 is disabled" , true );
@@ -400,6 +403,8 @@ namespace NKikimr::NBsController {
400
403
validateConfigEv->Record .SetYAML (record.GetClusterYaml ());
401
404
validateConfigEv->Record .SetAllowUnknownFields (record.GetAllowUnknownFields ());
402
405
validateConfigEv->Record .SetBypassMetadataChecks (record.GetBypassMetadataChecks ());
406
+ STLOG (PRI_DEBUG, BS_CONTROLLER, BSC36, " Sending TEvControllerValidateConfigRequest to console" ,
407
+ (ConsolePipe, ConsolePipe));
403
408
NTabletPipe::SendData (Self.SelfId (), ConsolePipe, validateConfigEv.release ());
404
409
}
405
410
@@ -451,8 +456,8 @@ namespace NKikimr::NBsController {
451
456
auto & record = ev->Get ()->Record ;
452
457
switch (auto status = record.GetStatus ()) {
453
458
case NKikimrBlobStorage::TEvControllerValidateConfigResponse::IdPipeServerMismatch:
459
+ NTabletPipe::CloseAndForgetClient (Self.SelfId (), ConsolePipe);
454
460
MakeGetBlock ();
455
- NeedRetrySession = true ;
456
461
return ;
457
462
458
463
case NKikimrBlobStorage::TEvControllerValidateConfigResponse::ConfigNotValid:
@@ -531,22 +536,25 @@ namespace NKikimr::NBsController {
531
536
}
532
537
533
538
void TBlobStorageController::TConsoleInteraction::Handle (TEvBlobStorage::TEvGetBlockResult::TPtr& ev) {
539
+ auto * msg = ev->Get ();
540
+
541
+ STLOG (PRI_DEBUG, BS_CONTROLLER, BSC37, " TEvGetBlockResult received" , (ConsolePipe, ConsolePipe),
542
+ (Working, Working), (Status, msg->Status ), (BlockedGeneration, msg->BlockedGeneration ),
543
+ (Generation, Self.Executor ()->Generation ()));
544
+
534
545
if (!Working) {
535
546
return ;
536
547
}
537
- auto * msg = ev->Get ();
538
- auto status = msg->Status ;
548
+
539
549
auto blockedGeneration = msg->BlockedGeneration ;
540
550
auto generation = Self.Executor ()->Generation ();
541
- switch (status ) {
551
+ switch (msg-> Status ) {
542
552
case NKikimrProto::OK:
543
553
if (generation <= blockedGeneration) {
544
- Self.HandlePoison (TActivationContext::AsActorContext ());
545
- return ;
554
+ return Self.HandlePoison (TActivationContext::AsActorContext ());
546
555
}
547
- if (generation == blockedGeneration + 1 && NeedRetrySession) {
548
- MakeRetrySession ();
549
- return ;
556
+ if (generation == blockedGeneration + 1 && !ConsolePipe) {
557
+ return Start ();
550
558
}
551
559
Y_VERIFY_DEBUG_S (generation == blockedGeneration + 1 , " BlockedGeneration#" << blockedGeneration
552
560
<< " Tablet generation#" << generation);
0 commit comments