Skip to content
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

issue-122: AddConfirmedBlobs should do ProcessCommitQueue, otherwise compaction may get stuck #863

Merged
merged 2 commits into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ void TPartitionActor::HandleAddConfirmedBlobsCompleted(
PartCounters->RequestCounters.AddConfirmedBlobs.AddRequest(time);

EnqueueAddConfirmedBlobsIfNeeded(ctx);
ProcessCommitQueue(ctx);
}

} // namespace NCloud::NBlockStore::NStorage::NPartition
51 changes: 49 additions & 2 deletions cloud/blockstore/libs/storage/partition/part_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,11 @@ class TPartitionClient
return std::make_unique<TEvVolume::TEvGetScanDiskStatusRequest>();
}

std::unique_ptr<TEvPartitionPrivate::TEvAddConfirmedBlobsRequest> CreateAddConfirmedBlobsRequest()
{
return std::make_unique<TEvPartitionPrivate::TEvAddConfirmedBlobsRequest>();
}

#define BLOCKSTORE_DECLARE_METHOD(name, ns) \
template <typename... Args> \
void Send##name##Request(Args&&... args) \
Expand Down Expand Up @@ -9666,6 +9671,48 @@ Y_UNIT_TEST_SUITE(TPartitionTest)
}
}

Y_UNIT_TEST(ShouldCompactAfterAddingConfirmedBlobs)
{
auto config = DefaultConfig();
config.SetAddingUnconfirmedBlobsEnabled(true);
auto runtime = PrepareTestActorRuntime(config);

bool dropAddConfirmedBlobs = false;

runtime->SetObserverFunc([&] (auto& event) {
SvartMetal marked this conversation as resolved.
Show resolved Hide resolved
switch (event->GetTypeRewrite()) {
case TEvPartitionPrivate::EvAddConfirmedBlobsRequest: {
if (dropAddConfirmedBlobs) {
return TTestActorRuntime::EEventAction::DROP;
}
break;
}
}

return TTestActorRuntime::DefaultObserverFunc(event);
});

TPartitionClient partition(*runtime);
partition.WaitReady();

partition.WriteBlocks(TBlockRange32::WithLength(0, 1024), 1);

dropAddConfirmedBlobs = true;
partition.WriteBlocks(TBlockRange32::WithLength(0, 1024), 2);

partition.SendCompactionRequest();

dropAddConfirmedBlobs = false;
partition.AddConfirmedBlobs();
SvartMetal marked this conversation as resolved.
Show resolved Hide resolved

{
auto compactResponse = partition.RecvCompactionResponse();
// should fail on S_ALREADY and S_FALSE to ensure that compaction
// was really taken place here
UNIT_ASSERT_VALUES_EQUAL(S_OK, compactResponse->GetStatus());
}
}

Y_UNIT_TEST(ShouldConfirmBlobs)
{
auto config = DefaultConfig();
Expand Down Expand Up @@ -10774,7 +10821,7 @@ Y_UNIT_TEST_SUITE(TPartitionTest)
response->GetStatus(),
response->GetErrorReason());
}

Y_UNIT_TEST(ShouldProperlyCalculateBlockChecksumsForBatchedWrites)
{
constexpr ui32 blockCount = 1024 * 1024;
Expand Down Expand Up @@ -10895,7 +10942,7 @@ Y_UNIT_TEST_SUITE(TPartitionTest)
response->GetErrorReason());
}
}

Y_UNIT_TEST(ShouldCancelRequestsOnTabletRestart)
{
constexpr ui32 blockCount = 1024 * 1024;
Expand Down