Skip to content

Commit

Permalink
[Misc] Add YDB patch (#3012)
Browse files Browse the repository at this point in the history
  • Loading branch information
ya-ksgamora authored Feb 11, 2025
1 parent 39c744c commit 6b302ee
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include <contrib/ydb/core/base/appdata.h>
#include <contrib/ydb/core/mon/mon.h>
#include <contrib/ydb/library/actors/core/executor_thread.h>

namespace NCloud::NBlockStore::NStorage {

Expand Down Expand Up @@ -65,7 +64,7 @@ void TDiskAgentActor::RegisterPages(const TActorContext& ctx)
auto* rootPage = mon->RegisterIndexPage("blockstore", "BlockStore");

mon->RegisterActorPage(rootPage, "disk_agent", "DiskAgent",
false, ctx.ExecutorThread.ActorSystem, SelfId());
false, ctx.ActorSystem(), SelfId());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <cloud/blockstore/libs/storage/core/request_info.h>

#include <contrib/ydb/core/base/appdata.h>
#include <contrib/ydb/library/actors/core/executor_thread.h>

namespace NCloud::NBlockStore::NStorage {

Expand Down Expand Up @@ -243,9 +242,9 @@ void TDiskAgentActor::HandleRegisterAgentResponse(

auto request = std::make_unique<TEvDiskAgentPrivate::TEvRegisterAgentRequest>();

ctx.ExecutorThread.Schedule(
ctx.Schedule(
AgentConfig->GetRegisterRetryTimeout(),
new IEventHandle(ctx.SelfID, ctx.SelfID, request.get()));
std::make_unique<IEventHandle>(ctx.SelfID, ctx.SelfID, request.get()));

request.release();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include <cloud/blockstore/libs/storage/api/disk_registry_proxy.h>
#include <cloud/blockstore/libs/storage/core/request_info.h>

#include <contrib/ydb/library/actors/core/executor_thread.h>

namespace NCloud::NBlockStore::NStorage {

using namespace NActors;
Expand Down Expand Up @@ -136,9 +134,9 @@ void TStatsActor::ScheduleUpdateStats(const TActorContext& ctx)

auto request = std::make_unique<TEvents::TEvWakeup>();

ctx.ExecutorThread.Schedule(
ctx.Schedule(
UpdateCountersInterval,
new IEventHandle(ctx.SelfID, ctx.SelfID, request.release()));
std::make_unique<IEventHandle>(ctx.SelfID, ctx.SelfID, request.release()));
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ void TDiskRegistryActor::StartMigration(const NActors::TActorContext& ctx)
ctx.Now().MicroSeconds(),
deadline.MicroSeconds());

ctx.ExecutorThread.Schedule(
ctx.Schedule(
deadline,
new IEventHandle(ctx.SelfID, ctx.SelfID, request.release()));
std::make_unique<IEventHandle>(ctx.SelfID, ctx.SelfID, request.release()));
} else {
LOG_INFO(ctx, TBlockStoreComponents::DISK_REGISTRY,
"[%lu] Sending device migration request",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ void TDiskRegistryActor::PublishDiskStates(const TActorContext& ctx)
ctx.Now().MicroSeconds(),
deadline.MicroSeconds());

ctx.ExecutorThread.Schedule(
ctx.Schedule(
deadline,
new IEventHandle(ctx.SelfID, ctx.SelfID, request.get()));
std::make_unique<IEventHandle>(ctx.SelfID, ctx.SelfID, request.get()));
request.release();
} else {
LOG_INFO(ctx, TBlockStoreComponents::DISK_REGISTRY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include <cloud/blockstore/libs/storage/api/disk_agent.h>
#include <cloud/blockstore/libs/storage/disk_registry/model/device_list.h>

#include <contrib/ydb/library/actors/core/executor_thread.h>

namespace NCloud::NBlockStore::NStorage {

using namespace NActors;
Expand Down Expand Up @@ -366,9 +364,9 @@ void TDiskRegistryActor::SecureErase(const TActorContext& ctx)
ctx.Now().MicroSeconds(),
deadline.MicroSeconds());

ctx.ExecutorThread.Schedule(
ctx.Schedule(
deadline,
new IEventHandle(ctx.SelfID, ctx.SelfID, request.release()));
std::make_unique<IEventHandle>(ctx.SelfID, ctx.SelfID, request.release()));
} else {
LOG_INFO(
ctx,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,9 @@ void TDiskRegistryActor::HandleUpdateVolumeConfigResponse(
{
auto* request = new TEvDiskRegistryPrivate::TEvUpdateVolumeConfigRequest(diskId);

ctx.ExecutorThread.Schedule(
ctx.Schedule(
BackoffDelayProvider.GetDelay(),
new IEventHandle(
std::make_unique<IEventHandle>(
ctx.SelfID,
ctx.SelfID,
request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class TTestDiskAgent final
NKikimr::NTabletPipe::TClientConfig pipeConfig(
NKikimr::NTabletPipe::TClientRetryPolicy::WithRetries());

auto pipe = ctx.ExecutorThread.RegisterActor(
auto pipe = ctx.Register(
NKikimr::NTabletPipe::CreateClient(
ctx.SelfID,
TestTabletId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <contrib/ydb/core/mon/mon.h>
#include <contrib/ydb/core/tablet/tablet_pipe_client_cache.h>
#include <contrib/ydb/library/actors/core/actor_bootstrapped.h>
#include <contrib/ydb/library/actors/core/executor_thread.h>
#include <contrib/ydb/library/actors/core/log.h>

#include <library/cpp/monlib/service/pages/templates.h>
Expand Down Expand Up @@ -81,9 +80,9 @@ void TDiskRegistryProxyActor::LookupTablet(const TActorContext& ctx)
Config->GetOwner(),
Config->GetOwnerIdx());

ctx.ExecutorThread.Schedule(
ctx.Schedule(
Config->GetLookupTimeout(),
new IEventHandle(
std::make_unique<IEventHandle>(
ctx.SelfID,
ctx.SelfID,
new TEvents::TEvWakeup(),
Expand Down Expand Up @@ -179,7 +178,7 @@ void TDiskRegistryProxyActor::RegisterPages(const TActorContext& ctx)
auto* rootPage = mon->RegisterIndexPage("blockstore", "BlockStore");

mon->RegisterActorPage(rootPage, "disk_registry_proxy", "DiskRegistryProxy",
false, ctx.ExecutorThread.ActorSystem, SelfId());
false, ctx.ActorSystem(), SelfId());
}
}

Expand Down
3 changes: 1 addition & 2 deletions cloud/blockstore/libs/storage/service/service_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include <contrib/ydb/core/base/appdata.h>
#include <contrib/ydb/core/mon/mon.h>
#include <contrib/ydb/library/actors/core/executor_thread.h>

namespace NCloud::NBlockStore::NStorage {

Expand Down Expand Up @@ -61,7 +60,7 @@ void TServiceActor::RegisterPages(const TActorContext& ctx)
auto* rootPage = mon->RegisterIndexPage("blockstore", "BlockStore");

mon->RegisterActorPage(rootPage, "service", "Service",
false, ctx.ExecutorThread.ActorSystem, SelfId());
false, ctx.ActorSystem(), SelfId());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include <contrib/ydb/library/actors/core/actor_bootstrapped.h>
#include <contrib/ydb/library/actors/core/events.h>
#include <contrib/ydb/library/actors/core/executor_thread.h>
#include <contrib/ydb/library/actors/core/hfunc.h>
#include <contrib/ydb/library/actors/core/log.h>

Expand Down Expand Up @@ -182,9 +181,9 @@ void TWaitDependentDisksToSwitchNodeActor::ScheduleGetVolumeInfoRequest(

auto request = std::make_unique<TEvVolume::TEvGetVolumeInfoRequest>();
request->Record.SetDiskId(DependentDiskStates[cookie].GetDiskId());
ctx.ExecutorThread.Schedule(
ctx.Schedule(
RetryTimeout,
new IEventHandle(
std::make_unique<IEventHandle>(
MakeVolumeProxyServiceId(),
SelfId(),
request.release(),
Expand Down Expand Up @@ -263,9 +262,9 @@ void TWaitDependentDisksToSwitchNodeActor::HandleGetDependentDisksResponse(
TEvDiskRegistry::TEvGetDependentDisksRequest>();
request->Record.SetHost(Request.GetAgentId());

ctx.ExecutorThread.Schedule(
ctx.Schedule(
RetryTimeout,
new IEventHandle(
std::make_unique<IEventHandle>(
MakeDiskRegistryProxyServiceId(),
SelfId(),
request.release()));
Expand Down
3 changes: 1 addition & 2 deletions cloud/blockstore/libs/storage/testlib/disk_agent_mock.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include <contrib/ydb/library/actors/core/actor.h>
#include <contrib/ydb/library/actors/core/events.h>
#include <contrib/ydb/library/actors/core/executor_thread.h>

#include <util/generic/hash.h>

Expand Down Expand Up @@ -82,7 +81,7 @@ class TDiskAgentMock final
0, // flags
request.Cookie);

ctx.ExecutorThread.Schedule(State->ResponseDelay, event.release());
ctx.Schedule(State->ResponseDelay, std::move(event));

return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <contrib/ydb/core/base/appdata.h>
#include <contrib/ydb/core/mon/mon.h>
#include <contrib/ydb/library/actors/core/actor_bootstrapped.h>
#include <contrib/ydb/library/actors/core/executor_thread.h>

#include <util/datetime/base.h>
#include <util/generic/algorithm.h>
Expand Down Expand Up @@ -165,7 +164,7 @@ void TVolumeBalancerActor::RegisterPages(const TActorContext& ctx)
auto* rootPage = mon->RegisterIndexPage("blockstore", "BlockStore");

mon->RegisterActorPage(rootPage, "balancer", "Balancer",
false, ctx.ExecutorThread.ActorSystem, SelfId());
false, ctx.ActorSystem(), SelfId());
}
}

Expand Down
3 changes: 1 addition & 2 deletions cloud/filestore/libs/storage/service/service_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <contrib/ydb/core/base/appdata.h>
#include <contrib/ydb/core/mon/mon.h>
#include <contrib/ydb/library/actors/core/executor_thread.h>

namespace NCloud::NFileStore::NStorage {

Expand Down Expand Up @@ -51,7 +50,7 @@ void TStorageServiceActor::RegisterPages(const NActors::TActorContext& ctx)
auto* rootPage = mon->RegisterIndexPage("filestore", "FileStore");

mon->RegisterActorPage(rootPage, "service", "Service",
false, ctx.ExecutorThread.ActorSystem, SelfId());
false, ctx.ActorSystem(), SelfId());
}
}

Expand Down
3 changes: 1 addition & 2 deletions cloud/storage/core/libs/user_stats/user_stats_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include <contrib/ydb/core/base/appdata.h>
#include <contrib/ydb/library/actors/core/actor.h>
#include <contrib/ydb/library/actors/core/executor_thread.h>

#include <library/cpp/monlib/dynamic_counters/encode.h>
#include <library/cpp/monlib/encode/json/json.h>
Expand Down Expand Up @@ -45,7 +44,7 @@ void TUserStatsActor::RegisterPages(const NActors::TActorContext& ctx)
auto* rootPage = mon->RegisterIndexPage(Path, Title);

mon->RegisterActorPage(rootPage, "user_stats/human", "UserStats",
true, ctx.ExecutorThread.ActorSystem, SelfId());
true, ctx.ActorSystem(), SelfId());

mon->Register(new TMonPageWrapper(
Path + "/user_stats/json",
Expand Down
12 changes: 12 additions & 0 deletions contrib/ydb/library/actors/core/actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,18 @@ namespace NActors {
ExecutorThread.Schedule(delta, new IEventHandle(SelfID, TActorId(), ev), cookie);
}

void TActorContext::Schedule(TInstant deadline, std::unique_ptr<IEventHandle> ev, ISchedulerCookie* cookie) const {
ExecutorThread.Schedule(deadline, ev.release(), cookie);
}

void TActorContext::Schedule(TMonotonic deadline, std::unique_ptr<IEventHandle> ev, ISchedulerCookie* cookie) const {
ExecutorThread.Schedule(deadline, ev.release(), cookie);
}

void TActorContext::Schedule(TDuration delta, std::unique_ptr<IEventHandle> ev, ISchedulerCookie* cookie) const {
ExecutorThread.Schedule(delta, ev.release(), cookie);
}

void IActor::Schedule(TInstant deadline, IEventBase* ev, ISchedulerCookie* cookie) const noexcept {
TlsActivationContext->ExecutorThread.Schedule(deadline, new IEventHandle(SelfActorId, TActorId(), ev), cookie);
}
Expand Down
4 changes: 4 additions & 0 deletions contrib/ydb/library/actors/core/actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ namespace NActors {
*/
void Schedule(TDuration delta, IEventBase* ev, ISchedulerCookie* cookie = nullptr) const;

void Schedule(TInstant deadline, std::unique_ptr<IEventHandle> ev, ISchedulerCookie* cookie = nullptr) const;
void Schedule(TMonotonic deadline, std::unique_ptr<IEventHandle> ev, ISchedulerCookie* cookie = nullptr) const;
void Schedule(TDuration delta, std::unique_ptr<IEventHandle> ev, ISchedulerCookie* cookie = nullptr) const;

TActorContext MakeFor(const TActorId& otherId) const {
return TActorContext(Mailbox, ExecutorThread, EventStart, otherId);
}
Expand Down

0 comments on commit 6b302ee

Please sign in to comment.