aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsabdenovch <sabdenovch@yandex-team.com>2024-12-26 10:35:17 +0300
committersabdenovch <sabdenovch@yandex-team.com>2024-12-26 10:53:40 +0300
commitb4473180e344fac1deb5f4e85fc681efe2c708de (patch)
tree2f626a721ea469862eadbaf34d21d54f2cefc469
parent019e06b69d8ab869bd3663943546346d918972fb (diff)
downloadydb-b4473180e344fac1deb5f4e85fc681efe2c708de.tar.gz
Make chunk replicas cache slimmer
commit_hash:454430a5c94d0dbe31ac1157f5490cc6c834fcc0
-rw-r--r--yt/yt/client/chunk_client/chunk_replica.cpp2
-rw-r--r--yt/yt/client/chunk_client/chunk_replica.h2
-rw-r--r--yt/yt/client/chunk_client/public.h10
3 files changed, 8 insertions, 6 deletions
diff --git a/yt/yt/client/chunk_client/chunk_replica.cpp b/yt/yt/client/chunk_client/chunk_replica.cpp
index 41e43d299f..f2a6aa00cf 100644
--- a/yt/yt/client/chunk_client/chunk_replica.cpp
+++ b/yt/yt/client/chunk_client/chunk_replica.cpp
@@ -173,7 +173,7 @@ void TChunkReplicaAddressFormatter::operator()(TStringBuilderBase* builder, TChu
////////////////////////////////////////////////////////////////////////////////
-TChunkReplicaList TChunkReplicaWithMedium::ToChunkReplicas(const TChunkReplicaWithMediumList& replicasWithMedia)
+TChunkReplicaList TChunkReplicaWithMedium::ToChunkReplicas(TRange<TChunkReplicaWithMedium> replicasWithMedia)
{
TChunkReplicaList replicas;
replicas.reserve(replicasWithMedia.size());
diff --git a/yt/yt/client/chunk_client/chunk_replica.h b/yt/yt/client/chunk_client/chunk_replica.h
index 3aac24c6da..8d6a29f061 100644
--- a/yt/yt/client/chunk_client/chunk_replica.h
+++ b/yt/yt/client/chunk_client/chunk_replica.h
@@ -37,7 +37,7 @@ public:
int GetMediumIndex() const;
TChunkReplica ToChunkReplica() const;
- static TChunkReplicaList ToChunkReplicas(const TChunkReplicaWithMediumList& replicasWithMedia);
+ static TChunkReplicaList ToChunkReplicas(TRange<TChunkReplicaWithMedium> replicasWithMedia);
private:
/*!
diff --git a/yt/yt/client/chunk_client/public.h b/yt/yt/client/chunk_client/public.h
index 4e4f5c8edc..bf95fbc3ab 100644
--- a/yt/yt/client/chunk_client/public.h
+++ b/yt/yt/client/chunk_client/public.h
@@ -125,12 +125,13 @@ using TMediumMap = THashMap<int, T>;
template <typename T>
using TCompactMediumMap = TCompactFlatMap<int, T, 4>;
+constexpr int UpperReplicaCountBound = 24;
//! Used as an expected upper bound in TCompactVector.
/*
* Maximum regular number of replicas is 16 (for LRC codec).
* Additional +8 enables some flexibility during balancing.
*/
-constexpr int TypicalReplicaCount = 24;
+constexpr int TypicalReplicaCount = 3;
constexpr int GenericChunkReplicaIndex = 16; // no specific replica; the default one for non-erasure chunks
//! Valid indexes are in range |[0, ChunkReplicaIndexBound)|.
@@ -145,15 +146,16 @@ constexpr int DefaultSlotsMediumIndex = 0;
constexpr int MediumIndexBound = AllMediaIndex + 1;
class TChunkReplicaWithMedium;
-using TChunkReplicaWithMediumList = TCompactVector<TChunkReplicaWithMedium, TypicalReplicaCount>;
+using TChunkReplicaWithMediumList = TCompactVector<TChunkReplicaWithMedium, UpperReplicaCountBound>;
+using TChunkReplicaWithMediumSlimList = TCompactVector<TChunkReplicaWithMedium, TypicalReplicaCount>;
class TChunkReplicaWithLocation;
-using TChunkReplicaWithLocationList = TCompactVector<TChunkReplicaWithLocation, TypicalReplicaCount>;
+using TChunkReplicaWithLocationList = TCompactVector<TChunkReplicaWithLocation, UpperReplicaCountBound>;
struct TWrittenChunkReplicasInfo;
class TChunkReplica;
-using TChunkReplicaList = TCompactVector<TChunkReplica, TypicalReplicaCount>;
+using TChunkReplicaList = TCompactVector<TChunkReplica, UpperReplicaCountBound>;
extern const TString DefaultStoreAccountName;
extern const TString DefaultStoreMediumName;