Skip to content

Commit

Permalink
fix loadtest: enqueue index operation upon adddata completion
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxim Deb Natkh committed Apr 2, 2024
1 parent 5a57e45 commit 23db01a
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 12 deletions.
19 changes: 7 additions & 12 deletions cloud/filestore/libs/storage/tablet/actors/tablet_adddata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,13 @@ void TAddDataActor::ReplyAndDie(
const TActorContext& ctx,
const NProto::TError& error)
{
// notify tablet
NCloud::Send(
ctx,
// We try to release commit barrier twice: once for the lock
// acquired by the GenerateBlob request and once for the lock
// acquired by the AddData request. Though, the first lock is
// scheduled to be released, it is better to release it as early
// as possible.
Tablet,
std::make_unique<TEvIndexTabletPrivate::TEvReleaseCollectBarrier>(
CommitId,
2));
{
// notify tablet
using TCompletion = TEvIndexTabletPrivate::TEvAddDataCompleted;
auto response = std::make_unique<TCompletion>(error);
response->CommitId = CommitId;
NCloud::Send(ctx, Tablet, std::move(response));
}

FILESTORE_TRACK(
ResponseSent_TabletWorker,
Expand Down
3 changes: 3 additions & 0 deletions cloud/filestore/libs/storage/tablet/tablet_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ STFUNC(TIndexTabletActor::StateWork)
switch (ev->GetTypeRewrite()) {
HFunc(TEvIndexTabletPrivate::TEvReadDataCompleted, HandleReadDataCompleted);
HFunc(TEvIndexTabletPrivate::TEvWriteDataCompleted, HandleWriteDataCompleted);
HFunc(TEvIndexTabletPrivate::TEvAddDataCompleted, HandleAddDataCompleted);

HFunc(TEvIndexTabletPrivate::TEvUpdateCounters, HandleUpdateCounters);
HFunc(TEvIndexTabletPrivate::TEvUpdateLeakyBucketCounters, HandleUpdateLeakyBucketCounters);
Expand Down Expand Up @@ -652,6 +653,7 @@ STFUNC(TIndexTabletActor::StateZombie)

IgnoreFunc(TEvIndexTabletPrivate::TEvReadDataCompleted);
IgnoreFunc(TEvIndexTabletPrivate::TEvWriteDataCompleted);
IgnoreFunc(TEvIndexTabletPrivate::TEvAddDataCompleted);

// tablet related requests
IgnoreFunc(TEvents::TEvPoisonPill);
Expand Down Expand Up @@ -688,6 +690,7 @@ STFUNC(TIndexTabletActor::StateBroken)

IgnoreFunc(TEvIndexTabletPrivate::TEvReadDataCompleted);
IgnoreFunc(TEvIndexTabletPrivate::TEvWriteDataCompleted);
IgnoreFunc(TEvIndexTabletPrivate::TEvAddDataCompleted);

IgnoreFunc(TEvHiveProxy::TEvReassignTabletResponse);

Expand Down
4 changes: 4 additions & 0 deletions cloud/filestore/libs/storage/tablet/tablet_actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,10 @@ class TIndexTabletActor final
const TEvIndexTabletPrivate::TEvWriteDataCompleted::TPtr& ev,
const NActors::TActorContext& ctx);

void HandleAddDataCompleted(
const TEvIndexTabletPrivate::TEvAddDataCompleted::TPtr& ev,
const NActors::TActorContext& ctx);

bool HandleRequests(STFUNC_SIG);
bool RejectRequests(STFUNC_SIG);
bool RejectRequestsByBrokenTablet(STFUNC_SIG);
Expand Down
19 changes: 19 additions & 0 deletions cloud/filestore/libs/storage/tablet/tablet_actor_adddata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,4 +369,23 @@ void TIndexTabletActor::HandleAddData(
txStarted = true;
}

////////////////////////////////////////////////////////////////////////////////

void TIndexTabletActor::HandleAddDataCompleted(
const TEvIndexTabletPrivate::TEvAddDataCompleted::TPtr& ev,
const TActorContext& ctx)
{
auto* msg = ev->Get();

// We try to release commit barrier twice: once for the lock
// acquired by the GenerateBlob request and once for the lock
// acquired by the AddData request. Though, the first lock is
// scheduled to be released, it is better to release it as early
// as possible.
TryReleaseCollectBarrier(msg->CommitId);
TryReleaseCollectBarrier(msg->CommitId);

EnqueueBlobIndexOpIfNeeded(ctx);
}

} // namespace NCloud::NFileStore::NStorage
11 changes: 11 additions & 0 deletions cloud/filestore/libs/storage/tablet/tablet_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,15 @@ struct TEvIndexTabletPrivate
{
};

//
// AddData completion
//

struct TAddDataCompleted
{
ui64 CommitId = 0;
};

//
// AddBlob
//
Expand Down Expand Up @@ -613,6 +622,7 @@ struct TEvIndexTabletPrivate

EvReadDataCompleted,
EvWriteDataCompleted,
EvAddDataCompleted,

EvReleaseCollectBarrier,

Expand All @@ -633,6 +643,7 @@ struct TEvIndexTabletPrivate

using TEvReadDataCompleted = TResponseEvent<TReadWriteCompleted, EvReadDataCompleted>;
using TEvWriteDataCompleted = TResponseEvent<TReadWriteCompleted, EvWriteDataCompleted>;
using TEvAddDataCompleted = TResponseEvent<TAddDataCompleted, EvAddDataCompleted>;
};

} // namespace NCloud::NFileStore::NStorage

0 comments on commit 23db01a

Please sign in to comment.