Skip to content

Commit 32a71a7

Browse files
committed
WIP
1 parent 9dc2deb commit 32a71a7

File tree

3 files changed

+35
-8
lines changed

3 files changed

+35
-8
lines changed
Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,40 @@
11
#include "incr_restore_scan.h"
22

33
#include <library/cpp/testing/unittest/registar.h>
4+
#include <ydb/core/testlib/test_client.h>
5+
#include <ydb/core/util/testactorsys.h>
46

5-
namespace NKikimr {
7+
namespace NKikimr::NDataShard {
68

79
Y_UNIT_TEST_SUITE(IncrementalRestoreScan) {
810
Y_UNIT_TEST(Simple) {
11+
TPortManager pm;
12+
Tests::TServerSettings serverSettings(pm.GetPort(2134));
13+
serverSettings.SetDomainName("Root")
14+
.SetUseRealThreads(false);
915

16+
Tests::TServer::TPtr server = new Tests::TServer(serverSettings);
17+
auto &runtime = *server->GetRuntime();
18+
auto sender = runtime.AllocateEdgeActor();
19+
auto sender2 = runtime.AllocateEdgeActor();
20+
21+
runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_TRACE);
22+
runtime.SetLogPriority(NKikimrServices::TX_PROXY, NLog::PRI_TRACE);
23+
24+
TUserTable::TCPtr table;
25+
TPathId targetPathId{};
26+
ui64 txId = 0;
27+
28+
auto scan = CreateIncrementalRestoreScan(
29+
sender,
30+
[&](const TActorContext&) {
31+
return sender2;
32+
},
33+
TPathId{} /*sourcePathId*/,
34+
table,
35+
targetPathId,
36+
txId);
1037
}
1138
}
1239

13-
} // namespace NKikimr
40+
} // namespace NKikimr::NDataShard

ydb/core/tx/datashard/incr_restore_scan.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class TIncrementalRestoreScan
4141
public:
4242
explicit TIncrementalRestoreScan(
4343
TActorId parent,
44-
std::function<IActor*()> changeSenderFactory,
44+
std::function<TActorId(const TActorContext& ctx)> changeSenderFactory,
4545
ui64 txId,
4646
const TPathId& sourcePathId,
4747
TUserTable::TCPtr table,
@@ -73,7 +73,7 @@ class TIncrementalRestoreScan
7373
}
7474

7575
void Registered(TActorSystem*, const TActorId&) override {
76-
ChangeSender = RegisterWithSameMailbox(ChangeSenderFactory());
76+
ChangeSender = ChangeSenderFactory(TlsActivationContext->AsActorContext());
7777
}
7878

7979
void PassAway() override {
@@ -177,7 +177,7 @@ class TIncrementalRestoreScan
177177
}
178178

179179
TAutoPtr<IDestructable> Finish(EAbort abort) noexcept override {
180-
LOG_D("Finish " << abort);
180+
LOG_D("Finish " << static_cast<ui64>(abort));
181181

182182
if (abort != EAbort::None) {
183183
Send(Parent, new TEvIncrementalRestoreScan::TEvFinished{});
@@ -240,7 +240,7 @@ class TIncrementalRestoreScan
240240

241241
private:
242242
const TActorId Parent;
243-
const std::function<IActor*()> ChangeSenderFactory;
243+
const std::function<TActorId(const TActorContext& ctx)> ChangeSenderFactory;
244244
const ui64 TxId;
245245
const TPathId SourcePathId;
246246
const TPathId TargetPathId;
@@ -262,7 +262,7 @@ class TIncrementalRestoreScan
262262

263263
THolder<NTable::IScan> CreateIncrementalRestoreScan(
264264
NActors::TActorId parent,
265-
std::function<NActors::IActor*()> changeSenderFactory,
265+
std::function<TActorId(const TActorContext& ctx)> changeSenderFactory,
266266
TPathId sourcePathId,
267267
TUserTable::TCPtr table,
268268
const TPathId& targetPathId,

ydb/core/tx/datashard/incr_restore_scan.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct TEvIncrementalRestoreScan {
2828

2929
THolder<NTable::IScan> CreateIncrementalRestoreScan(
3030
NActors::TActorId parent,
31-
std::function<NActors::IActor*()> changeSenderFactory,
31+
std::function<TActorId(const TActorContext& ctx)> changeSenderFactory,
3232
TPathId tablePathId,
3333
TUserTable::TCPtr table,
3434
const TPathId& targetPathId,

0 commit comments

Comments
 (0)