-
Notifications
You must be signed in to change notification settings - Fork 38
[Blobstore] delete obsolete uncofirmed blobs #4710
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
b7e94a6
4144cd2
5189341
a115144
bfa7dbf
323150f
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 |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| #include "part_actor.h" | ||
|
|
||
| #include <cloud/blockstore/libs/kikimr/helpers.h> | ||
| #include <cloud/blockstore/libs/service/request_helpers.h> | ||
| #include <cloud/blockstore/libs/storage/core/public.h> | ||
|
|
||
| #include <cloud/storage/core/libs/tablet/blob_id.h> | ||
|
|
||
| #include <contrib/ydb/library/actors/core/actor_bootstrapped.h> | ||
| #include <contrib/ydb/library/actors/core/hfunc.h> | ||
|
|
||
| namespace NCloud::NBlockStore::NStorage::NPartition { | ||
|
|
||
| using namespace NActors; | ||
| using namespace NKikimr; | ||
| using namespace NKikimr::NTabletFlatExecutor; | ||
|
|
||
| //////////////////////////////////////////////////////////////////////////////// | ||
|
|
||
| void TPartitionActor::HandleDeleteObsoleteUnconfirmedBlobs( | ||
| const TEvPartitionPrivate::TEvDeleteObsoleteUnconfirmedBlobsRequest::TPtr& | ||
| ev, | ||
| const TActorContext& ctx) | ||
| { | ||
| auto* msg = ev->Get(); | ||
|
|
||
| auto requestInfo = | ||
| CreateRequestInfo(ev->Sender, ev->Cookie, msg->CallContext); | ||
|
|
||
| TRequestScope timer(*requestInfo); | ||
|
|
||
| LWTRACK( | ||
| RequestReceived_Partition, | ||
| requestInfo->CallContext->LWOrbit, | ||
| "DeleteObsoleteUnconfirmedBlobs", | ||
| requestInfo->CallContext->RequestId); | ||
|
|
||
| AddTransaction<TEvPartitionPrivate::TDeleteObsoleteUnconfirmedBlobsMethod>( | ||
| *requestInfo); | ||
|
|
||
| ExecuteTx( | ||
| ctx, | ||
| CreateTx<TDeleteObsoleteUnconfirmedBlobs>( | ||
neihar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| requestInfo, | ||
| msg->CommitId, | ||
| std::move(msg->Blobs))); | ||
| } | ||
|
|
||
| bool TPartitionActor::PrepareDeleteObsoleteUnconfirmedBlobs( | ||
| const TActorContext& ctx, | ||
| TTransactionContext& tx, | ||
| TTxPartition::TDeleteObsoleteUnconfirmedBlobs& args) | ||
| { | ||
| Y_UNUSED(ctx); | ||
| Y_UNUSED(tx); | ||
| Y_UNUSED(args); | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| void TPartitionActor::ExecuteDeleteObsoleteUnconfirmedBlobs( | ||
| const TActorContext& ctx, | ||
| TTransactionContext& tx, | ||
| TTxPartition::TDeleteObsoleteUnconfirmedBlobs& args) | ||
| { | ||
| Y_UNUSED(ctx); | ||
|
|
||
| TPartitionDatabase db(tx.DB); | ||
|
|
||
| State->DeleteUnconfirmedBlobs(db, args.CommitId, args.Blobs); | ||
|
|
||
| State->GetGarbageQueue().ReleaseBarrier(args.CommitId); | ||
| State->GetCommitQueue().ReleaseBarrier(args.CommitId); | ||
| } | ||
|
|
||
| void TPartitionActor::CompleteDeleteObsoleteUnconfirmedBlobs( | ||
| const TActorContext& ctx, | ||
| TTxPartition::TDeleteObsoleteUnconfirmedBlobs& args) | ||
| { | ||
| TRequestScope timer(*args.RequestInfo); | ||
|
|
||
| auto response = std::make_unique< | ||
| TEvPartitionPrivate::TEvDeleteObsoleteUnconfirmedBlobsResponse>(); | ||
| response->ExecCycles = args.RequestInfo->GetExecCycles(); | ||
|
|
||
| LWTRACK( | ||
| ResponseSent_Partition, | ||
| args.RequestInfo->CallContext->LWOrbit, | ||
| "DeleteObsoleteUnconfirmedBlobs", | ||
| args.RequestInfo->CallContext->RequestId); | ||
|
|
||
| NCloud::Reply(ctx, *args.RequestInfo, std::move(response)); | ||
| RemoveTransaction(*args.RequestInfo); | ||
|
|
||
| auto time = | ||
| CyclesToDurationSafe(args.RequestInfo->GetTotalCycles()).MicroSeconds(); | ||
| PartCounters->RequestCounters.DeleteObsoleteUnconfirmedBlobs.AddRequest( | ||
| time); | ||
|
|
||
| ProcessCommitQueue(ctx); | ||
| } | ||
|
|
||
| } // namespace NCloud::NBlockStore::NStorage::NPartition | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| #include "part_actor.h" | ||
|
|
||
| #include <cloud/blockstore/libs/service/request_helpers.h> | ||
| #include <cloud/blockstore/libs/common/iovector.h> | ||
| #include <cloud/blockstore/libs/diagnostics/block_digest.h> | ||
| #include <cloud/blockstore/libs/diagnostics/critical_events.h> | ||
|
|
@@ -347,13 +348,23 @@ void TPartitionActor::HandleWriteBlocksCompleted( | |
| ProfileLog->Write(std::move(record)); | ||
| } | ||
|
|
||
| if (msg->AddingUnconfirmedBlobsRequested && !HasError(msg->GetError())) { | ||
| // blobs are confirmed, but AddBlobs request will be executed | ||
| // (for this commit) later | ||
| State->BlobsConfirmed(commitId, std::move(msg->BlobsToConfirm)); | ||
| if (msg->AddingUnconfirmedBlobsRequested) { | ||
neihar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (HasError(msg->GetError())) { | ||
| // blobs are obsolete, delete them directly | ||
| auto request = std::make_unique< | ||
| TEvPartitionPrivate::TEvDeleteObsoleteUnconfirmedBlobsRequest>( | ||
| MakeIntrusive<TCallContext>(CreateRequestId()), | ||
| commitId, | ||
| std::move(msg->BlobsToConfirm)); | ||
|
||
| NCloud::Send(ctx, SelfId(), std::move(request)); | ||
| } else { | ||
| // blobs are confirmed, but AddBlobs request will be executed | ||
| // (for this commit) later | ||
| State->BlobsConfirmed(commitId, std::move(msg->BlobsToConfirm)); | ||
| } | ||
| Y_DEBUG_ABORT_UNLESS(msg->CollectGarbageBarrierAcquired); | ||
| // commit & garbage queue barriers will be released when confirmed | ||
| // blobs are added | ||
| // blobs are added or when obsolete blobs are deleted | ||
| } else { | ||
| LOG_TRACE( | ||
| ctx, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.