-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add use-intermediate-write-buffer tag if scrubbing found a mismatch #2836
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
#include <cloud/blockstore/libs/storage/core/probes.h> | ||
#include <cloud/blockstore/libs/storage/core/proto_helpers.h> | ||
#include <cloud/blockstore/libs/storage/core/unimplemented.h> | ||
#include <cloud/blockstore/libs/storage/volume/volume_state.h> | ||
|
||
#include <contrib/ydb/core/base/appdata.h> | ||
|
||
|
@@ -204,6 +205,11 @@ void TMirrorPartitionActor::CompareChecksums(const TActorContext& ctx) | |
DiskId.c_str(), | ||
DescribeRange(GetScrubbingRange()).c_str()); | ||
|
||
if (Config->GetAutomaticallyEnableBufferCopyingAfterChecksumMismatch()) | ||
{ | ||
AddTagForBufferCopying(ctx); | ||
} | ||
|
||
for (size_t i = 0; i < checksums.size(); i++) { | ||
LOG_ERROR( | ||
ctx, | ||
|
@@ -271,6 +277,25 @@ void TMirrorPartitionActor::StartResyncRange( | |
BlockDigestGenerator); | ||
} | ||
|
||
void TMirrorPartitionActor::AddTagForBufferCopying( | ||
const NActors::TActorContext& ctx) | ||
{ | ||
auto requestInfo = CreateRequestInfo( | ||
SelfId(), | ||
0, // cookie | ||
MakeIntrusive<TCallContext>() | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. на предыдущую строку |
||
|
||
TVector<TString> tags(1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. это вектор длины 1 |
||
tags.emplace_back(IntermediateWriteBufferTagName); | ||
auto request = std::make_unique<TEvService::TEvAddTagsRequest>( | ||
DiskId, | ||
std::move(tags) | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. на предыдущую строку |
||
|
||
ctx.Send(MakeStorageServiceId(), std::move(request)); | ||
} | ||
|
||
void TMirrorPartitionActor::ReplyAndDie(const TActorContext& ctx) | ||
{ | ||
NCloud::Reply(ctx, *Poisoner, std::make_unique<TEvents::TEvPoisonTaken>()); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -257,6 +257,15 @@ struct TTestEnv | |
) | ||
); | ||
|
||
Runtime.AddLocalService( | ||
MakeStorageServiceId(), | ||
TActorSetupCmd( | ||
new TStorageServiceMock(), | ||
TMailboxType::Simple, | ||
0 | ||
) | ||
); | ||
|
||
NKikimr::SetupTabletServices(Runtime); | ||
} | ||
|
||
|
@@ -1176,7 +1185,20 @@ Y_UNIT_TEST_SUITE(TMirrorPartitionTest) | |
TDynamicCountersPtr critEventsCounters = new TDynamicCounters(); | ||
InitCriticalEventsCounter(critEventsCounters); | ||
|
||
TTestEnv env(runtime); | ||
NProto::TStorageServiceConfig config; | ||
config.SetAutomaticallyEnableBufferCopyingAfterChecksumMismatch(true); | ||
TTestEnv env(runtime, config); | ||
|
||
bool tagEnabled = false; | ||
runtime.SetEventFilter([&] (auto& runtime, auto& event) { | ||
Y_UNUSED(runtime); | ||
if (event->GetTypeRewrite() == TEvService::EvAddTagsRequest) | ||
{ | ||
tagEnabled = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. проверь, что отправляется правильный тег |
||
} | ||
|
||
return false; | ||
}); | ||
|
||
const auto range1 = TBlockRange64::WithLength(0, 2); | ||
env.WriteMirror(range1, 'A'); | ||
|
@@ -1197,6 +1219,7 @@ Y_UNIT_TEST_SUITE(TMirrorPartitionTest) | |
|
||
UNIT_ASSERT_VALUES_EQUAL(2, mirroredDiskMinorityChecksumMismatch->Val()); | ||
UNIT_ASSERT_VALUES_EQUAL(2, counters.Simple.ChecksumMismatches.Value); | ||
UNIT_ASSERT(tagEnabled); | ||
|
||
const auto range3 = TBlockRange64::WithLength(1025, 50); | ||
env.WriteMirror(range3, 'A'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -352,6 +352,35 @@ STFUNC(TModifyTagsActionActor::StateWaitReady) | |
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
void TServiceActor::HandleAddTagsRequest( | ||
const TEvService::TEvAddTagsRequest::TPtr& ev, | ||
const NActors::TActorContext& ctx) | ||
{ | ||
auto* msg = ev->Get(); | ||
|
||
auto requestInfo = CreateRequestInfo( | ||
SelfId(), | ||
0, // cookie | ||
MakeIntrusive<TCallContext>() | ||
); | ||
|
||
NPrivateProto::TModifyTagsRequest modifyTagsRequest; | ||
modifyTagsRequest.SetDiskId(msg->DiskId); | ||
for (const auto& tag : msg->Tags) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. пробел перед : не нужен |
||
modifyTagsRequest.AddTagsToAdd(tag); | ||
} | ||
TString input; | ||
google::protobuf::util::MessageToJsonString(modifyTagsRequest, &input); | ||
|
||
NCloud::Register( | ||
ctx, | ||
std::make_unique<TModifyTagsActionActor>( | ||
std::move(requestInfo), | ||
std::move(input))); | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
TResultOrError<IActorPtr> TServiceActor::CreateModifyTagsActionActor( | ||
TRequestInfoPtr requestInfo, | ||
TString input) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не надо создавать кольцевую зависимость
volume зависит от partition_nonrepl
в обратную сторону зависимость делать не надо