aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexvru <alexvru@ydb.tech>2023-07-24 18:08:24 +0300
committeralexvru <alexvru@ydb.tech>2023-07-24 18:08:24 +0300
commit0e2bc955938ac84ce36bead4c657b4942252a5d3 (patch)
treefd3d200c968c3da99da2f774bdc4a5ed93bbc3ce
parent44d100d0923483335dba2ec80675446ac3a6ca38 (diff)
downloadydb-0e2bc955938ac84ce36bead4c657b4942252a5d3.tar.gz
Allow TestShard operation without storage server KIKIMR-11082
-rw-r--r--ydb/core/blobstorage/ut_testshard/main.cpp1
-rw-r--r--ydb/core/test_tablet/load_actor_impl.cpp14
-rw-r--r--ydb/core/test_tablet/load_actor_read_validate.cpp24
-rw-r--r--ydb/core/test_tablet/load_actor_state.cpp19
4 files changed, 48 insertions, 10 deletions
diff --git a/ydb/core/blobstorage/ut_testshard/main.cpp b/ydb/core/blobstorage/ut_testshard/main.cpp
index 5199a5fdce0..fb2d3932317 100644
--- a/ydb/core/blobstorage/ut_testshard/main.cpp
+++ b/ydb/core/blobstorage/ut_testshard/main.cpp
@@ -76,6 +76,7 @@ Y_UNIT_TEST_SUITE(BlobDepotWithTestShard) {
auto& record = ev->Record;
record.SetTabletId(tabletId);
auto *cmd = record.MutableInitialize();
+ cmd->SetStorageServerHost("");
cmd->SetMaxDataBytes(1'000'000'000);
cmd->SetMinDataBytes(100'000'000);
cmd->SetMaxInFlight(2);
diff --git a/ydb/core/test_tablet/load_actor_impl.cpp b/ydb/core/test_tablet/load_actor_impl.cpp
index a5541dbdb3d..84b696096e6 100644
--- a/ydb/core/test_tablet/load_actor_impl.cpp
+++ b/ydb/core/test_tablet/load_actor_impl.cpp
@@ -13,15 +13,21 @@ namespace NKikimr::NTestShard {
void TLoadActor::Bootstrap(const TActorId& parentId) {
STLOG(PRI_DEBUG, TEST_SHARD, TS31, "TLoadActor::Bootstrap", (TabletId, TabletId));
TabletActorId = parentId;
- Send(MakeStateServerInterfaceActorId(), new TEvStateServerConnect(Settings.GetStorageServerHost(),
- Settings.GetStorageServerPort()));
- Send(parentId, new TTestShard::TEvSwitchMode(TTestShard::EMode::STATE_SERVER_CONNECT));
+ if (Settings.HasStorageServerHost()) {
+ Send(MakeStateServerInterfaceActorId(), new TEvStateServerConnect(Settings.GetStorageServerHost(),
+ Settings.GetStorageServerPort()));
+ Send(parentId, new TTestShard::TEvSwitchMode(TTestShard::EMode::STATE_SERVER_CONNECT));
+ } else {
+ RunValidation(true);
+ }
NextWriteTimestamp = TActivationContext::Monotonic();
Become(&TThis::StateFunc);
}
void TLoadActor::PassAway() {
- Send(MakeStateServerInterfaceActorId(), new TEvStateServerDisconnect);
+ if (Settings.HasStorageServerHost()) {
+ Send(MakeStateServerInterfaceActorId(), new TEvStateServerDisconnect);
+ }
if (ValidationActorId) {
TActivationContext::Send(new IEventHandle(TEvents::TSystem::Poison, 0, ValidationActorId, SelfId(), nullptr, 0));
}
diff --git a/ydb/core/test_tablet/load_actor_read_validate.cpp b/ydb/core/test_tablet/load_actor_read_validate.cpp
index ad9ae89293b..8effeaefe5e 100644
--- a/ydb/core/test_tablet/load_actor_read_validate.cpp
+++ b/ydb/core/test_tablet/load_actor_read_validate.cpp
@@ -62,15 +62,21 @@ namespace NKikimr::NTestShard {
void Bootstrap(const TActorId& parentId) {
ParentId = parentId;
- Send(MakeStateServerInterfaceActorId(), new TEvStateServerConnect(Settings.GetStorageServerHost(),
- Settings.GetStorageServerPort()));
+ if (Settings.HasStorageServerHost()) {
+ Send(MakeStateServerInterfaceActorId(), new TEvStateServerConnect(Settings.GetStorageServerHost(),
+ Settings.GetStorageServerPort()));
+ } else {
+ StateReadComplete = true;
+ }
IssueNextReadRangeQuery();
STLOG(PRI_INFO, TEST_SHARD, TS07, "starting read&validate", (TabletId, TabletId));
Become(&TThis::StateFunc);
}
void PassAway() override {
- Send(MakeStateServerInterfaceActorId(), new TEvStateServerDisconnect);
+ if (Settings.HasStorageServerHost()) {
+ Send(MakeStateServerInterfaceActorId(), new TEvStateServerDisconnect);
+ }
TActorBootstrapped::PassAway();
}
@@ -441,6 +447,15 @@ namespace NKikimr::NTestShard {
}
void RegisterTransition(TString key, ::NTestShard::TStateServer::EEntityState from, ::NTestShard::TStateServer::EEntityState to) {
+ const auto it = Keys.find(key);
+ Y_VERIFY(it != Keys.end());
+ it->second.PendingState = to;
+
+ if (!Settings.HasStorageServerHost()) {
+ it->second.ConfirmedState = to;
+ return;
+ }
+
auto request = std::make_unique<TEvStateServerRequest>();
auto& r = request->Record;
auto *write = r.MutableWrite();
@@ -451,9 +466,6 @@ namespace NKikimr::NTestShard {
write->SetTargetState(to);
Send(MakeStateServerInterfaceActorId(), request.release());
- const auto it = Keys.find(key);
- Y_VERIFY(it != Keys.end());
- it->second.PendingState = to;
TransitionInFlight.push_back(&*it);
}
diff --git a/ydb/core/test_tablet/load_actor_state.cpp b/ydb/core/test_tablet/load_actor_state.cpp
index fb2ccea429a..a1922120dcb 100644
--- a/ydb/core/test_tablet/load_actor_state.cpp
+++ b/ydb/core/test_tablet/load_actor_state.cpp
@@ -15,6 +15,25 @@ namespace NKikimr::NTestShard {
Y_VERIFY(from != ::NTestShard::TStateServer::DELETED);
Y_VERIFY(to != ::NTestShard::TStateServer::ABSENT);
+ if (!Settings.HasStorageServerHost()) {
+ if (from == ::NTestShard::TStateServer::WRITE_PENDING && to == ::NTestShard::TStateServer::CONFIRMED) {
+ BytesOfData += key.second.Len;
+ }
+ if (to == ::NTestShard::TStateServer::DELETED) {
+ Keys.erase(key.first);
+ } else {
+ key.second.ConfirmedState = key.second.PendingState = to;
+ }
+ if (ev) {
+ Send(TabletActorId, ev.release());
+ }
+ if (!DoSomeActionInFlight) {
+ TActivationContext::Send(new IEventHandle(EvDoSomeAction, 0, SelfId(), {}, nullptr, 0));
+ DoSomeActionInFlight = true;
+ }
+ return;
+ }
+
// generate transition command and send it to state server
auto request = std::make_unique<TEvStateServerRequest>();
auto& r = request->Record;