diff options
author | monster <monster@yandex-team.ru> | 2022-06-06 16:47:05 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-06-06 16:47:05 +0300 |
commit | 6100bd13d8cfd14d2007ed3534660c9d9d25309e (patch) | |
tree | 888dfdfd218ffe87e2e3760ed66065207183b2b0 | |
parent | ca627c8709ba01bb9365f3f13b80478d63646a51 (diff) | |
download | ydb-6100bd13d8cfd14d2007ed3534660c9d9d25309e.tar.gz |
do not VERIFY on NODATA while discovering blobs at followers KIKIMR-12560
REVIEW: 2578469
REVIEW: 2584092
x-ydb-stable-ref: a5a4bf50de4a36bc455a545a57f286e348724eb7
-rw-r--r-- | ydb/core/base/blobstorage.h | 7 | ||||
-rw-r--r-- | ydb/core/blobstorage/dsproxy/dsproxy_discover.cpp | 23 | ||||
-rw-r--r-- | ydb/core/blobstorage/dsproxy/dsproxy_discover_m3dc.cpp | 5 | ||||
-rw-r--r-- | ydb/core/blobstorage/dsproxy/dsproxy_discover_m3of4.cpp | 5 | ||||
-rw-r--r-- | ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_discover.h | 4 | ||||
-rw-r--r-- | ydb/core/blobstorage/dsproxy/ut/dsproxy_sequence_ut.cpp | 2 | ||||
-rw-r--r-- | ydb/core/blobstorage/dsproxy/ut_fat/dsproxy_ut.cpp | 42 | ||||
-rw-r--r-- | ydb/core/blobstorage/testload/test_load_write.cpp | 2 | ||||
-rw-r--r-- | ydb/core/blobstorage/ut_blobstorage/lib/activity.h | 2 | ||||
-rw-r--r-- | ydb/core/blobstorage/ut_group/main.cpp | 2 | ||||
-rw-r--r-- | ydb/core/tablet/tablet_impl.h | 2 | ||||
-rw-r--r-- | ydb/core/tablet/tablet_req_findlatest.cpp | 10 | ||||
-rw-r--r-- | ydb/core/tablet/tablet_req_rebuildhistory.cpp | 4 | ||||
-rw-r--r-- | ydb/core/tablet/tablet_req_reset.cpp | 2 | ||||
-rw-r--r-- | ydb/core/tablet/tablet_sys.cpp | 2 |
15 files changed, 67 insertions, 47 deletions
diff --git a/ydb/core/base/blobstorage.h b/ydb/core/base/blobstorage.h index d7cd026c81..f58906acee 100644 --- a/ydb/core/base/blobstorage.h +++ b/ydb/core/base/blobstorage.h @@ -1565,15 +1565,18 @@ struct TEvBlobStorage { const bool ReadBody; const bool DiscoverBlockedGeneration; const ui32 ForceBlockedGeneration; + const bool FromLeader; ui32 RestartCounter = 0; - TEvDiscover(ui64 tabletId, ui32 minGeneration, bool readBody, bool discoverBlockedGeneration, TInstant deadline, ui32 forceBlockedGeneration) + TEvDiscover(ui64 tabletId, ui32 minGeneration, bool readBody, bool discoverBlockedGeneration, + TInstant deadline, ui32 forceBlockedGeneration, bool fromLeader) : TabletId(tabletId) , MinGeneration(minGeneration) , Deadline(deadline) , ReadBody(readBody) , DiscoverBlockedGeneration(discoverBlockedGeneration) , ForceBlockedGeneration(forceBlockedGeneration) + , FromLeader(fromLeader) {} TString Print(bool isFull) const { @@ -1583,6 +1586,8 @@ struct TEvBlobStorage { str << " MinGeneration# " << MinGeneration; str << " ReadBody# " << (ReadBody ? "true" : "false"); str << " DiscoverBlockedGeneration# " << (DiscoverBlockedGeneration ? "true" : "false"); + str << " ForceBlockedGeneration# " << ForceBlockedGeneration; + str << " FromLeader# " << (FromLeader ? "true" : "false"); str << " Deadline# " << Deadline.MilliSeconds(); str << "}"; return str.Str(); diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_discover.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_discover.cpp index 2605a19a2e..1f810a385d 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_discover.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_discover.cpp @@ -292,6 +292,7 @@ class TBlobStorageGroupDiscoverRequest : public TBlobStorageGroupRequestActor<TB ui64 TotalRecieved = 0; const ui32 ForceBlockedGeneration; + const bool FromLeader; template<typename TPtr> void SendResult(TPtr& result) { @@ -802,18 +803,22 @@ class TBlobStorageGroupDiscoverRequest : public TBlobStorageGroupRequestActor<TB << " GetBlockErrors# " << GetBlockErrors << " VGetBlockedGen# " << VGetBlockedGen << " Get.BlockedGeneration# " << msg->BlockedGeneration + << " FromLeader# " << (FromLeader ? "true" : "false") << " response status# NODATA, Reply with ERROR! " << " looks like we have !!! LOST THE BLOB !!! id# " << response.Id.ToString(); R_LOG_ALERT_S("BSD18", str.Str()); - Sleep(TDuration::Seconds(1)); - str << " logacc# "; - LogCtx.LogAcc.Output(str); - str << " verboseNoData# "; - str << msg->DebugInfo; - Y_VERIFY(false, "%s", str.Str().data()); - // TODO: Remove the lines above + if (FromLeader) { + Sleep(TDuration::Seconds(1)); + + str << " logacc# "; + LogCtx.LogAcc.Output(str); + str << " verboseNoData# "; + str << msg->DebugInfo; + + Y_VERIFY(false, "%s", str.Str().data()); + } IsGetDataDone = true; if (IsGetBlockDone) { @@ -868,7 +873,7 @@ class TBlobStorageGroupDiscoverRequest : public TBlobStorageGroupRequestActor<TB std::unique_ptr<IEventBase> RestartQuery(ui32 counter) { ++*Mon->NodeMon->RestartDiscover; auto ev = std::make_unique<TEvBlobStorage::TEvDiscover>(TabletId, MinGeneration, ReadBody, DiscoverBlockedGeneration, - Deadline, ForceBlockedGeneration); + Deadline, ForceBlockedGeneration, FromLeader); ev->RestartCounter = counter; return ev; } @@ -902,6 +907,7 @@ public: , GroupResponseTracker(Info) , IsGetBlockDone(!DiscoverBlockedGeneration) , ForceBlockedGeneration(ev->ForceBlockedGeneration) + , FromLeader(ev->FromLeader) {} void Bootstrap() { @@ -912,6 +918,7 @@ public: << " MinGeneration# " << MinGeneration << " ReadBody# " << (ReadBody ? "true" : "false") << " Deadline# " << Deadline + << " FromLeader# " << (FromLeader ? "true" : "false") << " RestartCounter# " << RestartCounter); const ui32 groupId = Info->GroupID; diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_discover_m3dc.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_discover_m3dc.cpp index a4e48dba76..7c10b1e25a 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_discover_m3dc.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_discover_m3dc.cpp @@ -427,6 +427,7 @@ class TBlobStorageGroupMirror3dcDiscoverRequest : public TBlobStorageGroupReques const bool ReadBody; const bool DiscoverBlockedGeneration; const ui32 ForceBlockedGeneration; + const bool FromLeader; std::unique_ptr<TDiscoverWorker> Worker; TVector<std::unique_ptr<TEvBlobStorage::TEvVGet>> Msgs; @@ -469,13 +470,14 @@ public: , ReadBody(ev->ReadBody) , DiscoverBlockedGeneration(ev->DiscoverBlockedGeneration) , ForceBlockedGeneration(ev->ForceBlockedGeneration) + , FromLeader(ev->FromLeader) , GetBlockTracker(Info.Get()) {} std::unique_ptr<IEventBase> RestartQuery(ui32 counter) { ++*Mon->NodeMon->RestartDiscover; auto ev = std::make_unique<TEvBlobStorage::TEvDiscover>(TabletId, MinGeneration, ReadBody, DiscoverBlockedGeneration, - Deadline, ForceBlockedGeneration); + Deadline, ForceBlockedGeneration, FromLeader); ev->RestartCounter = counter; return ev; } @@ -490,6 +492,7 @@ public: << " ReadBody# " << (ReadBody ? "true" : "false") << " DiscoverBlockedGeneration# " << (DiscoverBlockedGeneration ? "true" : "false") << " ForceBlockedGeneration# " << ForceBlockedGeneration + << " FromLeader# " << (FromLeader ? "true" : "false") << " RestartCounter# " << RestartCounter); Worker = std::make_unique<TDiscoverWorker>(Info, TabletId, MinGeneration, ForceBlockedGeneration); diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_discover_m3of4.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_discover_m3of4.cpp index 9e3393070a..22412d0081 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_discover_m3of4.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_discover_m3of4.cpp @@ -18,6 +18,7 @@ class TBlobStorageGroupMirror3of4DiscoverRequest const bool ReadBody; const bool DiscoverBlockedGeneration; const ui32 ForceBlockedGeneration; + const bool FromLeader; public: static const auto& ActiveCounter(const TIntrusivePtr<TBlobStorageGroupProxyMon>& mon) { @@ -43,6 +44,7 @@ public: , ReadBody(ev->ReadBody) , DiscoverBlockedGeneration(ev->DiscoverBlockedGeneration) , ForceBlockedGeneration(ev->ForceBlockedGeneration) + , FromLeader(ev->FromLeader) { for (size_t i = 0; i < DiskState.size(); ++i) { TDiskState& disk = DiskState[i]; @@ -54,7 +56,7 @@ public: std::unique_ptr<IEventBase> RestartQuery(ui32 counter) { ++*Mon->NodeMon->RestartDiscover; auto ev = std::make_unique<TEvBlobStorage::TEvDiscover>(TabletId, MinGeneration, ReadBody, - DiscoverBlockedGeneration, Deadline, ForceBlockedGeneration); + DiscoverBlockedGeneration, Deadline, ForceBlockedGeneration, FromLeader); ev->RestartCounter = counter; return ev; } @@ -67,6 +69,7 @@ public: << " ReadBody# " << (ReadBody ? "true" : "false") << " DiscoverBlockedGeneration# " << (DiscoverBlockedGeneration ? "true" : "false") << " ForceBlockedGeneration# " << ForceBlockedGeneration + << " FromLeader# " << (FromLeader ? "true" : "false") << " RestartCounter# " << RestartCounter); Become(&TThis::StateFunc); diff --git a/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_discover.h b/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_discover.h index 2e8df42324..7d93d73c65 100644 --- a/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_discover.h +++ b/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_discover.h @@ -69,7 +69,7 @@ public: SetFailedDisks(failedDisks); SendToBSProxy(GetActorContext(), Info->GroupID, new TEvBlobStorage::TEvDiscover(tabletId, 0, false, false, - TInstant::Max(), 0)); + TInstant::Max(), 0, true)); auto resp = WaitForSpecificEvent<TEvBlobStorage::TEvDiscoverResult>(); const NKikimrProto::EReplyStatus status = resp->Get()->Status; @@ -109,7 +109,7 @@ public: TLogoBlobID::MaxChannel, TLogoBlobID::MaxBlobSize, TLogoBlobID::MaxCookie), disks, false); - SendToBSProxy(GetActorContext(), Info->GroupID, new TEvBlobStorage::TEvDiscover(tabletId, 0, true, true, TInstant::Max(), 0)); + SendToBSProxy(GetActorContext(), Info->GroupID, new TEvBlobStorage::TEvDiscover(tabletId, 0, true, true, TInstant::Max(), 0, true)); auto response = WaitForSpecificEvent<TEvBlobStorage::TEvDiscoverResult>(); UNIT_ASSERT_VALUES_EQUAL(response->Get()->Status, NKikimrProto::OK); diff --git a/ydb/core/blobstorage/dsproxy/ut/dsproxy_sequence_ut.cpp b/ydb/core/blobstorage/dsproxy/ut/dsproxy_sequence_ut.cpp index fdd7a92ea3..dcb316ec9c 100644 --- a/ydb/core/blobstorage/dsproxy/ut/dsproxy_sequence_ut.cpp +++ b/ydb/core/blobstorage/dsproxy/ut/dsproxy_sequence_ut.cpp @@ -1277,7 +1277,7 @@ Y_UNIT_TEST(TestGivenBlock42Put6PartsOnOneVDiskWhenDiscoverThenRecoverFirst) { const ui32 minGeneration = 0; // Send Discover runtime.Send(new IEventHandle( - proxy, sender, new TEvBlobStorage::TEvDiscover(tabletId, minGeneration, true, false, TInstant::Max(), 0))); + proxy, sender, new TEvBlobStorage::TEvDiscover(tabletId, minGeneration, true, false, TInstant::Max(), 0, true))); // Receive VGet TMap<TActorId, TGetRequest> lastRequest; diff --git a/ydb/core/blobstorage/dsproxy/ut_fat/dsproxy_ut.cpp b/ydb/core/blobstorage/dsproxy/ut_fat/dsproxy_ut.cpp index b77d654677..7679f57102 100644 --- a/ydb/core/blobstorage/dsproxy/ut_fat/dsproxy_ut.cpp +++ b/ydb/core/blobstorage/dsproxy/ut_fat/dsproxy_ut.cpp @@ -964,7 +964,7 @@ class TTestBlobStorageProxyBlock : public TTestBlobStorageProxy { TEST_RESPONSE(MessagePutResult, BLOCKED, 0, ""); VERBOSE_COUT("Sending TEvDiscover, read body = true, expecting OK + data"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, true, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, true, TInstant::Max(), 0, true)); break; case 80: { @@ -2334,13 +2334,13 @@ class TTestBlobStorageProxySimpleDiscover : public TTestBlobStorageProxy { TEST_RESPONSE(MessagePutResult, OK, 0, ""); VERBOSE_COUT("Sending TEvDiscover, read body = true, expecting OK + data"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, false, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, false, TInstant::Max(), 0, true)); break; case 30: TEST_RESPONSE(MessageDiscoverResult, OK, 1, testData2); VERBOSE_COUT("Sending TEvDiscover, read body = true, expecting OK + data"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, true, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, true, TInstant::Max(), 0, true)); break; case 40: TEST_RESPONSE(MessageDiscoverResult, OK, 1, testData2); @@ -2372,7 +2372,7 @@ class TTestBlobStorageProxyDiscover : public TTestBlobStorageProxy { "Unexpected " << (int)LastResponse.Message); VERBOSE_COUT("Sending TEvDiscover, read body = true, expecting OK + data"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, false, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, false, TInstant::Max(), 0, true)); break; case 10: UNIT_ASSERT_EQUAL_C(LastResponse.Message, TResponseData::MessageDiscoverResult, @@ -2380,7 +2380,7 @@ class TTestBlobStorageProxyDiscover : public TTestBlobStorageProxy { if (LastResponse.Status != NKikimrProto::OK) { VERBOSE_COUT("ReSending TEvDiscover (due to " << (int)LastResponse.Status << ")"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, false, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, false, TInstant::Max(), 0, true)); TestStep -= 10; break; } @@ -2388,14 +2388,14 @@ class TTestBlobStorageProxyDiscover : public TTestBlobStorageProxy { TEST_RESPONSE(MessageDiscoverResult, OK, 1, testData2); VERBOSE_COUT("Sending TEvDiscover, read body = true, expecting OK + data"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, true, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, true, TInstant::Max(), 0, true)); break; case 20: UNIT_ASSERT_EQUAL_C(LastResponse.Message, TResponseData::MessageDiscoverResult, "Unexpected message type# " << (int)LastResponse.Message); if (LastResponse.Status != NKikimrProto::OK) { VERBOSE_COUT("ReSending TEvDiscover (due to " << (int)LastResponse.Status << ")"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, true, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, true, TInstant::Max(), 0, true)); TestStep -= 10; break; } @@ -2426,13 +2426,13 @@ class TTestBlobStorageProxyDiscoverFail : public TTestBlobStorageProxy { "Unexpected " << (int)LastResponse.Message); VERBOSE_COUT("Sending TEvDiscover, read body = true, expecting OK + data"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, false, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, false, TInstant::Max(), 0, true)); break; case 10: TEST_RESPONSE(MessageDiscoverResult, ERROR, 0, ""); VERBOSE_COUT("Sending TEvDiscover, read body = true, expecting OK + data"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, true, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, true, TInstant::Max(), 0, true)); break; case 20: TEST_RESPONSE(MessageDiscoverResult, ERROR, 0, ""); @@ -2462,13 +2462,13 @@ class TTestBlobStorageProxyDiscoverEmpty : public TTestBlobStorageProxy { "Unexpected " << (int)LastResponse.Message); VERBOSE_COUT("Sending TEvDiscover, read body = true, expecting OK + data"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, false, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, false, TInstant::Max(), 0, true)); break; case 10: TEST_RESPONSE(MessageDiscoverResult, NODATA, 0, ""); VERBOSE_COUT("Sending TEvDiscover, read body = true, expecting OK + data"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, true, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, true, TInstant::Max(), 0, true)); break; case 20: TEST_RESPONSE(MessageDiscoverResult, NODATA, 0, ""); @@ -2498,13 +2498,13 @@ class TTestBlobStorageProxyDiscoverTimeout : public TTestBlobStorageProxy { "Unexpected " << (int)LastResponse.Message); VERBOSE_COUT("Sending TEvDiscover, read body = true, expecting OK + data"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, false, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, false, TInstant::Max(), 0, true)); break; case 10: TEST_RESPONSE(MessageDiscoverResult, TIMEOUT, 0, ""); VERBOSE_COUT("Sending TEvDiscover, read body = true, expecting OK + data"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, true, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, true, TInstant::Max(), 0, true)); break; case 20: TEST_RESPONSE(MessageDiscoverResult, TIMEOUT, 0, ""); @@ -2693,14 +2693,14 @@ class TTestBlobStorageProxyLongTailDiscover : public TTestBlobStorageProxy { "Unexpected " << (int)LastResponse.Message); VERBOSE_COUT("Sending TEvDiscover, read body = true, expecting OK + data"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, false, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, false, TInstant::Max(), 0, true)); break; case 10: TEST_RESPONSE(MessageDiscoverResult, OK, 1, testData2); VERBOSE_COUT("Sending TEvDiscover, read body = true, expecting OK + data"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, true, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, true, TInstant::Max(), 0, true)); break; case 20: TEST_RESPONSE(MessageDiscoverResult, OK, 1, testData2); @@ -3056,7 +3056,7 @@ class TTestBlobStorageProxyBasic1 : public TTestBlobStorageProxy { TEST_RESPONSE(MessagePutResult, OK, 0, ""); } VERBOSE_COUT("Sending TEvDiscover, read body = true, expecting OK + data"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, false, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, false, TInstant::Max(), 0, true)); break; case 230: if (Env->ShouldBeUndiscoverable) { @@ -3065,7 +3065,7 @@ class TTestBlobStorageProxyBasic1 : public TTestBlobStorageProxy { TEST_RESPONSE(MessageDiscoverResult, OK, 1, testData2); } VERBOSE_COUT("Sending TEvDiscover, read body = false, expecting OK"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, false, false, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, false, false, TInstant::Max(), 0, true)); break; case 240: if (Env->ShouldBeUndiscoverable) { @@ -3074,7 +3074,7 @@ class TTestBlobStorageProxyBasic1 : public TTestBlobStorageProxy { TEST_RESPONSE(MessageDiscoverResult, OK, 1, ""); } VERBOSE_COUT("Sending TEvDiscover, read body = true, expecting NODATA"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(2/*tabletId*/, 0, true, false, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(2/*tabletId*/, 0, true, false, TInstant::Max(), 0, true)); break; case 250: if (Env->ShouldBeUndiscoverable) { @@ -3083,7 +3083,7 @@ class TTestBlobStorageProxyBasic1 : public TTestBlobStorageProxy { TEST_RESPONSE(MessageDiscoverResult, NODATA, 0, ""); } VERBOSE_COUT("Sending TEvDiscover, read body = true, expecting OK + data"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, true, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, true, true, TInstant::Max(), 0, true)); break; case 260: if (Env->ShouldBeUndiscoverable) { @@ -3092,7 +3092,7 @@ class TTestBlobStorageProxyBasic1 : public TTestBlobStorageProxy { TEST_RESPONSE(MessageDiscoverResult, OK, 1, testData2); } VERBOSE_COUT("Sending TEvDiscover, read body = false, expecting OK"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, false, true, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(1, 0, false, true, TInstant::Max(), 0, true)); break; case 270: if (Env->ShouldBeUndiscoverable) { @@ -3101,7 +3101,7 @@ class TTestBlobStorageProxyBasic1 : public TTestBlobStorageProxy { TEST_RESPONSE(MessageDiscoverResult, OK, 1, ""); } VERBOSE_COUT("Sending TEvDiscover, read body = true, expecting NODATA"); - ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(2/*tabletId*/, 0, true, true, TInstant::Max(), 0)); + ctx.Send(Proxy, new TEvBlobStorage::TEvDiscover(2/*tabletId*/, 0, true, true, TInstant::Max(), 0, true)); break; case 280: { diff --git a/ydb/core/blobstorage/testload/test_load_write.cpp b/ydb/core/blobstorage/testload/test_load_write.cpp index 3169c1609e..d30f9d4a31 100644 --- a/ydb/core/blobstorage/testload/test_load_write.cpp +++ b/ydb/core/blobstorage/testload/test_load_write.cpp @@ -249,7 +249,7 @@ class TLogWriterTestLoadActor : public TActorBootstrapped<TLogWriterTestLoadActo // Issue TEvDiscover void Bootstrap(const TActorContext& ctx) { NextWriteTimestamp = TAppData::TimeProvider->Now(); - auto ev = std::make_unique<TEvBlobStorage::TEvDiscover>(TabletId, Generation, false, true, TInstant::Max(), 0); + auto ev = std::make_unique<TEvBlobStorage::TEvDiscover>(TabletId, Generation, false, true, TInstant::Max(), 0, true); LOG_DEBUG_S(ctx, NKikimrServices::BS_LOAD_TEST, PrintMe() << " is bootstrapped, going to send " << ev->ToString()); auto callback = [this] (IEventBase *event, const TActorContext& ctx) { diff --git a/ydb/core/blobstorage/ut_blobstorage/lib/activity.h b/ydb/core/blobstorage/ut_blobstorage/lib/activity.h index 478a87b707..8c6f3bfd48 100644 --- a/ydb/core/blobstorage/ut_blobstorage/lib/activity.h +++ b/ydb/core/blobstorage/ut_blobstorage/lib/activity.h @@ -75,7 +75,7 @@ public: } void IssueDiscover() { - SendToProxy(TDuration::MilliSeconds(100), new TEvBlobStorage::TEvDiscover(TabletId, 0, false, false, TInstant::Max(), 0)); + SendToProxy(TDuration::MilliSeconds(100), new TEvBlobStorage::TEvDiscover(TabletId, 0, false, false, TInstant::Max(), 0, true)); } void Handle(TEvBlobStorage::TEvDiscoverResult::TPtr ev) { diff --git a/ydb/core/blobstorage/ut_group/main.cpp b/ydb/core/blobstorage/ut_group/main.cpp index 538f46ae03..12b8ab5114 100644 --- a/ydb/core/blobstorage/ut_group/main.cpp +++ b/ydb/core/blobstorage/ut_group/main.cpp @@ -490,7 +490,7 @@ public: } // discover previously written data - if (auto ev = Query<TEvBlobStorage::TEvDiscover>(TabletId, 0, true, false, TInstant::Max(), 0)) { + if (auto ev = Query<TEvBlobStorage::TEvDiscover>(TabletId, 0, true, false, TInstant::Max(), 0, true)) { Y_VERIFY(ev->Get()->Status == (Committed.empty() ? NKikimrProto::NODATA : NKikimrProto::OK)); if (ev->Get()->Status == NKikimrProto::OK) { Y_VERIFY(ev->Get()->Buffer == Committed.rbegin()->second); diff --git a/ydb/core/tablet/tablet_impl.h b/ydb/core/tablet/tablet_impl.h index b47b1f1097..4a4a2bb784 100644 --- a/ydb/core/tablet/tablet_impl.h +++ b/ydb/core/tablet/tablet_impl.h @@ -14,7 +14,7 @@ namespace NKikimr { IActor* CreateTabletReqRebuildHistoryGraph(const TActorId &owner, TTabletStorageInfo *info, ui32 blockedGen, NTracing::ITrace *trace, ui64 followerCookie); -IActor* CreateTabletFindLastEntry(const TActorId &owner, bool readBody, TTabletStorageInfo *info, ui32 blockedGen); +IActor* CreateTabletFindLastEntry(const TActorId &owner, bool readBody, TTabletStorageInfo *info, ui32 blockedGen, bool leader); IActor* CreateTabletReqWriteLog(const TActorId &owner, const TLogoBlobID &entryId, NKikimrTabletBase::TTabletLogEntry *entry, TVector<TEvTablet::TLogEntryReference> &refs, TEvBlobStorage::TEvPut::ETactic commitTactic, TTabletStorageInfo *info); IActor* CreateTabletReqBlockBlobStorage(const TActorId &owner, TTabletStorageInfo *info, ui32 generation, bool blockPrevEntry); IActor* CreateTabletReqDelete(const TActorId &owner, const TIntrusivePtr<TTabletStorageInfo> &tabletStorageInfo, ui32 generation = std::numeric_limits<ui32>::max()); diff --git a/ydb/core/tablet/tablet_req_findlatest.cpp b/ydb/core/tablet/tablet_req_findlatest.cpp index ca3d09aa43..59f6b5af36 100644 --- a/ydb/core/tablet/tablet_req_findlatest.cpp +++ b/ydb/core/tablet/tablet_req_findlatest.cpp @@ -17,6 +17,7 @@ class TTabletReqFindLatestLogEntry : public TActorBootstrapped<TTabletReqFindLat const TActorId Owner; const bool ReadBody; const ui32 BlockedGeneration; + const bool Leader; TIntrusivePtr<TTabletStorageInfo> Info; const TTabletChannelInfo *ChannelInfo; ui64 CurrentHistoryIndex; @@ -33,7 +34,7 @@ class TTabletReqFindLatestLogEntry : public TActorBootstrapped<TTabletReqFindLat const ui32 group = ChannelInfo->History[CurrentHistoryIndex].GroupID; const ui32 minGeneration = ChannelInfo->History[CurrentHistoryIndex].FromGeneration; - auto request = MakeHolder<TEvBlobStorage::TEvDiscover>(Info->TabletID, minGeneration, ReadBody, true, TInstant::Max(), BlockedGeneration); + auto request = MakeHolder<TEvBlobStorage::TEvDiscover>(Info->TabletID, minGeneration, ReadBody, true, TInstant::Max(), BlockedGeneration, Leader); SendToBSProxy(SelfId(), group, request.Release()); } @@ -72,10 +73,11 @@ public: return NKikimrServices::TActivity::TABLET_REQ_FIND_LATEST; } - TTabletReqFindLatestLogEntry(const TActorId &owner, bool readBody, TTabletStorageInfo *info, ui32 blockedGeneration) + TTabletReqFindLatestLogEntry(const TActorId &owner, bool readBody, TTabletStorageInfo *info, ui32 blockedGeneration, bool leader) : Owner(owner) , ReadBody(readBody) , BlockedGeneration(blockedGeneration) + , Leader(leader) , Info(info) , ChannelInfo(Info->ChannelInfo(0)) , CurrentHistoryIndex(ChannelInfo->History.size()) @@ -96,8 +98,8 @@ public: } }; -IActor* CreateTabletFindLastEntry(const TActorId &owner, bool readBody, TTabletStorageInfo *info, ui32 blockedGeneration) { - return new TTabletReqFindLatestLogEntry(owner, readBody, info, blockedGeneration); +IActor* CreateTabletFindLastEntry(const TActorId &owner, bool readBody, TTabletStorageInfo *info, ui32 blockedGeneration, bool leader) { + return new TTabletReqFindLatestLogEntry(owner, readBody, info, blockedGeneration, leader); } } diff --git a/ydb/core/tablet/tablet_req_rebuildhistory.cpp b/ydb/core/tablet/tablet_req_rebuildhistory.cpp index 620b25c1a8..c12f6c93ad 100644 --- a/ydb/core/tablet/tablet_req_rebuildhistory.cpp +++ b/ydb/core/tablet/tablet_req_rebuildhistory.cpp @@ -890,9 +890,9 @@ public: } if (FollowerCookie == 0) - Register(CreateTabletFindLastEntry(SelfId(), true, Info.Get(), BlockedGen)); + Register(CreateTabletFindLastEntry(SelfId(), true, Info.Get(), BlockedGen, true)); else - Register(CreateTabletFindLastEntry(SelfId(), true, Info.Get(), 0)); + Register(CreateTabletFindLastEntry(SelfId(), true, Info.Get(), 0, false)); Become(&TThis::StateWaitLatestEntry); } diff --git a/ydb/core/tablet/tablet_req_reset.cpp b/ydb/core/tablet/tablet_req_reset.cpp index b73c68c120..a8cfdd5c1a 100644 --- a/ydb/core/tablet/tablet_req_reset.cpp +++ b/ydb/core/tablet/tablet_req_reset.cpp @@ -23,7 +23,7 @@ class TTabletReqReset : public TActorBootstrapped<TTabletReqReset> { } void FindLatestLogEntry(const TActorContext& ctx) { - ctx.Register(CreateTabletFindLastEntry(ctx.SelfID, false, TabletStorageInfo.Get(), 0)); + ctx.Register(CreateTabletFindLastEntry(ctx.SelfID, false, TabletStorageInfo.Get(), 0, true)); Become(&TTabletReqReset::StateDiscover); } diff --git a/ydb/core/tablet/tablet_sys.cpp b/ydb/core/tablet/tablet_sys.cpp index 4537a4af91..613aac9ff9 100644 --- a/ydb/core/tablet/tablet_sys.cpp +++ b/ydb/core/tablet/tablet_sys.cpp @@ -839,7 +839,7 @@ void TTablet::HandleStateStorageInfoLock(TEvStateStorage::TEvInfo::TPtr &ev) { , StateStorageInfo.SignatureSz)); } - Register(CreateTabletFindLastEntry(SelfId(), false, Info.Get(), 0)); + Register(CreateTabletFindLastEntry(SelfId(), false, Info.Get(), 0, Leader)); Become(&TThis::StateDiscover); ReportTabletStateChange(TTabletStateInfo::Discover); } |