aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryuryalekseev <yuryalekseev@yandex-team.com>2022-09-22 17:10:26 +0300
committeryuryalekseev <yuryalekseev@yandex-team.com>2022-09-22 17:10:26 +0300
commit9da11aae5d1b0db8f79c059f3c6a5aae7ccb93e9 (patch)
tree6e754924be6b939fbe2d28081f05d4963aa9cfc4
parent8a4a0890ea6eca169ff467911a3f94e6c6e3b021 (diff)
downloadydb-9da11aae5d1b0db8f79c059f3c6a5aae7ccb93e9.tar.gz
Add test for BLOCKED TEvGet with blob depot.
-rw-r--r--ydb/core/blobstorage/ut_blobstorage/blob_depot.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/ydb/core/blobstorage/ut_blobstorage/blob_depot.cpp b/ydb/core/blobstorage/ut_blobstorage/blob_depot.cpp
index ca18c75fa5..d194da5fc8 100644
--- a/ydb/core/blobstorage/ut_blobstorage/blob_depot.cpp
+++ b/ydb/core/blobstorage/ut_blobstorage/blob_depot.cpp
@@ -19,6 +19,59 @@ Y_UNIT_TEST_SUITE(BlobDepot) {
TestBasicPutAndGet(tenv, 11, tenv.BlobDepot);
}
+ Y_UNIT_TEST(GetBlockedTabletGeneration) {
+ ui32 seed;
+ Seed().LoadOrFail(&seed, sizeof(seed));
+ TBlobDepotTestEnvironment tenv(seed);
+
+ constexpr ui32 tabletId = 10;
+ constexpr ui32 cookie = 1;
+ constexpr ui32 tabletGeneration = 3;
+
+ TBlobInfo blob(tenv.DataGen(100), tabletId, cookie, tabletGeneration);
+
+ auto& env = *tenv.Env;
+ constexpr ui32 nodeId = 1;
+ auto groupId = tenv.BlobDepot;
+
+ TBSState state;
+ state[tabletId];
+
+ // write blob to blob depot
+ VerifiedPut(env, nodeId, groupId, blob, state);
+
+ // block all tablet generations <= tabletGeneration
+ VerifiedBlock(env, nodeId, groupId, tabletId, tabletGeneration, state);
+
+ // do TEvGet with Reader* params
+ auto mustRestoreFirst = false;
+ auto isIndexOnly = false;
+ ui32 forceBlockedGeneration = 0;
+
+ auto ev = std::make_unique<TEvBlobStorage::TEvGet>(
+ blob.Id,
+ 0,
+ blob.Id.BlobSize(),
+ TInstant::Max(),
+ NKikimrBlobStorage::EGetHandleClass::FastRead,
+ mustRestoreFirst,
+ isIndexOnly,
+ forceBlockedGeneration);
+ ev->ReaderTabletId = tabletId;
+ ev->ReaderTabletGeneration = tabletGeneration;
+
+ auto sender = tenv.Env->Runtime->AllocateEdgeActor(nodeId);
+ env.Runtime->WrapInActorContext(sender, [&] {
+ SendToBSProxy(sender, groupId, ev.release(), cookie);
+ });
+
+ auto res = CaptureTEvGetResult(env, sender, true, true);
+
+ // check that TEvGet returns BLOCKED
+ UNIT_ASSERT_VALUES_EQUAL(res->Get()->Status, NKikimrProto::OK);
+ UNIT_ASSERT_VALUES_EQUAL(res->Get()->Responses[0].Status, NKikimrProto::BLOCKED);
+ }
+
Y_UNIT_TEST(BasicRange) {
ui32 seed;
Seed().LoadOrFail(&seed, sizeof(seed));