diff options
author | Alexey Borzenkov <[email protected]> | 2022-05-23 19:17:07 +0300 |
---|---|---|
committer | Alexey Borzenkov <[email protected]> | 2022-05-23 19:17:07 +0300 |
commit | b97d780ff0d8b9e99aaa1a1c979f7f1cd82a91d1 (patch) | |
tree | f3e7d10f313562891457bbb8f21a0d593273fe5a | |
parent | eb3bd69695ba3886b67fa5a62fb3b42eba78dfd0 (diff) |
Force max throughput tactic for external blobs, KIKIMR-14938
ref:3e733abe2952aac30f60a817e5b672563f6b0a29
-rw-r--r-- | ydb/core/base/tablet.h | 6 | ||||
-rw-r--r-- | ydb/core/tablet/tablet_req_writelog.cpp | 12 | ||||
-rw-r--r-- | ydb/core/tablet_flat/flat_exec_commit.h | 4 | ||||
-rw-r--r-- | ydb/core/tablet_flat/flat_executor_txloglogic.cpp | 6 | ||||
-rw-r--r-- | ydb/core/tablet_flat/flat_sausage_slicer.h | 5 |
5 files changed, 23 insertions, 10 deletions
diff --git a/ydb/core/base/tablet.h b/ydb/core/base/tablet.h index 3b97f4fe095..945d6360884 100644 --- a/ydb/core/base/tablet.h +++ b/ydb/core/base/tablet.h @@ -190,7 +190,11 @@ struct TEvTablet { } }; - using TLogEntryReference = TLogoBlob; + struct TLogEntryReference : public TLogoBlob { + std::optional<TEvBlobStorage::TEvPut::ETactic> Tactic; + + using TLogoBlob::TLogoBlob; + }; // dependency graph to boot tablet, not yet ready struct TEvBoot : public TEventLocal<TEvBoot, EvBoot> { diff --git a/ydb/core/tablet/tablet_req_writelog.cpp b/ydb/core/tablet/tablet_req_writelog.cpp index 7c4d02c405c..72513664e5c 100644 --- a/ydb/core/tablet/tablet_req_writelog.cpp +++ b/ydb/core/tablet/tablet_req_writelog.cpp @@ -86,7 +86,8 @@ class TTabletReqWriteLog : public TActorBootstrapped<TTabletReqWriteLog> { } void SendToBS(const TLogoBlobID &id, const TString &buffer, const TActorContext &ctx, - const NKikimrBlobStorage::EPutHandleClass handleClass) { + const NKikimrBlobStorage::EPutHandleClass handleClass, + TEvBlobStorage::TEvPut::ETactic tactic) { Y_VERIFY(id.TabletID() == Info->TabletID); const TTabletChannelInfo *channelInfo = Info->ChannelInfo(id.Channel()); Y_VERIFY(channelInfo); @@ -96,7 +97,7 @@ class TTabletReqWriteLog : public TActorBootstrapped<TTabletReqWriteLog> { ui64 cookie = RandomNumber<ui64>(); RequestCookies ^= cookie; - SendPutToGroup(ctx, x->GroupID, Info.Get(), MakeHolder<TEvBlobStorage::TEvPut>(id, buffer, TInstant::Max(), handleClass, CommitTactic), cookie); + SendPutToGroup(ctx, x->GroupID, Info.Get(), MakeHolder<TEvBlobStorage::TEvPut>(id, buffer, TInstant::Max(), handleClass, tactic), cookie); } public: @@ -123,8 +124,9 @@ public: // todo: cancelation const auto handleClass = NKikimrBlobStorage::TabletLog; - for (const auto &ref : References) - SendToBS(ref.Id, ref.Buffer, ctx, handleClass); + for (const auto &ref : References) { + SendToBS(ref.Id, ref.Buffer, ctx, handleClass, ref.Tactic ? *ref.Tactic : CommitTactic); + } const TLogoBlobID actualLogEntryId = TLogoBlobID( LogEntryID.TabletID(), @@ -134,7 +136,7 @@ public: logEntryBuffer.size(), LogEntryID.Cookie() ); - SendToBS(actualLogEntryId, logEntryBuffer, ctx, NKikimrBlobStorage::TabletLog); + SendToBS(actualLogEntryId, logEntryBuffer, ctx, NKikimrBlobStorage::TabletLog, CommitTactic); RepliesToWait = References.size() + 1; Become(&TThis::StateWait); diff --git a/ydb/core/tablet_flat/flat_exec_commit.h b/ydb/core/tablet_flat/flat_exec_commit.h index a1402dcf248..058d2409123 100644 --- a/ydb/core/tablet_flat/flat_exec_commit.h +++ b/ydb/core/tablet_flat/flat_exec_commit.h @@ -25,6 +25,8 @@ namespace NTabletFlatExecutor { }; struct TLogCommit { + using ETactic = TEvBlobStorage::TEvPut::ETactic; + TLogCommit(bool sync, ui32 step, ECommit type) : Step(step) , Type(type) @@ -52,7 +54,7 @@ namespace NTabletFlatExecutor { bool WaitFollowerGcAck = false; TString Embedded; TString FollowerAux; - TVector<TLogoBlob> Refs; + TVector<TEvTablet::TLogEntryReference> Refs; TGCBlobDelta GcDelta; TVector<TEvTablet::TCommitMetadata> Metadata; TSeat *FirstTx = nullptr; diff --git a/ydb/core/tablet_flat/flat_executor_txloglogic.cpp b/ydb/core/tablet_flat/flat_executor_txloglogic.cpp index df59ddc2455..d5197d8466d 100644 --- a/ydb/core/tablet_flat/flat_executor_txloglogic.cpp +++ b/ydb/core/tablet_flat/flat_executor_txloglogic.cpp @@ -161,7 +161,11 @@ TLogicRedo::TCommitRWTransactionResult TLogicRedo::CommitRWTransaction( } commit->GcDelta.Created.emplace_back(one.GId.Logo); - commit->Refs.emplace_back(one.GId.Logo, one.Data.ToString()); + auto& ref = commit->Refs.emplace_back(one.GId.Logo, one.Data.ToString()); + + // External blobs are never recompacted. + // Prioritize small number of copies over latency. + ref.Tactic = TEvBlobStorage::TEvPut::ETactic::TacticMaxThroughput; } /* Sometimes clang drops the last emplace_back above if move was used diff --git a/ydb/core/tablet_flat/flat_sausage_slicer.h b/ydb/core/tablet_flat/flat_sausage_slicer.h index 0dd62309024..1c852bb2c14 100644 --- a/ydb/core/tablet_flat/flat_sausage_slicer.h +++ b/ydb/core/tablet_flat/flat_sausage_slicer.h @@ -2,6 +2,7 @@ #include "util_fmt_abort.h" #include "flat_sausage_grind.h" +#include <ydb/core/base/tablet.h> #include <util/thread/singleton.h> #include <library/cpp/blockcodecs/codecs.h> @@ -18,7 +19,7 @@ namespace NPageCollection { } - TGlobId One(TVector<TLogoBlob> &refs, TString body, bool lz4) const + TGlobId One(TVector<TEvTablet::TLogEntryReference> &refs, TString body, bool lz4) const { if (body.size() > Block) { Y_Fail( @@ -37,7 +38,7 @@ namespace NPageCollection { return glob; } - TLargeGlobId Do(TVector<TLogoBlob> &refs, TString body, bool lz4) const + TLargeGlobId Do(TVector<TEvTablet::TLogEntryReference> &refs, TString body, bool lz4) const { if (body.size() >= Max<ui32>()) { Y_Fail( |