aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnaury <snaury@ydb.tech>2023-07-17 17:48:35 +0300
committersnaury <snaury@ydb.tech>2023-07-17 17:48:35 +0300
commit3faf3cf568022f471b9baadf091ea93089ba9be3 (patch)
tree24e8af2ea8ed1b60a39b0fd4b8a22d06405f67f2
parent89ec8bd3dbb74ea165a4340b80dfd52f319fd4a1 (diff)
downloadydb-3faf3cf568022f471b9baadf091ea93089ba9be3.tar.gz
Make SignalTabletActive call mandatory, common TEvPoison handling in tablets KIKIMR-18752
-rw-r--r--ydb/core/cms/cms.cpp6
-rw-r--r--ydb/core/cms/cms_impl.h1
-rw-r--r--ydb/core/cms/cms_tx_load_state.cpp1
-rw-r--r--ydb/core/cms/console/console.cpp5
-rw-r--r--ydb/core/cms/console/console__load_state.cpp1
-rw-r--r--ydb/core/cms/console/console_impl.h1
-rw-r--r--ydb/core/cms/console/console_ut_configs.cpp12
-rw-r--r--ydb/core/keyvalue/keyvalue_flat_impl.h6
-rw-r--r--ydb/core/mind/bscontroller/bsc.cpp16
-rw-r--r--ydb/core/mind/bscontroller/impl.h6
-rw-r--r--ydb/core/mind/hive/hive_impl.cpp11
-rw-r--r--ydb/core/mind/hive/hive_impl.h1
-rw-r--r--ydb/core/mind/node_broker.cpp7
-rw-r--r--ydb/core/mind/node_broker_impl.h3
-rw-r--r--ydb/core/mind/tenant_slot_broker.cpp36
-rw-r--r--ydb/core/mind/tenant_slot_broker__load_state.cpp3
-rw-r--r--ydb/core/mind/tenant_slot_broker_impl.h8
-rw-r--r--ydb/core/persqueue/pq_impl.cpp4
-rw-r--r--ydb/core/persqueue/pq_impl.h2
-rw-r--r--ydb/core/persqueue/read_balancer.h4
-rw-r--r--ydb/core/persqueue/ut/pqtablet_mock.cpp8
-rw-r--r--ydb/core/persqueue/ut/pqtablet_mock.h1
-rw-r--r--ydb/core/tablet/tablet_pipe_ut.cpp25
-rw-r--r--ydb/core/tablet/tablet_pipecache_ut.cpp6
-rw-r--r--ydb/core/tablet_flat/datetime_ut.cpp5
-rw-r--r--ydb/core/tablet_flat/decimal_ut.cpp5
-rw-r--r--ydb/core/tablet_flat/flat_executor_leases_ut.cpp8
-rw-r--r--ydb/core/tablet_flat/flat_executor_ut.cpp5
-rw-r--r--ydb/core/tablet_flat/tablet_flat_executed.cpp26
-rw-r--r--ydb/core/tablet_flat/tablet_flat_executed.h26
-rw-r--r--ydb/core/tablet_flat/test/libs/exec/dummy.h6
-rw-r--r--ydb/core/test_tablet/test_shard_impl.h1
-rw-r--r--ydb/core/testlib/fake_coordinator.h5
-rw-r--r--ydb/core/testlib/fake_scheme_shard.h16
-rw-r--r--ydb/core/testlib/tablet_helpers.cpp28
-rw-r--r--ydb/core/testlib/tenant_runtime.cpp24
-rw-r--r--ydb/core/tx/columnshard/columnshard.cpp17
-rw-r--r--ydb/core/tx/columnshard/columnshard_impl.cpp6
-rw-r--r--ydb/core/tx/columnshard/columnshard_impl.h9
-rw-r--r--ydb/core/tx/coordinator/coordinator_impl.cpp5
-rw-r--r--ydb/core/tx/coordinator/coordinator_impl.h4
-rw-r--r--ydb/core/tx/datashard/datashard.cpp8
-rw-r--r--ydb/core/tx/datashard/datashard_impl.h31
-rw-r--r--ydb/core/tx/mediator/mediator_impl.cpp7
-rw-r--r--ydb/core/tx/mediator/mediator_impl.h6
-rw-r--r--ydb/core/tx/replication/controller/controller.cpp40
-rw-r--r--ydb/core/tx/replication/controller/controller_impl.h3
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_alter_fs.cpp8
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_impl.cpp8
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_impl.h1
-rw-r--r--ydb/core/tx/schemeshard/ut_helpers/test_env.cpp62
-rw-r--r--ydb/core/tx/sequenceshard/sequenceshard_impl.cpp17
-rw-r--r--ydb/core/tx/sequenceshard/sequenceshard_impl.h2
-rw-r--r--ydb/core/tx/tx_allocator/txallocator_impl.cpp8
-rw-r--r--ydb/core/tx/tx_allocator/txallocator_impl.h12
55 files changed, 246 insertions, 337 deletions
diff --git a/ydb/core/cms/cms.cpp b/ydb/core/cms/cms.cpp
index e71a37aa33..263ea0fe8d 100644
--- a/ydb/core/cms/cms.cpp
+++ b/ydb/core/cms/cms.cpp
@@ -33,11 +33,17 @@ namespace NKikimr::NCms {
using namespace NNodeWhiteboard;
using namespace NKikimrCms;
+void TCms::DefaultSignalTabletActive(const TActorContext &)
+{
+ // must be empty
+}
+
void TCms::OnActivateExecutor(const TActorContext &ctx)
{
if (AppData(ctx)->DomainsInfo->Domains.size() > 1) {
NotSupportedReason = "Multiple domains are not supported.";
Become(&TThis::StateNotSupported);
+ SignalTabletActive(ctx);
return;
}
diff --git a/ydb/core/cms/cms_impl.h b/ydb/core/cms/cms_impl.h
index f8daaada1c..bd31ae2624 100644
--- a/ydb/core/cms/cms_impl.h
+++ b/ydb/core/cms/cms_impl.h
@@ -274,6 +274,7 @@ private:
}
}
+ void DefaultSignalTabletActive(const TActorContext &ctx) override;
void OnActivateExecutor(const TActorContext &ctx) override;
void OnDetach(const TActorContext &ctx) override;
void OnTabletDead(TEvTablet::TEvTabletDead::TPtr &ev, const TActorContext &ctx) override;
diff --git a/ydb/core/cms/cms_tx_load_state.cpp b/ydb/core/cms/cms_tx_load_state.cpp
index 663d474602..c77e30157a 100644
--- a/ydb/core/cms/cms_tx_load_state.cpp
+++ b/ydb/core/cms/cms_tx_load_state.cpp
@@ -224,6 +224,7 @@ public:
void Complete(const TActorContext &ctx) override {
LOG_DEBUG(ctx, NKikimrServices::CMS, "TTxLoadState Complete");
Self->Become(&TCms::StateWork);
+ Self->SignalTabletActive(ctx);
Self->SchedulePermissionsCleanup(ctx);
Self->ScheduleNotificationsCleanup(ctx);
Self->ScheduleLogCleanup(ctx);
diff --git a/ydb/core/cms/console/console.cpp b/ydb/core/cms/console/console.cpp
index 0b9f8633fc..a89c91da23 100644
--- a/ydb/core/cms/console/console.cpp
+++ b/ydb/core/cms/console/console.cpp
@@ -12,6 +12,11 @@
namespace NKikimr::NConsole {
+void TConsole::DefaultSignalTabletActive(const TActorContext &)
+{
+ // must be empty
+}
+
void TConsole::OnActivateExecutor(const TActorContext &ctx)
{
auto domains = AppData(ctx)->DomainsInfo;
diff --git a/ydb/core/cms/console/console__load_state.cpp b/ydb/core/cms/console/console__load_state.cpp
index b70c1dedb1..f2977c7f06 100644
--- a/ydb/core/cms/console/console__load_state.cpp
+++ b/ydb/core/cms/console/console__load_state.cpp
@@ -66,6 +66,7 @@ public:
LOG_DEBUG(ctx, NKikimrServices::CMS, "TConsole::TTxLoadState Complete");
Self->Become(&TConsole::StateWork);
+ Self->SignalTabletActive(ctx);
ctx.Send(Self->TenantsManager->SelfId(), new TTenantsManager::TEvPrivate::TEvStateLoaded);
ctx.Send(Self->ConfigsManager->SelfId(), new TConfigsManager::TEvPrivate::TEvStateLoaded);
diff --git a/ydb/core/cms/console/console_impl.h b/ydb/core/cms/console/console_impl.h
index a3033e79f9..d5e8a7d98a 100644
--- a/ydb/core/cms/console/console_impl.h
+++ b/ydb/core/cms/console/console_impl.h
@@ -54,6 +54,7 @@ private:
ITransaction *CreateTxLoadState();
ITransaction *CreateTxSetConfig(TEvConsole::TEvSetConfigRequest::TPtr &ev);
+ void DefaultSignalTabletActive(const TActorContext &ctx) override;
void OnActivateExecutor(const TActorContext &ctx) override;
void OnDetach(const TActorContext &ctx) override;
void OnTabletDead(TEvTablet::TEvTabletDead::TPtr &ev, const TActorContext &ctx) override;
diff --git a/ydb/core/cms/console/console_ut_configs.cpp b/ydb/core/cms/console/console_ut_configs.cpp
index 9cd532740b..de27e7ee9e 100644
--- a/ydb/core/cms/console/console_ut_configs.cpp
+++ b/ydb/core/cms/console/console_ut_configs.cpp
@@ -2450,9 +2450,15 @@ Y_UNIT_TEST_SUITE(TConsoleConfigTests) {
namespace {
class TConfigProxy : public TActor<TConfigProxy>, public TTabletExecutedFlat {
+ void DefaultSignalTabletActive(const TActorContext &) override
+ {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext &ctx) override
{
Become(&TThis::StateWork);
+ SignalTabletActive(ctx);
ctx.Send(Sink, new TEvents::TEvWakeup);
}
@@ -2481,11 +2487,7 @@ public:
STFUNC(StateInit)
{
- switch (ev->GetTypeRewrite()) {
- HFunc(TEvConsole::TEvConfigNotificationRequest, Handle);
- default:
- StateInitImpl(ev, SelfId());
- }
+ StateInitImpl(ev, SelfId());
}
STFUNC(StateWork)
diff --git a/ydb/core/keyvalue/keyvalue_flat_impl.h b/ydb/core/keyvalue/keyvalue_flat_impl.h
index 7b3eaca03b..ac06275b6f 100644
--- a/ydb/core/keyvalue/keyvalue_flat_impl.h
+++ b/ydb/core/keyvalue/keyvalue_flat_impl.h
@@ -261,6 +261,10 @@ protected:
HandleDie(ctx);
}
+ void DefaultSignalTabletActive(const TActorContext &) final {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext &ctx) override {
Executor()->RegisterExternalTabletCounters(State.TakeTabletCounters());
State.SetupResourceMetrics(Executor()->GetResourceMetrics());
@@ -484,7 +488,7 @@ public:
virtual void CreatedHook(const TActorContext &ctx)
{
- Y_UNUSED(ctx);
+ SignalTabletActive(ctx);
}
virtual bool HandleHook(STFUNC_SIG)
diff --git a/ydb/core/mind/bscontroller/bsc.cpp b/ydb/core/mind/bscontroller/bsc.cpp
index 921aa99ce8..6117764369 100644
--- a/ydb/core/mind/bscontroller/bsc.cpp
+++ b/ydb/core/mind/bscontroller/bsc.cpp
@@ -169,22 +169,6 @@ void TBlobStorageController::IssueInitialGroupContent() {
Send(StatProcessorActorId, ev.Release());
}
-void TBlobStorageController::Handle(TEvents::TEvPoisonPill::TPtr&) {
- Become(&TThis::StateBroken);
- for (TActorId *ptr : {&SelfHealId, &StatProcessorActorId, &SystemViewsCollectorId}) {
- if (const TActorId actorId = std::exchange(*ptr, {})) {
- TActivationContext::Send(new IEventHandle(TEvents::TSystem::Poison, 0, actorId, SelfId(), nullptr, 0));
- }
- }
- for (const auto& [id, info] : GroupMap) {
- if (auto& actorId = info->VirtualGroupSetupMachineId) {
- TActivationContext::Send(new IEventHandle(TEvents::TSystem::Poison, 0, actorId, SelfId(), nullptr, 0));
- actorId = {};
- }
- }
- TActivationContext::Send(new IEventHandle(TEvents::TSystem::Poison, 0, Tablet(), SelfId(), nullptr, 0));
-}
-
void TBlobStorageController::NotifyNodesAwaitingKeysForGroups(ui32 groupId) {
if (const auto it = NodesAwaitingKeysForGroup.find(groupId); it != NodesAwaitingKeysForGroup.end()) {
TSet<ui32> nodes = std::move(it->second);
diff --git a/ydb/core/mind/bscontroller/impl.h b/ydb/core/mind/bscontroller/impl.h
index d9c7bfaafc..74f89d775f 100644
--- a/ydb/core/mind/bscontroller/impl.h
+++ b/ydb/core/mind/bscontroller/impl.h
@@ -1760,7 +1760,6 @@ private:
void Handle(TEvBlobStorage::TEvControllerProposeGroupKey::TPtr &ev);
void ForwardToSystemViewsCollector(STATEFN_SIG);
void Handle(TEvPrivate::TEvUpdateSystemViews::TPtr &ev);
- void Handle(TEvents::TEvPoisonPill::TPtr& ev);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Scrub handling
@@ -1984,7 +1983,6 @@ public:
fFunc(NSysView::TEvSysView::EvGetStorageStatsRequest, ForwardToSystemViewsCollector);
fFunc(TEvPrivate::EvUpdateSystemViews, EnqueueIncomingEvent);
hFunc(TEvInterconnect::TEvNodesInfo, Handle);
- hFunc(TEvents::TEvPoisonPill, Handle);
hFunc(TEvTabletPipe::TEvServerConnected, Handle);
hFunc(TEvTabletPipe::TEvServerDisconnected, Handle);
fFunc(TEvPrivate::EvUpdateSelfHealCounters, EnqueueIncomingEvent);
@@ -2012,10 +2010,6 @@ public:
}
}
- STFUNC(StateBroken) {
- HandleDefaultEvents(ev, SelfId());
- }
-
void LoadFinished() {
STLOG(PRI_DEBUG, BS_CONTROLLER, BSC09, "LoadFinished");
Become(&TThis::StateWork);
diff --git a/ydb/core/mind/hive/hive_impl.cpp b/ydb/core/mind/hive/hive_impl.cpp
index 682a54888c..30ea7e4fc2 100644
--- a/ydb/core/mind/hive/hive_impl.cpp
+++ b/ydb/core/mind/hive/hive_impl.cpp
@@ -50,11 +50,6 @@ void THive::Handle(TEvHive::TEvAdoptTablet::TPtr& ev) {
Execute(CreateAdoptTablet(rec, ev->Sender, ev->Cookie));
}
-void THive::Handle(TEvents::TEvPoisonPill::TPtr&) {
- BLOG_D("Handle TEvents::TEvPoisonPill");
- Send(Tablet(), new TEvents::TEvPoisonPill);
-}
-
void THive::Handle(TEvTabletPipe::TEvClientConnected::TPtr& ev) {
TEvTabletPipe::TEvClientConnected *msg = ev->Get();
if (msg->ClientId == BSControllerPipeClient && msg->Status != NKikimrProto::OK) {
@@ -2567,7 +2562,6 @@ void THive::ProcessEvent(std::unique_ptr<IEventHandle> event) {
hFunc(TEvLocal::TEvTabletStatus, Handle); // from bootqueue
hFunc(TEvLocal::TEvRegisterNode, Handle); // from local
hFunc(TEvBlobStorage::TEvControllerSelectGroupsResult, Handle);
- hFunc(TEvents::TEvPoisonPill, Handle);
hFunc(TEvTabletPipe::TEvClientConnected, Handle);
hFunc(TEvTabletPipe::TEvClientDestroyed, Handle);
hFunc(TEvTabletPipe::TEvServerConnected, Handle);
@@ -2639,6 +2633,10 @@ void THive::EnqueueIncomingEvent(STATEFN_SIG) {
STFUNC(THive::StateInit) {
switch (ev->GetTypeRewrite()) {
hFunc(TEvInterconnect::TEvNodesInfo, Handle);
+ // We subscribe to config updates before hive is fully loaded
+ hFunc(TEvPrivate::TEvProcessIncomingEvent, Handle);
+ fFunc(NConsole::TEvConsole::TEvConfigNotificationRequest::EventType, EnqueueIncomingEvent);
+ fFunc(NConsole::TEvConfigsDispatcher::TEvSetConfigSubscriptionResponse::EventType, EnqueueIncomingEvent);
default:
StateInitImpl(ev, SelfId());
}
@@ -2657,7 +2655,6 @@ STFUNC(THive::StateWork) {
fFunc(TEvLocal::TEvTabletStatus::EventType, EnqueueIncomingEvent); // from bootqueue
fFunc(TEvLocal::TEvRegisterNode::EventType, EnqueueIncomingEvent); // from local
fFunc(TEvBlobStorage::TEvControllerSelectGroupsResult::EventType, EnqueueIncomingEvent);
- fFunc(TEvents::TEvPoisonPill::EventType, EnqueueIncomingEvent);
fFunc(TEvTabletPipe::TEvClientConnected::EventType, EnqueueIncomingEvent);
fFunc(TEvTabletPipe::TEvClientDestroyed::EventType, EnqueueIncomingEvent);
fFunc(TEvTabletPipe::TEvServerConnected::EventType, EnqueueIncomingEvent);
diff --git a/ydb/core/mind/hive/hive_impl.h b/ydb/core/mind/hive/hive_impl.h
index 49f35e549c..282e6f6ec4 100644
--- a/ydb/core/mind/hive/hive_impl.h
+++ b/ydb/core/mind/hive/hive_impl.h
@@ -445,7 +445,6 @@ protected:
void Handle(TEvLocal::TEvTabletStatus::TPtr&);
void Handle(TEvLocal::TEvRegisterNode::TPtr&);
void Handle(TEvBlobStorage::TEvControllerSelectGroupsResult::TPtr&);
- void Handle(TEvents::TEvPoisonPill::TPtr&);
void Handle(TEvTabletPipe::TEvClientConnected::TPtr&);
void Handle(TEvTabletPipe::TEvClientDestroyed::TPtr&);
void Handle(TEvTabletPipe::TEvServerConnected::TPtr&);
diff --git a/ydb/core/mind/node_broker.cpp b/ydb/core/mind/node_broker.cpp
index 9027d0540d..7d23621c61 100644
--- a/ydb/core/mind/node_broker.cpp
+++ b/ydb/core/mind/node_broker.cpp
@@ -753,13 +753,6 @@ void TNodeBroker::Handle(TEvConsole::TEvReplaceConfigSubscriptionsResponse::TPtr
ProcessTx(0, CreateTxUpdateConfigSubscription(ev), ctx);
}
-void TNodeBroker::Handle(TEvents::TEvPoisonPill::TPtr &ev,
- const TActorContext &ctx)
-{
- Y_UNUSED(ev);
- ctx.Send(Tablet(), new TEvents::TEvPoisonPill);
-}
-
void TNodeBroker::Handle(TEvNodeBroker::TEvListNodes::TPtr &ev,
const TActorContext &)
{
diff --git a/ydb/core/mind/node_broker_impl.h b/ydb/core/mind/node_broker_impl.h
index 8838a213ad..3a59200653 100644
--- a/ydb/core/mind/node_broker_impl.h
+++ b/ydb/core/mind/node_broker_impl.h
@@ -178,7 +178,6 @@ private:
switch (ev->GetTypeRewrite()) {
HFuncTraced(TEvConsole::TEvConfigNotificationRequest, Handle);
HFuncTraced(TEvConsole::TEvReplaceConfigSubscriptionsResponse, Handle);
- HFuncTraced(TEvents::TEvPoisonPill, Handle);
HFuncTraced(TEvNodeBroker::TEvListNodes, Handle);
HFuncTraced(TEvNodeBroker::TEvResolveNode, Handle);
HFuncTraced(TEvNodeBroker::TEvRegistrationRequest, Handle);
@@ -281,8 +280,6 @@ private:
const TActorContext &ctx);
void Handle(TEvConsole::TEvReplaceConfigSubscriptionsResponse::TPtr &ev,
const TActorContext &ctx);
- void Handle(TEvents::TEvPoisonPill::TPtr &ev,
- const TActorContext &ctx);
void Handle(TEvNodeBroker::TEvListNodes::TPtr &ev,
const TActorContext &ctx);
void Handle(TEvNodeBroker::TEvResolveNode::TPtr &ev,
diff --git a/ydb/core/mind/tenant_slot_broker.cpp b/ydb/core/mind/tenant_slot_broker.cpp
index 5be6683ff1..c8c8be0e81 100644
--- a/ydb/core/mind/tenant_slot_broker.cpp
+++ b/ydb/core/mind/tenant_slot_broker.cpp
@@ -402,6 +402,11 @@ ui64 TTenantSlotBroker::Generation() const {
return Executor()->Generation();
}
+void TTenantSlotBroker::DefaultSignalTabletActive(const TActorContext &)
+{
+ // must be empty
+}
+
void TTenantSlotBroker::OnActivateExecutor(const TActorContext &ctx)
{
RequestId = Now().GetValue();
@@ -415,8 +420,6 @@ void TTenantSlotBroker::OnActivateExecutor(const TActorContext &ctx)
tabletCounters->RemoveSubgroup("type", "TENANT_SLOT_BROKER");
Counters = new TCounters(tabletCounters->GetSubgroup("type", "TENANT_SLOT_BROKER"));
- NConsole::SubscribeViaConfigDispatcher(ctx, {(ui32)NKikimrConsole::TConfigItem::TenantSlotBrokerConfigItem}, ctx.SelfID);
-
ProcessTx(CreateTxInitScheme(), ctx);
}
@@ -437,14 +440,6 @@ void TTenantSlotBroker::OnTabletDead(TEvTablet::TEvTabletDead::TPtr &,
Die(ctx);
}
-void TTenantSlotBroker::Enqueue(TAutoPtr<IEventHandle> &ev)
-{
- LOG_DEBUG(*TlsActivationContext, NKikimrServices::TENANT_SLOT_BROKER,
- "Enqueue: %" PRIu64 ", event type: %" PRIu32 " event: %s",
- TabletID(), ev->GetTypeRewrite(), ev->ToString().data());
- InitQueue.push_back(ev);
-}
-
bool TTenantSlotBroker::OnRenderAppHtmlPage(NMon::TEvRemoteHttpInfo::TPtr ev,
const TActorContext &ctx)
{
@@ -627,16 +622,12 @@ void TTenantSlotBroker::LoadConfigFromProto(const NKikimrTenantSlotBroker::TConf
PendingTimeout = TDuration::MicroSeconds(config.GetPendingSlotTimeout());
}
-void TTenantSlotBroker::ProcessEnqueuedEvents(const TActorContext &ctx)
+void TTenantSlotBroker::SwitchToWork(const TActorContext &ctx)
{
- while (!InitQueue.empty()) {
- TAutoPtr<IEventHandle> &ev = InitQueue.front();
- LOG_DEBUG(ctx, NKikimrServices::TENANT_SLOT_BROKER,
- "Dequeue: %" PRIu64 ", event type: %" PRIu32 " event: %s",
- TabletID(), ev->GetTypeRewrite(), ev->ToString().data());
- ctx.ExecutorThread.Send(ev.Release());
- InitQueue.pop_front();
- }
+ Become(&TTenantSlotBroker::StateWork);
+ SignalTabletActive(ctx);
+
+ NConsole::SubscribeViaConfigDispatcher(ctx, {(ui32)NKikimrConsole::TConfigItem::TenantSlotBrokerConfigItem}, ctx.SelfID);
}
void TTenantSlotBroker::ClearState()
@@ -1650,13 +1641,6 @@ void TTenantSlotBroker::Handle(TEvConsole::TEvReplaceConfigSubscriptionsResponse
"Got config subscription id=" << ConfigSubscriptionId);
}
-void TTenantSlotBroker::Handle(TEvents::TEvPoisonPill::TPtr &ev,
- const TActorContext &ctx)
-{
- Y_UNUSED(ev);
- ctx.Send(Tablet(), new TEvents::TEvPoisonPill);
-}
-
void TTenantSlotBroker::Handle(TEvents::TEvUndelivered::TPtr &ev,
const TActorContext &ctx)
{
diff --git a/ydb/core/mind/tenant_slot_broker__load_state.cpp b/ydb/core/mind/tenant_slot_broker__load_state.cpp
index 345b131ea3..6b1c9a5730 100644
--- a/ydb/core/mind/tenant_slot_broker__load_state.cpp
+++ b/ydb/core/mind/tenant_slot_broker__load_state.cpp
@@ -188,8 +188,7 @@ public:
{
LOG_DEBUG(ctx, NKikimrServices::TENANT_SLOT_BROKER, "TTxLoadState Complete");
- Self->Become(&TTenantSlotBroker::StateWork);
- Self->ProcessEnqueuedEvents(ctx);
+ Self->SwitchToWork(ctx);
Self->TxCompleted(this, ctx);
}
diff --git a/ydb/core/mind/tenant_slot_broker_impl.h b/ydb/core/mind/tenant_slot_broker_impl.h
index 54772f58c3..3860ada118 100644
--- a/ydb/core/mind/tenant_slot_broker_impl.h
+++ b/ydb/core/mind/tenant_slot_broker_impl.h
@@ -945,11 +945,11 @@ private:
ui64 Generation() const;
+ void DefaultSignalTabletActive(const TActorContext &ctx) override;
void OnActivateExecutor(const TActorContext &ctx) override;
void OnDetach(const TActorContext &ctx) override;
void OnTabletDead(TEvTablet::TEvTabletDead::TPtr &ev,
const TActorContext &ctx) override;
- void Enqueue(TAutoPtr<IEventHandle> &ev) override;
bool OnRenderAppHtmlPage(NMon::TEvRemoteHttpInfo::TPtr ev,
const TActorContext &ctx) override;
@@ -957,7 +957,7 @@ private:
void Die(const TActorContext &ctx) override;
void LoadConfigFromProto(const NKikimrTenantSlotBroker::TConfig &config);
- void ProcessEnqueuedEvents(const TActorContext &ctx);
+ void SwitchToWork(const TActorContext &ctx);
void ClearState();
@@ -1061,8 +1061,6 @@ private:
const TActorContext &ctx);
void Handle(TEvConsole::TEvReplaceConfigSubscriptionsResponse::TPtr &ev,
const TActorContext &ctx);
- void Handle(TEvents::TEvPoisonPill::TPtr &ev,
- const TActorContext &ctx);
void Handle(TEvents::TEvUndelivered::TPtr &ev,
const TActorContext &ctx);
void Handle(TEvInterconnect::TEvNodeInfo::TPtr &ev,
@@ -1105,7 +1103,6 @@ private:
switch (ev->GetTypeRewrite()) {
HFuncTraced(TEvConsole::TEvConfigNotificationRequest, Handle);
HFuncTraced(TEvConsole::TEvReplaceConfigSubscriptionsResponse, Handle);
- HFuncTraced(TEvents::TEvPoisonPill, Handle);
HFuncTraced(TEvents::TEvUndelivered, Handle);
HFuncTraced(TEvInterconnect::TEvNodeInfo, Handle);
HFuncTraced(TEvPrivate::TEvCheckAllSlotsStatus, Handle);
@@ -1152,7 +1149,6 @@ public:
}
private:
- TDeque<TAutoPtr<IEventHandle>> InitQueue;
NKikimrTenantSlotBroker::TConfig Config;
TDuration PendingTimeout;
ui64 RequestId;
diff --git a/ydb/core/persqueue/pq_impl.cpp b/ydb/core/persqueue/pq_impl.cpp
index 202a30dda3..2704a91f2c 100644
--- a/ydb/core/persqueue/pq_impl.cpp
+++ b/ydb/core/persqueue/pq_impl.cpp
@@ -1185,10 +1185,6 @@ void TPersQueue::Handle(TEvPQ::TEvInitComplete::TPtr& ev, const TActorContext& c
}
}
-void TPersQueue::DefaultSignalTabletActive(const TActorContext &ctx) {
- Y_UNUSED(ctx);
-}
-
void TPersQueue::Handle(TEvPQ::TEvError::TPtr& ev, const TActorContext& ctx)
{
diff --git a/ydb/core/persqueue/pq_impl.h b/ydb/core/persqueue/pq_impl.h
index de4a7831e3..24e1be3ccc 100644
--- a/ydb/core/persqueue/pq_impl.h
+++ b/ydb/core/persqueue/pq_impl.h
@@ -64,8 +64,6 @@ class TPersQueue : public NKeyValue::TKeyValueFlat {
//when partition is ready it's sends event to tablet
void Handle(TEvPQ::TEvInitComplete::TPtr& ev, const TActorContext&);
- void DefaultSignalTabletActive(const TActorContext&) override;
-
//partitions will send some times it's counters
void Handle(TEvPQ::TEvPartitionCounters::TPtr& ev, const TActorContext&);
diff --git a/ydb/core/persqueue/read_balancer.h b/ydb/core/persqueue/read_balancer.h
index 2827377938..2813634fa2 100644
--- a/ydb/core/persqueue/read_balancer.h
+++ b/ydb/core/persqueue/read_balancer.h
@@ -224,8 +224,8 @@ class TPersQueueReadBalancer : public TActor<TPersQueueReadBalancer>, public TTa
Die(ctx);
}
- void DefaultSignalTabletActive(const TActorContext &ctx) override {
- Y_UNUSED(ctx); //TODO: this is signal that tablet is ready for work
+ void DefaultSignalTabletActive(const TActorContext &) override {
+ // must be empty
}
void InitDone(const TActorContext &ctx) {
diff --git a/ydb/core/persqueue/ut/pqtablet_mock.cpp b/ydb/core/persqueue/ut/pqtablet_mock.cpp
index 488c9948f0..9aaa095431 100644
--- a/ydb/core/persqueue/ut/pqtablet_mock.cpp
+++ b/ydb/core/persqueue/ut/pqtablet_mock.cpp
@@ -52,11 +52,15 @@ void TPQTabletMock::OnTabletDead(TEvTablet::TEvTabletDead::TPtr &ev, const TActo
Die(ctx);
}
-void TPQTabletMock::OnActivateExecutor(const TActorContext &ctx)
+void TPQTabletMock::DefaultSignalTabletActive(const TActorContext &)
{
- Y_UNUSED(ctx);
+ // must be empty
+}
+void TPQTabletMock::OnActivateExecutor(const TActorContext &ctx)
+{
Become(&TThis::StateWork);
+ SignalTabletActive(ctx);
}
void TPQTabletMock::Handle(TEvTabletPipe::TEvClientConnected::TPtr& ev, const TActorContext& ctx)
diff --git a/ydb/core/persqueue/ut/pqtablet_mock.h b/ydb/core/persqueue/ut/pqtablet_mock.h
index 622a2bd8ac..1c9f5bcdd8 100644
--- a/ydb/core/persqueue/ut/pqtablet_mock.h
+++ b/ydb/core/persqueue/ut/pqtablet_mock.h
@@ -70,6 +70,7 @@ private:
void OnDetach(const TActorContext &ctx) override;
void OnTabletDead(TEvTablet::TEvTabletDead::TPtr &ev, const TActorContext &ctx) override;
+ void DefaultSignalTabletActive(const TActorContext &ctx) override;
void OnActivateExecutor(const TActorContext &ctx) override;
void Handle(TEvTabletPipe::TEvClientConnected::TPtr& ev, const TActorContext& ctx);
diff --git a/ydb/core/tablet/tablet_pipe_ut.cpp b/ydb/core/tablet/tablet_pipe_ut.cpp
index 81cbc0dc95..10f1650afa 100644
--- a/ydb/core/tablet/tablet_pipe_ut.cpp
+++ b/ydb/core/tablet/tablet_pipe_ut.cpp
@@ -170,9 +170,13 @@ namespace NKikimr {
return Die(ctx);
}
+ void DefaultSignalTabletActive(const TActorContext&) override {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext &ctx) override {
- Y_UNUSED(ctx);
Become(&TThis::StateWork);
+ SignalTabletActive(ctx);
Cout << "Producer loaded\n";
}
@@ -219,9 +223,14 @@ namespace NKikimr {
}
private:
- void OnActivateExecutor(const TActorContext&) override {
+ void DefaultSignalTabletActive(const TActorContext&) override {
+ // must be empty
+ }
+
+ void OnActivateExecutor(const TActorContext& ctx) override {
Become(&TThis::StateWork);
Cout << "Consumer loaded\n";
+ SignalTabletActive(ctx);
PipeConnectAcceptor->Activate(SelfId(), SelfId());
}
@@ -342,9 +351,13 @@ namespace NKikimr {
}
private:
+ void DefaultSignalTabletActive(const TActorContext&) override {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext& ctx) override {
- Y_UNUSED(ctx);
Become(&TThis::StateWork);
+ SignalTabletActive(ctx);
Cout << "Consumer loaded\n";
}
@@ -1067,9 +1080,13 @@ Y_UNIT_TEST_SUITE(TTabletPipeTest) {
}
private:
+ void DefaultSignalTabletActive(const TActorContext&) override {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext& ctx) override {
- Y_UNUSED(ctx);
Become(&TThis::StateWork);
+ SignalTabletActive(ctx);
}
STFUNC(StateInit) {
diff --git a/ydb/core/tablet/tablet_pipecache_ut.cpp b/ydb/core/tablet/tablet_pipecache_ut.cpp
index 4021f35965..1d47d67979 100644
--- a/ydb/core/tablet/tablet_pipecache_ut.cpp
+++ b/ydb/core/tablet/tablet_pipecache_ut.cpp
@@ -54,9 +54,13 @@ Y_UNIT_TEST_SUITE(TPipeCacheTest) {
return Die(ctx);
}
+ void DefaultSignalTabletActive(const TActorContext&) override {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext& ctx) override {
- Y_UNUSED(ctx);
Become(&TThis::StateWork);
+ SignalTabletActive(ctx);
}
};
diff --git a/ydb/core/tablet_flat/datetime_ut.cpp b/ydb/core/tablet_flat/datetime_ut.cpp
index 0d7728882d..365410b678 100644
--- a/ydb/core/tablet_flat/datetime_ut.cpp
+++ b/ydb/core/tablet_flat/datetime_ut.cpp
@@ -284,8 +284,13 @@ Y_UNIT_TEST_SUITE(TFlatTableDatetime) {
}
};
+ void DefaultSignalTabletActive(const TActorContext &) override {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext &ctx) override {
Become(&TThis::StateWork);
+ SignalTabletActive(ctx);
Execute(new TTxSchema(*this), ctx);
}
diff --git a/ydb/core/tablet_flat/decimal_ut.cpp b/ydb/core/tablet_flat/decimal_ut.cpp
index e487d4822b..caa801279b 100644
--- a/ydb/core/tablet_flat/decimal_ut.cpp
+++ b/ydb/core/tablet_flat/decimal_ut.cpp
@@ -356,8 +356,13 @@ Y_UNIT_TEST_SUITE(TFlatTableDecimals) {
}
};
+ void DefaultSignalTabletActive(const TActorContext &) override {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext &ctx) override {
Become(&TThis::StateWork);
+ SignalTabletActive(ctx);
Execute(new TTxSchema(*this), ctx);
}
diff --git a/ydb/core/tablet_flat/flat_executor_leases_ut.cpp b/ydb/core/tablet_flat/flat_executor_leases_ut.cpp
index 56222743ce..522e70854b 100644
--- a/ydb/core/tablet_flat/flat_executor_leases_ut.cpp
+++ b/ydb/core/tablet_flat/flat_executor_leases_ut.cpp
@@ -183,15 +183,15 @@ Y_UNIT_TEST_SUITE(TFlatExecutorLeases) {
Die(ctx);
}
+ void DefaultSignalTabletActive(const TActorContext&) override {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext&) override {
Become(&TThis::StateWork);
RunTxInitSchema();
}
- void DefaultSignalTabletActive(const TActorContext&) override {
- // nothing
- }
-
void SwitchToWork(const TActorContext& ctx) {
SignalTabletActive(ctx);
}
diff --git a/ydb/core/tablet_flat/flat_executor_ut.cpp b/ydb/core/tablet_flat/flat_executor_ut.cpp
index 49f80744a9..4154c87d36 100644
--- a/ydb/core/tablet_flat/flat_executor_ut.cpp
+++ b/ydb/core/tablet_flat/flat_executor_ut.cpp
@@ -484,8 +484,13 @@ class TTestFlatTablet : public TActor<TTestFlatTablet>, public TTabletExecutedFl
ctx.Send(Sender, new TEvents::TEvGone);
}
+ void DefaultSignalTabletActive(const TActorContext&) override {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext&) override {
Become(&TThis::StateWork);
+ SignalTabletActive(SelfId());
Send(Sender, new TEvents::TEvWakeup);
}
diff --git a/ydb/core/tablet_flat/tablet_flat_executed.cpp b/ydb/core/tablet_flat/tablet_flat_executed.cpp
index 35f653b6b1..329090555e 100644
--- a/ydb/core/tablet_flat/tablet_flat_executed.cpp
+++ b/ydb/core/tablet_flat/tablet_flat_executed.cpp
@@ -104,6 +104,15 @@ void TTabletExecutedFlat::OnTabletStop(TEvTablet::TEvTabletStop::TPtr &ev, const
ctx.Send(Tablet(), new TEvTablet::TEvTabletStopped());
}
+void TTabletExecutedFlat::HandlePoison(const TActorContext &ctx) {
+ if (Executor0) {
+ Executor0->DetachTablet(ExecutorCtx(ctx));
+ Executor0 = nullptr;
+ }
+
+ Detach(ctx);
+}
+
void TTabletExecutedFlat::HandleTabletStop(TEvTablet::TEvTabletStop::TPtr &ev, const TActorContext &ctx) {
if (Executor() && Executor()->GetStats().IsActive) {
OnTabletStop(ev, ctx);
@@ -139,20 +148,20 @@ void TTabletExecutedFlat::HandleLocalReadColumns(TEvTablet::TEvLocalReadColumns:
Execute(Factory->Make(ev), ctx);
}
-void TTabletExecutedFlat::SignalTabletActive(const TActorContext &ctx) {
- ctx.Send(Tablet(), new TEvTablet::TEvTabletActive());
+void TTabletExecutedFlat::SignalTabletActive(const TActorIdentity &id) {
+ id.Send(Tablet(), new TEvTablet::TEvTabletActive());
}
-void TTabletExecutedFlat::DefaultSignalTabletActive(const TActorContext &ctx) {
- SignalTabletActive(ctx);
+void TTabletExecutedFlat::SignalTabletActive(const TActorContext &ctx) {
+ ctx.Send(Tablet(), new TEvTablet::TEvTabletActive());
}
void TTabletExecutedFlat::Enqueue(STFUNC_SIG) {
Y_UNUSED(ev);
+ Y_VERIFY_DEBUG(false, "Unhandled StateInit event 0x%08" PRIx32, ev->GetTypeRewrite());
}
void TTabletExecutedFlat::ActivateExecutor(const TActorContext &ctx) {
- DefaultSignalTabletActive(ctx);
OnActivateExecutor(ctx);
}
@@ -247,6 +256,7 @@ void TTabletExecutedFlat::HandleGetCounters(TEvTablet::TEvGetCounters::TPtr &ev)
bool TTabletExecutedFlat::HandleDefaultEvents(TAutoPtr<IEventHandle>& ev, const TActorIdentity& id) {
auto ctx(NActors::TActivationContext::ActorContextFor(id));
switch (ev->GetTypeRewrite()) {
+ CFuncCtx(TEvents::TEvPoison::EventType, HandlePoison, ctx);
HFuncCtx(TEvTablet::TEvBoot, Handle, ctx);
HFuncCtx(TEvTablet::TEvRestored, Handle, ctx);
HFuncCtx(TEvTablet::TEvFBoot, Handle, ctx);
@@ -273,15 +283,17 @@ bool TTabletExecutedFlat::HandleDefaultEvents(TAutoPtr<IEventHandle>& ev, const
void TTabletExecutedFlat::StateInitImpl(TAutoPtr<IEventHandle>& ev, const TActorIdentity& id) {
auto ctx(NActors::TActivationContext::ActorContextFor(id));
switch (ev->GetTypeRewrite()) {
+ CFuncCtx(TEvents::TEvPoison::EventType, HandlePoison, ctx);
HFuncCtx(TEvTablet::TEvBoot, Handle, ctx);
+ HFuncCtx(TEvTablet::TEvRestored, Handle, ctx);
HFuncCtx(TEvTablet::TEvFBoot, Handle, ctx);
hFunc(TEvTablet::TEvFUpdate, Handle);
hFunc(TEvTablet::TEvFAuxUpdate, Handle);
hFunc(TEvTablet::TEvFollowerGcApplied, Handle);
- HFuncCtx(TEvTablet::TEvRestored, Handle, ctx);
+ hFunc(TEvTablet::TEvNewFollowerAttached, Handle);
+ hFunc(TEvTablet::TEvFollowerSyncComplete, Handle);
HFuncCtx(TEvTablet::TEvTabletStop, HandleTabletStop, ctx);
HFuncCtx(TEvTablet::TEvTabletDead, HandleTabletDead, ctx);
- hFunc(TEvTablet::TEvFollowerSyncComplete, Handle);
hFunc(TEvTablet::TEvUpdateConfig, Handle);
HFuncCtx(NMon::TEvRemoteHttpInfo, RenderHtmlPage, ctx);
IgnoreFunc(TEvTablet::TEvReady);
diff --git a/ydb/core/tablet_flat/tablet_flat_executed.h b/ydb/core/tablet_flat/tablet_flat_executed.h
index 6aa99827b2..82cc425b72 100644
--- a/ydb/core/tablet_flat/tablet_flat_executed.h
+++ b/ydb/core/tablet_flat/tablet_flat_executed.h
@@ -39,9 +39,27 @@ protected:
virtual void OnTabletDead(TEvTablet::TEvTabletDead::TPtr &ev, const TActorContext &ctx) = 0;
virtual bool OnRenderAppHtmlPage(NMon::TEvRemoteHttpInfo::TPtr ev, const TActorContext &ctx);
+ /**
+ * Signal tablet as active and ready to process requests (from pipes).
+ */
+ void SignalTabletActive(const TActorIdentity &id);
void SignalTabletActive(const TActorContext &ctx);
- virtual void DefaultSignalTabletActive(const TActorContext &ctx); // must be overriden with empty body to postpone 'tablet active' notification
+ /**
+ * Must be overriden as an empty method. Previously default implementation
+ * was calling SignalTabletActive, but this proved to be error prone. For
+ * compatibility reasons an empty implementation is mandatory. This method
+ * is never called, and will be removed in the future.
+ */
+ virtual void DefaultSignalTabletActive(const TActorContext &ctx) = 0;
+
+ /**
+ * Called by StateInitImpl for unhandled non-system events. Used to delay
+ * processing of requests until tablet implementation is fully initialized.
+ * Default implementation will abort when compiled in debug mode.
+ * It is recommended to delay SignalTabletActive until tablet is ready to
+ * process incoming requests instead of using Enqueue.
+ */
virtual void Enqueue(STFUNC_SIG);
void Handle(TEvTablet::TEvBoot::TPtr &ev, const TActorContext &ctx);
@@ -54,6 +72,12 @@ protected:
void Handle(TEvTablet::TEvNewFollowerAttached::TPtr&);
void Handle(TEvTablet::TEvUpdateConfig::TPtr&);
+ /**
+ * Common handler for TEvPoison, detaches from executor and calls Detach,
+ * which is expected to Die/PassAway in OnDetach.
+ */
+ void HandlePoison(const TActorContext &ctx);
+
void HandleTabletStop(TEvTablet::TEvTabletStop::TPtr &ev, const TActorContext &ctx);
void HandleTabletDead(TEvTablet::TEvTabletDead::TPtr &ev, const TActorContext &ctx);
void HandleLocalMKQL(TEvTablet::TEvLocalMKQL::TPtr &ev, const TActorContext &ctx);
diff --git a/ydb/core/tablet_flat/test/libs/exec/dummy.h b/ydb/core/tablet_flat/test/libs/exec/dummy.h
index 3f40203018..81477d209d 100644
--- a/ydb/core/tablet_flat/test/libs/exec/dummy.h
+++ b/ydb/core/tablet_flat/test/libs/exec/dummy.h
@@ -92,9 +92,15 @@ namespace NFake {
Y_FAIL("Got unexpected event %s on tablet booting", name);
}
+ void DefaultSignalTabletActive(const TActorContext&) override
+ {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext&) override
{
if (std::exchange(State, EState::Work) != EState::Work) {
+ SignalTabletActive(SelfId());
Send(Owner, new NFake::TEvReady(TabletID(), SelfId()));
} else {
Y_FAIL("Received unexpected TExecutor activation");
diff --git a/ydb/core/test_tablet/test_shard_impl.h b/ydb/core/test_tablet/test_shard_impl.h
index d6f68b4378..4f29e51967 100644
--- a/ydb/core/test_tablet/test_shard_impl.h
+++ b/ydb/core/test_tablet/test_shard_impl.h
@@ -94,6 +94,7 @@ namespace NKikimr::NTestShard {
}
void OnLoadComplete() {
+ SignalTabletActive(SelfId());
StartActivities();
}
diff --git a/ydb/core/testlib/fake_coordinator.h b/ydb/core/testlib/fake_coordinator.h
index 75d0816650..5ab5afae73 100644
--- a/ydb/core/testlib/fake_coordinator.h
+++ b/ydb/core/testlib/fake_coordinator.h
@@ -44,8 +44,13 @@ namespace NKikimr {
return config;
}
+ void DefaultSignalTabletActive(const TActorContext &) override {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext &ctx) final {
Become(&TFakeCoordinator::StateWork);
+ SignalTabletActive(ctx);
SendQueued(ctx);
}
diff --git a/ydb/core/testlib/fake_scheme_shard.h b/ydb/core/testlib/fake_scheme_shard.h
index f6dc29dbe4..706db78d6e 100644
--- a/ydb/core/testlib/fake_scheme_shard.h
+++ b/ydb/core/testlib/fake_scheme_shard.h
@@ -41,14 +41,13 @@ public:
{
}
+ void DefaultSignalTabletActive(const TActorContext &) override {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext &ctx) final {
Become(&TFakeSchemeShard::StateWork);
-
- while (!InitialEventsQueue.empty()) {
- TAutoPtr<IEventHandle> &ev = InitialEventsQueue.front();
- ctx.ExecutorThread.Send(ev.Release());
- InitialEventsQueue.pop_front();
- }
+ SignalTabletActive(ctx);
}
void OnDetach(const TActorContext &ctx) override {
@@ -60,10 +59,6 @@ public:
Die(ctx);
}
- void Enqueue(STFUNC_SIG) override {
- InitialEventsQueue.push_back(ev);
- }
-
void StateInit(STFUNC_SIG) {
StateInitImpl(ev, SelfId());
}
@@ -103,7 +98,6 @@ public:
private:
TState::TPtr State;
- TDeque<TAutoPtr<IEventHandle>> InitialEventsQueue;
};
inline void BootFakeSchemeShard(TTestActorRuntime& runtime, ui64 tabletId, TFakeSchemeShardState::TPtr state) {
diff --git a/ydb/core/testlib/tablet_helpers.cpp b/ydb/core/testlib/tablet_helpers.cpp
index e01e5947b4..f346ff3f73 100644
--- a/ydb/core/testlib/tablet_helpers.cpp
+++ b/ydb/core/testlib/tablet_helpers.cpp
@@ -172,6 +172,9 @@ namespace NKikimr {
if (ENABLE_REBOOT_DISPATCH_LOG) {
Cerr << "Leader for TabletID " << info->TabletID << " is " << info->CurrentLeaderTablet << " sender: " << event->Sender << " recipient: " << event->Recipient << Endl;
}
+ if (info->CurrentLeader) {
+ TabletSys[info->TabletID] = info->CurrentLeader;
+ }
if (info->CurrentLeaderTablet) {
TabletLeaders[info->TabletID] = info->CurrentLeaderTablet;
} else {
@@ -199,6 +202,10 @@ namespace NKikimr {
}
}
+ const TMap<ui64, TActorId>& GetTabletSys() const {
+ return TabletSys;
+ }
+
const TMap<ui64, TActorId>& GetTabletLeaders() const {
return TabletLeaders;
}
@@ -255,6 +262,7 @@ namespace NKikimr {
}
protected:
+ TMap<ui64, TActorId> TabletSys;
TMap<ui64, TActorId> TabletLeaders;
TMap<TActorId, ui64> TabletRelatedActors;
TSet<ui64> DeletedTablets;
@@ -325,8 +333,10 @@ namespace NKikimr {
if (ENABLE_REBOOT_DISPATCH_LOG)
Cerr << "!Reboot " << TabletId << " (actor " << targetActorId << ") on event " << eventType << " !\n";
- // Wait for the tablet to boot or to become deleted
+ // Synchronously kill both system and user parts of the tablet
+ runtime.Send(new IEventHandle(TabletSys.at(TabletId), TActorId(), new TEvents::TEvPoisonPill()));
runtime.Send(new IEventHandle(targetActorId, TActorId(), new TEvents::TEvPoisonPill()));
+ // Wait for the tablet to boot or to become deleted
TDispatchOptions rebootOptions;
rebootOptions.FinalEvents.push_back(TDispatchOptions::TFinalEventCondition(TEvTablet::EvRestored, 2));
rebootOptions.CustomFinalCondition = [this]() -> bool {
@@ -1100,14 +1110,13 @@ namespace NKikimr {
{
}
+ void DefaultSignalTabletActive(const TActorContext &) override {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext &ctx) final {
Become(&TFakeHive::StateWork);
-
- while (!InitialEventsQueue.empty()) {
- TAutoPtr<IEventHandle> &ev = InitialEventsQueue.front();
- ctx.ExecutorThread.Send(ev.Release());
- InitialEventsQueue.pop_front();
- }
+ SignalTabletActive(ctx);
LOG_INFO_S(ctx, NKikimrServices::HIVE, "[" << TabletID() << "] started, primary subdomain " << PrimarySubDomainKey);
}
@@ -1121,10 +1130,6 @@ namespace NKikimr {
Die(ctx);
}
- void Enqueue(STFUNC_SIG) override {
- InitialEventsQueue.push_back(ev);
- }
-
void StateInit(STFUNC_SIG) {
StateInitImpl(ev, SelfId());
}
@@ -1464,7 +1469,6 @@ namespace NKikimr {
private:
TState::TPtr State;
TGetTabletCreationFunc GetTabletCreationFunc;
- TDeque<TAutoPtr<IEventHandle>> InitialEventsQueue;
TSubDomainKey PrimarySubDomainKey;
};
diff --git a/ydb/core/testlib/tenant_runtime.cpp b/ydb/core/testlib/tenant_runtime.cpp
index cbea26af3e..eb5fcc6efb 100644
--- a/ydb/core/testlib/tenant_runtime.cpp
+++ b/ydb/core/testlib/tenant_runtime.cpp
@@ -173,9 +173,15 @@ class TFakeSchemeShard : public TActor<TFakeSchemeShard>, public TTabletExecuted
}
}
+ void DefaultSignalTabletActive(const TActorContext &) override
+ {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext &) override
{
Become(&TThis::StateWork);
+ SignalTabletActive(SelfId());
}
void OnDetach(const TActorContext &ctx) override
@@ -229,9 +235,15 @@ public:
};
class TFakeBSController : public TActor<TFakeBSController>, public TTabletExecutedFlat {
+ void DefaultSignalTabletActive(const TActorContext &) override
+ {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext &) override
{
Become(&TThis::StateWork);
+ SignalTabletActive(SelfId());
}
void OnDetach(const TActorContext &ctx) override
@@ -263,9 +275,15 @@ public:
};
class TFakeTenantSlotBroker : public TActor<TFakeTenantSlotBroker>, public TTabletExecutedFlat {
+ void DefaultSignalTabletActive(const TActorContext &) override
+ {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext &) override
{
Become(&TThis::StateWork);
+ SignalTabletActive(SelfId());
}
void OnDetach(const TActorContext &ctx) override
@@ -616,9 +634,15 @@ class TFakeHive : public TActor<TFakeHive>, public TTabletExecutedFlat {
ctx.Send(Sender, new TEvTest::TEvHiveStateHit);
}
+ void DefaultSignalTabletActive(const TActorContext &) override
+ {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext &) override
{
Become(&TThis::StateWork);
+ SignalTabletActive(SelfId());
}
void OnDetach(const TActorContext &ctx) override
diff --git a/ydb/core/tx/columnshard/columnshard.cpp b/ydb/core/tx/columnshard/columnshard.cpp
index c0aff258cb..ef34565103 100644
--- a/ydb/core/tx/columnshard/columnshard.cpp
+++ b/ydb/core/tx/columnshard/columnshard.cpp
@@ -10,10 +10,8 @@ IActor* CreateColumnShard(const TActorId& tablet, TTabletStorageInfo* info) {
namespace NKikimr::NColumnShard {
-void TColumnShard::BecomeBroken(const TActorContext& ctx)
+void TColumnShard::CleanupActors(const TActorContext& ctx)
{
- Become(&TThis::StateBroken);
- ctx.Send(Tablet(), new TEvents::TEvPoisonPill);
ctx.Send(IndexingActor, new TEvents::TEvPoisonPill);
ctx.Send(CompactionActor, new TEvents::TEvPoisonPill);
ctx.Send(EvictionActor, new TEvents::TEvPoisonPill);
@@ -22,6 +20,13 @@ void TColumnShard::BecomeBroken(const TActorContext& ctx)
}
}
+void TColumnShard::BecomeBroken(const TActorContext& ctx)
+{
+ Become(&TThis::StateBroken);
+ ctx.Send(Tablet(), new TEvents::TEvPoisonPill);
+ CleanupActors(ctx);
+}
+
void TColumnShard::SwitchToWork(const TActorContext& ctx) {
Become(&TThis::StateWork);
LOG_S_INFO("Switched to work at " << TabletID() << " actor " << ctx.SelfID);
@@ -49,12 +54,6 @@ void TColumnShard::OnActivateExecutor(const TActorContext& ctx) {
Execute(CreateTxInitSchema(), ctx);
}
-void TColumnShard::Handle(TEvents::TEvPoisonPill::TPtr& ev, const TActorContext& ctx) {
- LOG_S_DEBUG("Handle TEvents::TEvPoisonPill");
- Y_UNUSED(ev);
- BecomeBroken(ctx);
-}
-
void TColumnShard::Handle(TEvTabletPipe::TEvClientConnected::TPtr& ev, const TActorContext&) {
auto tabletId = ev->Get()->TabletId;
auto clientId = ev->Get()->ClientId;
diff --git a/ydb/core/tx/columnshard/columnshard_impl.cpp b/ydb/core/tx/columnshard/columnshard_impl.cpp
index c542dc3616..65a9c0ec67 100644
--- a/ydb/core/tx/columnshard/columnshard_impl.cpp
+++ b/ydb/core/tx/columnshard/columnshard_impl.cpp
@@ -144,11 +144,13 @@ TColumnShard::TColumnShard(TTabletStorageInfo* info, const TActorId& tablet)
}
void TColumnShard::OnDetach(const TActorContext& ctx) {
+ CleanupActors(ctx);
Die(ctx);
}
void TColumnShard::OnTabletDead(TEvTablet::TEvTabletDead::TPtr& ev, const TActorContext& ctx) {
Y_UNUSED(ev);
+ CleanupActors(ctx);
Die(ctx);
}
@@ -1062,9 +1064,7 @@ bool TColumnShard::GetExportedBlob(const TActorContext& ctx, TActorId dst, ui64
void TColumnShard::Die(const TActorContext& ctx) {
// TODO
- if (!!Tiers) {
- Tiers->Stop();
- }
+ CleanupActors(ctx);
NTabletPipe::CloseAndForgetClient(SelfId(), StatsReportPipe);
UnregisterMediatorTimeCast();
return IActor::Die(ctx);
diff --git a/ydb/core/tx/columnshard/columnshard_impl.h b/ydb/core/tx/columnshard/columnshard_impl.h
index f344de4a30..2314745442 100644
--- a/ydb/core/tx/columnshard/columnshard_impl.h
+++ b/ydb/core/tx/columnshard/columnshard_impl.h
@@ -131,7 +131,6 @@ class TColumnShard
class TTxProposeCancel;
// proto
- void Handle(TEvents::TEvPoisonPill::TPtr& ev, const TActorContext& ctx);
void Handle(TEvTabletPipe::TEvClientConnected::TPtr& ev, const TActorContext& ctx);
void Handle(TEvTabletPipe::TEvClientDestroyed::TPtr& ev, const TActorContext& ctx);
void Handle(TEvTabletPipe::TEvServerConnected::TPtr& ev, const TActorContext& ctx);
@@ -177,6 +176,7 @@ class TColumnShard
void Die(const TActorContext& ctx) override;
+ void CleanupActors(const TActorContext& ctx);
void BecomeBroken(const TActorContext& ctx);
void SwitchToWork(const TActorContext& ctx);
@@ -222,11 +222,7 @@ private:
protected:
STFUNC(StateInit) {
TRACE_EVENT(NKikimrServices::TX_COLUMNSHARD);
- switch (ev->GetTypeRewrite()) {
- HFunc(TEvents::TEvPoisonPill, Handle);
- default:
- StateInitImpl(ev, SelfId());
- }
+ StateInitImpl(ev, SelfId());
}
STFUNC(StateBroken) {
@@ -247,7 +243,6 @@ protected:
TRACE_EVENT(NKikimrServices::TX_COLUMNSHARD);
switch (ev->GetTypeRewrite()) {
hFunc(NMetadata::NProvider::TEvRefreshSubscriberData, Handle);
- HFunc(TEvents::TEvPoisonPill, Handle);
HFunc(TEvTabletPipe::TEvClientConnected, Handle);
HFunc(TEvTabletPipe::TEvClientDestroyed, Handle);
HFunc(TEvTabletPipe::TEvServerConnected, Handle);
diff --git a/ydb/core/tx/coordinator/coordinator_impl.cpp b/ydb/core/tx/coordinator/coordinator_impl.cpp
index 8af35f3123..1edc81a258 100644
--- a/ydb/core/tx/coordinator/coordinator_impl.cpp
+++ b/ydb/core/tx/coordinator/coordinator_impl.cpp
@@ -413,11 +413,6 @@ void TTxCoordinator::Handle(TEvSubDomain::TEvConfigure::TPtr &ev, const TActorCo
DoConfiguration(*ev->Get(), ctx, ev->Sender);
}
-void TTxCoordinator::Handle(TEvents::TEvPoisonPill::TPtr&, const TActorContext& ctx) {
- Become(&TThis::StateBroken);
- ctx.Send(Tablet(), new TEvents::TEvPoisonPill);
-}
-
void TTxCoordinator::Handle(TEvTabletPipe::TEvServerConnected::TPtr& ev, const TActorContext&) {
auto res = PipeServers.emplace(
std::piecewise_construct,
diff --git a/ydb/core/tx/coordinator/coordinator_impl.h b/ydb/core/tx/coordinator/coordinator_impl.h
index 4bea09f29f..cd8968308f 100644
--- a/ydb/core/tx/coordinator/coordinator_impl.h
+++ b/ydb/core/tx/coordinator/coordinator_impl.h
@@ -659,7 +659,6 @@ private:
void Handle(TEvTxCoordinator::TEvCoordinatorConfirmPlan::TPtr &ev, const TActorContext &ctx);
void Handle(TEvSubDomain::TEvConfigure::TPtr &ev, const TActorContext &ctx);
- void Handle(TEvents::TEvPoisonPill::TPtr& ev, const TActorContext& ctx);
void Handle(TEvTabletPipe::TEvServerConnected::TPtr& ev, const TActorContext& ctx);
void Handle(TEvTabletPipe::TEvServerDisconnected::TPtr& ev, const TActorContext& ctx);
@@ -703,7 +702,6 @@ public:
// no incomming pipes is allowed in StateInit
STFUNC_TABLET_INIT(StateInit,
- HFunc(TEvents::TEvPoisonPill, Handle);
)
STFUNC_TABLET_DEF(StateSync,
@@ -715,7 +713,6 @@ public:
HFunc(TEvTxProxy::TEvUnsubscribeReadStep, Handle);
hFunc(TEvTxProxy::TEvSubscribeLastStep, Handle);
hFunc(TEvTxProxy::TEvUnsubscribeLastStep, Handle);
- HFunc(TEvents::TEvPoisonPill, Handle);
HFunc(TEvTabletPipe::TEvServerConnected, Handle);
HFunc(TEvTabletPipe::TEvServerDisconnected, Handle);
HFunc(TEvPrivate::TEvRestoredProcessingParams, Handle);
@@ -735,7 +732,6 @@ public:
HFunc(TEvTxCoordinator::TEvMediatorQueueRestart, Handle);
HFunc(TEvTxCoordinator::TEvMediatorQueueStop, Handle);
HFunc(TEvTxCoordinator::TEvCoordinatorConfirmPlan, Handle);
- HFunc(TEvents::TEvPoisonPill, Handle);
HFunc(TEvTabletPipe::TEvServerConnected, Handle);
HFunc(TEvTabletPipe::TEvServerDisconnected, Handle);
HFunc(TEvPrivate::TEvRestoredProcessingParams, Handle);
diff --git a/ydb/core/tx/datashard/datashard.cpp b/ydb/core/tx/datashard/datashard.cpp
index 808038dc62..2fae2da7fd 100644
--- a/ydb/core/tx/datashard/datashard.cpp
+++ b/ydb/core/tx/datashard/datashard.cpp
@@ -2370,12 +2370,6 @@ void TDataShard::Handle(TEvents::TEvGone::TPtr &ev) {
Actors.erase(ev->Sender);
}
-void TDataShard::Handle(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx) {
- LOG_DEBUG(ctx, NKikimrServices::TX_DATASHARD, "Handle TEvents::TEvPoisonPill");
- Y_UNUSED(ev);
- BecomeBroken(ctx);
-}
-
void TDataShard::Handle(TEvDataShard::TEvGetShardState::TPtr &ev, const TActorContext &ctx) {
Execute(new TTxGetShardState(this, ev), ctx);
}
@@ -2693,7 +2687,7 @@ void TDataShard::Handle(TEvTxProcessing::TEvPlanStep::TPtr &ev, const TActorCont
LOG_CRIT_S(ctx, NKikimrServices::TX_DATASHARD, "tablet " << TabletID() <<
" receive PlanStep " << ev->Get()->Record.GetStep() <<
" from unauthorized mediator " << srcMediatorId);
- BecomeBroken(ctx);
+ HandlePoison(ctx);
return;
}
diff --git a/ydb/core/tx/datashard/datashard_impl.h b/ydb/core/tx/datashard/datashard_impl.h
index 8a1b13d0ba..617ec94b7f 100644
--- a/ydb/core/tx/datashard/datashard_impl.h
+++ b/ydb/core/tx/datashard/datashard_impl.h
@@ -1172,7 +1172,6 @@ class TDataShard
}
void Handle(TEvents::TEvGone::TPtr &ev);
- void Handle(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx);
void Handle(TEvDataShard::TEvGetShardState::TPtr &ev, const TActorContext &ctx);
void Handle(TEvDataShard::TEvSchemaChangedResult::TPtr &ev, const TActorContext &ctx);
void Handle(TEvDataShard::TEvStateChangedResult::TPtr &ev, const TActorContext &ctx);
@@ -2739,11 +2738,7 @@ protected:
// Redundant init state required by flat executor implementation
void StateInit(TAutoPtr<NActors::IEventHandle> &ev) {
TRACE_EVENT(NKikimrServices::TX_DATASHARD);
- switch (ev->GetTypeRewrite()) {
- HFuncTraced(TEvents::TEvPoisonPill, Handle);
- default:
- StateInitImpl(ev, SelfId());
- }
+ StateInitImpl(ev, SelfId());
}
void Enqueue(STFUNC_SIG) override {
@@ -2760,7 +2755,6 @@ protected:
HFuncTraced(TEvMediatorTimecast::TEvNotifyPlanStep, Handle);
HFuncTraced(TEvPrivate::TEvMediatorRestoreBackup, Handle);
HFuncTraced(TEvPrivate::TEvRemoveLockChangeRecords, Handle);
- HFuncTraced(TEvents::TEvPoisonPill, Handle);
default:
if (!HandleDefaultEvents(ev, SelfId())) {
ALOG_WARN(NKikimrServices::TX_DATASHARD, "TDataShard::StateInactive unhandled event type: " << ev->GetTypeRewrite()
@@ -2775,7 +2769,6 @@ protected:
TRACE_EVENT(NKikimrServices::TX_DATASHARD);
switch (ev->GetTypeRewrite()) {
hFunc(TEvents::TEvGone, Handle);
- HFuncTraced(TEvents::TEvPoisonPill, Handle);
HFuncTraced(TEvDataShard::TEvGetShardState, Handle);
HFuncTraced(TEvDataShard::TEvSchemaChangedResult, Handle);
HFuncTraced(TEvDataShard::TEvStateChangedResult, Handle);
@@ -2896,7 +2889,6 @@ protected:
TRACE_EVENT(NKikimrServices::TX_DATASHARD);
switch (ev->GetTypeRewrite()) {
hFunc(TEvents::TEvGone, Handle);
- HFuncTraced(TEvents::TEvPoisonPill, Handle);
HFuncTraced(TEvDataShard::TEvProposeTransaction, HandleAsFollower);
HFuncTraced(TEvPrivate::TEvDelayedProposeTransaction, Handle);
HFuncTraced(TEvDataShard::TEvReadColumnsRequest, Handle);
@@ -2915,21 +2907,6 @@ protected:
}
}
- // State after tablet takes poison pill
- void StateBroken(TAutoPtr<NActors::IEventHandle> &ev) {
- TRACE_EVENT(NKikimrServices::TX_DATASHARD);
- switch (ev->GetTypeRewrite()) {
- hFunc(TEvents::TEvGone, Handle);
- HFuncTraced(TEvTablet::TEvTabletDead, HandleTabletDead);
- default:
- ALOG_WARN(NKikimrServices::TX_DATASHARD, "TDataShard::BrokenState at tablet " << TabletID()
- << " unhandled event type: " << ev->GetTypeRewrite()
- << " event: " << ev->ToString());
- Send(IEventHandle::ForwardOnNondelivery(ev, TEvents::TEvUndelivered::ReasonActorUnknown));
- break;
- }
- }
-
void Die(const TActorContext &ctx) override {
NTabletPipe::CloseAndForgetClient(SelfId(), SchemeShardPipe);
NTabletPipe::CloseAndForgetClient(SelfId(), StateReportPipe);
@@ -2958,12 +2935,6 @@ protected:
return IActor::Die(ctx);
}
- void BecomeBroken(const TActorContext &ctx)
- {
- Become(&TThis::StateBroken);
- ctx.Send(Tablet(), new TEvents::TEvPoisonPill);
- }
-
void SendViaSchemeshardPipe(const TActorContext &ctx, ui64 tabletId, THolder<TEvDataShard::TEvSchemaChanged> event) {
Y_VERIFY(tabletId);
Y_VERIFY(CurrentSchemeShardId == tabletId);
diff --git a/ydb/core/tx/mediator/mediator_impl.cpp b/ydb/core/tx/mediator/mediator_impl.cpp
index c4b202b822..bbf15fbd8d 100644
--- a/ydb/core/tx/mediator/mediator_impl.cpp
+++ b/ydb/core/tx/mediator/mediator_impl.cpp
@@ -305,13 +305,6 @@ void TTxMediator::Handle(TEvMediatorTimecast::TEvWatch::TPtr &ev, const TActorCo
ctx.ExecutorThread.Send(ev->Forward(ExecQueue));
}
-void TTxMediator::Handle(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx) {
- Y_UNUSED(ev);
- LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID() << " HANDLE TEvPoisonPill");
- Become(&TThis::StateBroken);
- ctx.Send(Tablet(), new TEvents::TEvPoisonPill);
-}
-
TTxMediator::TTxMediator(TTabletStorageInfo *info, const TActorId &tablet)
: TActor(&TThis::StateInit)
, TTabletExecutedFlat(info, tablet, new NMiniKQL::TMiniKQLFactory)
diff --git a/ydb/core/tx/mediator/mediator_impl.h b/ydb/core/tx/mediator/mediator_impl.h
index c98bd4246b..a44cc7d22d 100644
--- a/ydb/core/tx/mediator/mediator_impl.h
+++ b/ydb/core/tx/mediator/mediator_impl.h
@@ -334,7 +334,6 @@ class TTxMediator : public TActor<TTxMediator>, public NTabletFlatExecutor::TTab
void Handle(TEvTxCoordinator::TEvCoordinatorSync::TPtr &ev, const TActorContext &ctx);
void Handle(TEvTxCoordinator::TEvCoordinatorStep::TPtr &ev, const TActorContext &ctx);
void Handle(TEvMediatorTimecast::TEvWatch::TPtr &ev, const TActorContext &ctx);
- void Handle(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx);
void DoConfigure(const TEvSubDomain::TEvConfigure &ev, const TActorContext &ctx, const TActorId &ackTo = TActorId());
@@ -389,11 +388,9 @@ public:
TTxMediator(TTabletStorageInfo *info, const TActorId &tablet);
// no incomming pipes is allowed in StateInit
- STFUNC_TABLET_INIT(StateInit,
- HFunc(TEvents::TEvPoisonPill, Handle))
+ STFUNC_TABLET_INIT(StateInit,)
STFUNC_TABLET_DEF(StateSync,
- HFunc(TEvents::TEvPoisonPill, Handle)
HFunc(TEvTxCoordinator::TEvCoordinatorSync, HandleEnqueue)
HFunc(TEvSubDomain::TEvConfigure, Handle)
HFunc(TEvMediatorTimecast::TEvWatch, HandleEnqueue)
@@ -401,7 +398,6 @@ public:
IgnoreFunc(TEvTabletPipe::TEvServerDisconnected))
STFUNC_TABLET_DEF(StateWork,
- HFunc(TEvents::TEvPoisonPill, Handle)
HFunc(TEvSubDomain::TEvConfigure, Handle)
HFunc(TEvTxCoordinator::TEvCoordinatorStep, Handle)
HFunc(TEvTxCoordinator::TEvCoordinatorSync, Handle)
diff --git a/ydb/core/tx/replication/controller/controller.cpp b/ydb/core/tx/replication/controller/controller.cpp
index 8d600042ab..3add4984f3 100644
--- a/ydb/core/tx/replication/controller/controller.cpp
+++ b/ydb/core/tx/replication/controller/controller.cpp
@@ -17,11 +17,13 @@ TController::TController(const TActorId& tablet, TTabletStorageInfo* info)
void TController::OnDetach(const TActorContext& ctx) {
CLOG_T(ctx, "OnDetach");
+ Cleanup(ctx);
Die(ctx);
}
void TController::OnTabletDead(TEvTablet::TEvTabletDead::TPtr&, const TActorContext& ctx) {
CLOG_T(ctx, "OnTabletDead");
+ Cleanup(ctx);
Die(ctx);
}
@@ -35,14 +37,6 @@ void TController::DefaultSignalTabletActive(const TActorContext&) {
}
STFUNC(TController::StateInit) {
- switch (ev->GetTypeRewrite()) {
- HFunc(TEvents::TEvPoison, Handle);
- default:
- return StateInitImpl(ev, SelfId());
- }
-}
-
-STFUNC(TController::StateZombie) {
StateInitImpl(ev, SelfId());
}
@@ -61,10 +55,21 @@ STFUNC(TController::StateWork) {
HFunc(TEvPrivate::TEvUpdateTenantNodes, Handle);
HFunc(TEvDiscovery::TEvDiscoveryData, Handle);
HFunc(TEvDiscovery::TEvError, Handle);
- HFunc(TEvents::TEvPoison, Handle);
}
}
+void TController::Cleanup(const TActorContext& ctx) {
+ for (auto& [_, replication] : Replications) {
+ replication->Shutdown(ctx);
+ }
+
+ if (auto actorId = std::exchange(DiscoveryCache, {})) {
+ Send(actorId, new TEvents::TEvPoison());
+ }
+
+ NodesManager.Shutdown(ctx);
+}
+
void TController::SwitchToWork(const TActorContext& ctx) {
CLOG_T(ctx, "SwitchToWork");
@@ -188,23 +193,6 @@ void TController::Handle(TEvDiscovery::TEvError::TPtr& ev, const TActorContext&
NodesManager.ProcessResponse(ev, ctx);
}
-void TController::Handle(TEvents::TEvPoison::TPtr& ev, const TActorContext& ctx) {
- CLOG_T(ctx, "Handle " << ev->Get()->ToString());
-
- for (auto& [_, replication] : Replications) {
- replication->Shutdown(ctx);
- }
-
- if (auto actorId = std::exchange(DiscoveryCache, {})) {
- Send(actorId, new TEvents::TEvPoison());
- }
-
- NodesManager.Shutdown(ctx);
-
- Send(Tablet(), new TEvents::TEvPoison());
- Become(&TThis::StateZombie);
-}
-
TReplication::TPtr TController::Find(ui64 id) {
auto it = Replications.find(id);
if (it == Replications.end()) {
diff --git a/ydb/core/tx/replication/controller/controller_impl.h b/ydb/core/tx/replication/controller/controller_impl.h
index 9e1d15d78b..74cb25a3ff 100644
--- a/ydb/core/tx/replication/controller/controller_impl.h
+++ b/ydb/core/tx/replication/controller/controller_impl.h
@@ -54,9 +54,9 @@ private:
// state functions
STFUNC(StateInit);
- STFUNC(StateZombie);
STFUNC(StateWork);
+ void Cleanup(const TActorContext& ctx);
void SwitchToWork(const TActorContext& ctx);
void Reset();
@@ -74,7 +74,6 @@ private:
void Handle(TEvPrivate::TEvUpdateTenantNodes::TPtr& ev, const TActorContext& ctx);
void Handle(TEvDiscovery::TEvDiscoveryData::TPtr& ev, const TActorContext& ctx);
void Handle(TEvDiscovery::TEvError::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvents::TEvPoison::TPtr& ev, const TActorContext& ctx);
// local transactions
class TTxInitSchema;
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_fs.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_fs.cpp
index 47eb1b6d9c..53c54f7ba1 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_fs.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_fs.cpp
@@ -26,7 +26,9 @@ public:
TConfigureParts(TOperationId id)
: OperationId(id)
{
- IgnoreMessages(DebugHint(), {});
+ IgnoreMessages(DebugHint(), {
+ TEvHive::TEvCreateTabletReply::EventType
+ });
}
bool HandleReply(
@@ -132,7 +134,9 @@ public:
TPropose(TOperationId id)
: OperationId(id)
{
- IgnoreMessages(DebugHint(), {});
+ IgnoreMessages(DebugHint(), {
+ TEvHive::TEvCreateTabletReply::EventType
+ });
}
bool HandleReply(
diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.cpp b/ydb/core/tx/schemeshard/schemeshard_impl.cpp
index 57a364418e..37dbeb0e36 100644
--- a/ydb/core/tx/schemeshard/schemeshard_impl.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_impl.cpp
@@ -4201,7 +4201,6 @@ void TSchemeShard::Enqueue(STFUNC_SIG) {
void TSchemeShard::StateInit(STFUNC_SIG) {
TRACE_EVENT(NKikimrServices::FLAT_TX_SCHEMESHARD);
switch (ev->GetTypeRewrite()) {
- HFuncTraced(TEvents::TEvPoisonPill, Handle);
HFuncTraced(TEvents::TEvUndelivered, Handle);
//console configs
@@ -4219,7 +4218,6 @@ void TSchemeShard::StateConfigure(STFUNC_SIG) {
TRACE_EVENT(NKikimrServices::FLAT_TX_SCHEMESHARD);
switch (ev->GetTypeRewrite()) {
- HFuncTraced(TEvents::TEvPoisonPill, Handle);
HFuncTraced(TEvents::TEvUndelivered, Handle);
HFuncTraced(TEvSchemeShard::TEvInitRootShard, Handle);
@@ -4262,7 +4260,6 @@ void TSchemeShard::StateWork(STFUNC_SIG) {
TRACE_EVENT(NKikimrServices::FLAT_TX_SCHEMESHARD);
switch (ev->GetTypeRewrite()) {
- HFuncTraced(TEvents::TEvPoisonPill, Handle);
HFuncTraced(TEvents::TEvUndelivered, Handle);
HFuncTraced(TEvSchemeShard::TEvInitRootShard, Handle);
@@ -5813,11 +5810,6 @@ void TSchemeShard::RestartPipeTx(TTabletId tabletId, const TActorContext& ctx) {
}
}
-void TSchemeShard::Handle(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx) {
- Y_UNUSED(ev);
- BreakTabletAndRestart(ctx);
-}
-
void TSchemeShard::Handle(NMon::TEvRemoteHttpInfo::TPtr& ev, const TActorContext& ctx) {
RenderHtmlPage(ev, ctx);
}
diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.h b/ydb/core/tx/schemeshard/schemeshard_impl.h
index 639da0462f..5f3970d2a8 100644
--- a/ydb/core/tx/schemeshard/schemeshard_impl.h
+++ b/ydb/core/tx/schemeshard/schemeshard_impl.h
@@ -986,7 +986,6 @@ public:
void Handle(TEvTxProcessing::TEvPlanStep::TPtr &ev, const TActorContext &ctx);
void Handle(TEvents::TEvUndelivered::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvents::TEvPoisonPill::TPtr& ev, const TActorContext& ctx);
void Handle(NMon::TEvRemoteHttpInfo::TPtr& ev, const TActorContext& ctx);
void Handle(TEvDataShard::TEvInitSplitMergeDestinationAck::TPtr& ev, const TActorContext& ctx);
diff --git a/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp b/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp
index f9bb758bbc..b93fd8295d 100644
--- a/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp
+++ b/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp
@@ -33,14 +33,13 @@ public:
, TTabletExecutedFlat(info, tablet, new NMiniKQL::TMiniKQLFactory)
{}
+ void DefaultSignalTabletActive(const TActorContext&) override {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext& ctx) override {
Become(&TThis::StateWork);
-
- while (!InitialEventsQueue.empty()) {
- TAutoPtr<IEventHandle>& ev = InitialEventsQueue.front();
- ctx.ExecutorThread.Send(ev.Release());
- InitialEventsQueue.pop_front();
- }
+ SignalTabletActive(ctx);
}
void OnDetach(const TActorContext& ctx) override {
@@ -52,10 +51,6 @@ public:
Die(ctx);
}
- void Enqueue(STFUNC_SIG) override {
- InitialEventsQueue.push_back(ev);
- }
-
STFUNC(StateInit) {
StateInitImpl(ev, SelfId());
}
@@ -64,13 +59,6 @@ public:
switch (ev->GetTypeRewrite()) {
HFunc(TEvTablet::TEvTabletDead, HandleTabletDead);
HFunc(TEvBlockStore::TEvUpdateVolumeConfig, Handle);
- HFunc(TEvents::TEvPoisonPill, Handle);
- }
- }
-
- STFUNC(StateBroken) {
- switch (ev->GetTypeRewrite()) {
- HFunc(TEvTablet::TEvTabletDead, HandleTabletDead);
}
}
@@ -84,15 +72,6 @@ private:
response->Record.SetStatus(NKikimrBlockStore::OK);
ctx.Send(ev->Sender, response.Release());
}
-
- void Handle(TEvents::TEvPoisonPill::TPtr& ev, const TActorContext& ctx) {
- Y_UNUSED(ev);
- Become(&TThis::StateBroken);
- ctx.Send(Tablet(), new TEvents::TEvPoisonPill());
- }
-
-private:
- TDeque<TAutoPtr<IEventHandle>> InitialEventsQueue;
};
class TFakeFileStore : public TActor<TFakeFileStore>, public NTabletFlatExecutor::TTabletExecutedFlat {
@@ -102,14 +81,13 @@ public:
, TTabletExecutedFlat(info, tablet, new NMiniKQL::TMiniKQLFactory)
{}
+ void DefaultSignalTabletActive(const TActorContext&) override {
+ // must be empty
+ }
+
void OnActivateExecutor(const TActorContext& ctx) override {
Become(&TThis::StateWork);
-
- while (!InitialEventsQueue.empty()) {
- TAutoPtr<IEventHandle>& ev = InitialEventsQueue.front();
- ctx.ExecutorThread.Send(ev.Release());
- InitialEventsQueue.pop_front();
- }
+ SignalTabletActive(ctx);
}
void OnDetach(const TActorContext& ctx) override {
@@ -121,10 +99,6 @@ public:
Die(ctx);
}
- void Enqueue(STFUNC_SIG) override {
- InitialEventsQueue.push_back(ev);
- }
-
STFUNC(StateInit) {
StateInitImpl(ev, SelfId());
}
@@ -133,13 +107,6 @@ public:
switch (ev->GetTypeRewrite()) {
HFunc(TEvTablet::TEvTabletDead, HandleTabletDead);
HFunc(TEvFileStore::TEvUpdateConfig, Handle);
- HFunc(TEvents::TEvPoisonPill, Handle);
- }
- }
-
- STFUNC(StateBroken) {
- switch (ev->GetTypeRewrite()) {
- HFunc(TEvTablet::TEvTabletDead, HandleTabletDead);
}
}
@@ -153,15 +120,6 @@ private:
response->Record.SetStatus(NKikimrFileStore::OK);
ctx.Send(ev->Sender, response.Release());
}
-
- void Handle(TEvents::TEvPoisonPill::TPtr& ev, const TActorContext& ctx) {
- Y_UNUSED(ev);
- Become(&TThis::StateBroken);
- ctx.Send(Tablet(), new TEvents::TEvPoisonPill());
- }
-
-private:
- TDeque<TAutoPtr<IEventHandle>> InitialEventsQueue;
};
class TFakeConfigDispatcher : public TActor<TFakeConfigDispatcher> {
diff --git a/ydb/core/tx/sequenceshard/sequenceshard_impl.cpp b/ydb/core/tx/sequenceshard/sequenceshard_impl.cpp
index 476cb31531..d28667ddcb 100644
--- a/ydb/core/tx/sequenceshard/sequenceshard_impl.cpp
+++ b/ydb/core/tx/sequenceshard/sequenceshard_impl.cpp
@@ -75,23 +75,11 @@ namespace NSequenceShard {
}
STFUNC(TSequenceShard::StateInit) {
- switch (ev->GetTypeRewrite()) {
- hFunc(TEvents::TEvPoison, Handle);
-
- default:
- StateInitImpl(ev, SelfId());
- break;
- }
- }
-
- STFUNC(TSequenceShard::StateZombie) {
StateInitImpl(ev, SelfId());
}
STFUNC(TSequenceShard::StateWork) {
switch (ev->GetTypeRewrite()) {
- hFunc(TEvents::TEvPoison, Handle);
-
hFunc(TEvTabletPipe::TEvServerConnected, Handle);
hFunc(TEvTabletPipe::TEvServerDisconnected, Handle);
@@ -117,11 +105,6 @@ namespace NSequenceShard {
Become(&TThis::StateWork);
}
- void TSequenceShard::Handle(TEvents::TEvPoison::TPtr&) {
- Send(Tablet(), new TEvents::TEvPoison());
- Become(&TThis::StateZombie);
- }
-
void TSequenceShard::Handle(TEvTabletPipe::TEvServerConnected::TPtr& ev) {
auto* msg = ev->Get();
Y_VERIFY_DEBUG(!PipeInfos.contains(msg->ServerId), "Unexpected duplicate pipe server");
diff --git a/ydb/core/tx/sequenceshard/sequenceshard_impl.h b/ydb/core/tx/sequenceshard/sequenceshard_impl.h
index cd216d9a91..c1da07235f 100644
--- a/ydb/core/tx/sequenceshard/sequenceshard_impl.h
+++ b/ydb/core/tx/sequenceshard/sequenceshard_impl.h
@@ -85,12 +85,10 @@ namespace NSequenceShard {
private:
STFUNC(StateInit);
- STFUNC(StateZombie);
STFUNC(StateWork);
void SwitchToWork(const TActorContext& ctx);
- void Handle(TEvents::TEvPoison::TPtr& ev);
void Handle(TEvTabletPipe::TEvServerConnected::TPtr& ev);
void Handle(TEvTabletPipe::TEvServerDisconnected::TPtr& ev);
void Handle(TEvSequenceShard::TEvMarkSchemeShardPipe::TPtr& ev, const TActorContext& ctx);
diff --git a/ydb/core/tx/tx_allocator/txallocator_impl.cpp b/ydb/core/tx/tx_allocator/txallocator_impl.cpp
index a4940b8f35..63eb70982f 100644
--- a/ydb/core/tx/tx_allocator/txallocator_impl.cpp
+++ b/ydb/core/tx/tx_allocator/txallocator_impl.cpp
@@ -50,14 +50,6 @@ void TTxAllocator::InitCounters(const TActorContext &ctx) {
MonCounters.AllocationsPresence = MonCounters.AllocatorCounters->GetCounter("AllocationPresence", true);
}
-void TTxAllocator::Handle(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx) {
- Y_UNUSED(ev);
- LOG_DEBUG_S(ctx, NKikimrServices::TX_ALLOCATOR, "tablet# " << TabletID() << " HANDLE TEvPoisonPill Sender# " << ev->Sender.ToString());
-
- Become(&TThis::StateBroken);
- ctx.Send(Tablet(), new TEvents::TEvPoisonPill);
-}
-
void TTxAllocator::Handle(TEvTxAllocator::TEvAllocate::TPtr &ev, const TActorContext &ctx) {
MonCounters.AllocationsPresence->Inc();
diff --git a/ydb/core/tx/tx_allocator/txallocator_impl.h b/ydb/core/tx/tx_allocator/txallocator_impl.h
index b04a495824..a4d3850f5c 100644
--- a/ydb/core/tx/tx_allocator/txallocator_impl.h
+++ b/ydb/core/tx/tx_allocator/txallocator_impl.h
@@ -50,7 +50,6 @@ private:
void ReplyImposible(const TEvTxAllocator::TEvAllocate::TPtr &ev, const TActorContext &ctx);
void Handle(TEvTxAllocator::TEvAllocate::TPtr &ev, const TActorContext &ctx);
- void Handle(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx);
public:
struct Schema : NIceDb::Schema {
@@ -96,7 +95,6 @@ public:
STFUNC(StateWork) {
switch (ev->GetTypeRewrite()) {
HFunc(TEvTxAllocator::TEvAllocate, Handle);
- HFunc(TEvents::TEvPoisonPill, Handle);
IgnoreFunc(TEvTabletPipe::TEvServerConnected);
IgnoreFunc(TEvTabletPipe::TEvServerDisconnected);
default:
@@ -109,16 +107,6 @@ public:
}
}
}
-
- STFUNC(StateBroken) {
- if (!HandleDefaultEvents(ev, SelfId())) {
- ALOG_ERROR(NKikimrServices::TX_ALLOCATOR,
- "tablet# " << TabletID() <<
- " IGNORING message type# " << ev->GetTypeRewrite() <<
- " from Sender# " << ev->Sender.ToString() <<
- " at StateBroken");
- }
- }
};
}
}