diff options
author | artln <artln@yandex-team.ru> | 2022-02-10 16:50:45 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:45 +0300 |
commit | 4ca790a51d9446c61a387e9419c4afea5761103d (patch) | |
tree | 1e7b067409c5a7bddff0294015768f9c9966f2e0 | |
parent | 8051c146c2522c597bb0743cb37c8cc8612895dc (diff) | |
download | ydb-4ca790a51d9446c61a387e9419c4afea5761103d.tar.gz |
Restoring authorship annotation for <artln@yandex-team.ru>. Commit 1 of 2.
37 files changed, 922 insertions, 922 deletions
diff --git a/library/cpp/actors/testlib/test_runtime.cpp b/library/cpp/actors/testlib/test_runtime.cpp index 6fa25b9965..3a15fce033 100644 --- a/library/cpp/actors/testlib/test_runtime.cpp +++ b/library/cpp/actors/testlib/test_runtime.cpp @@ -14,7 +14,7 @@ #include <library/cpp/actors/interconnect/interconnect_proxy_wrapper.h> #include <util/generic/maybe.h> -#include <util/generic/bt_exception.h> +#include <util/generic/bt_exception.h> #include <util/random/mersenne.h> #include <util/string/printf.h> #include <typeinfo> @@ -1280,7 +1280,7 @@ namespace NActors { Cerr << "Reach deadline at " << TInstant::MicroSeconds(CurrentTimestamp) << "\n"; } - ythrow TWithBackTrace<TEmptyEventQueueException>(); + ythrow TWithBackTrace<TEmptyEventQueueException>(); } if (!options.Quiet && dispatchTime >= inspectScheduledEventsAt) { diff --git a/ydb/core/base/blobstorage.h b/ydb/core/base/blobstorage.h index a2faee326e..6596053876 100644 --- a/ydb/core/base/blobstorage.h +++ b/ydb/core/base/blobstorage.h @@ -310,20 +310,20 @@ struct TTabletChannelInfo { } }; -class TTabletStorageInfo : public TThrRefBase { -public: - // - TTabletStorageInfo() - : TabletID(Max<ui64>()) - , TabletType(TTabletTypes::TYPE_INVALID) +class TTabletStorageInfo : public TThrRefBase { +public: + // + TTabletStorageInfo() + : TabletID(Max<ui64>()) + , TabletType(TTabletTypes::TYPE_INVALID) , Version(0) - {} + {} TTabletStorageInfo(ui64 tabletId, TTabletTypes::EType tabletType) : TabletID(tabletId) , TabletType(tabletType) , Version(0) {} - virtual ~TTabletStorageInfo() {} + virtual ~TTabletStorageInfo() {} const TTabletChannelInfo* ChannelInfo(ui32 channel) const { if (Channels.size() <= channel) { @@ -335,7 +335,7 @@ public: } return &info; } - + ui32 GroupFor(ui32 channel, ui32 recordGen) const { if (const TTabletChannelInfo *channelInfo = ChannelInfo(channel)) return channelInfo->GroupForGeneration(recordGen); @@ -383,8 +383,8 @@ public: return false; } - // - ui64 TabletID; + // + ui64 TabletID; TVector<TTabletChannelInfo> Channels; TTabletTypes::EType TabletType; ui32 Version; @@ -877,7 +877,7 @@ struct TEvBlobStorage { return "unknown"; } }; - + const TLogoBlobID Id; const TString Buffer; const TInstant Deadline; diff --git a/ydb/core/base/events.h b/ydb/core/base/events.h index f5fedfe19b..662abdd92c 100644 --- a/ydb/core/base/events.h +++ b/ydb/core/base/events.h @@ -40,7 +40,7 @@ struct TKikimrEvents : TEvents { ES_TX_PROXY_REQ, ES_TABLET_PIPE, ES_DEPRECATED_4118, - ES_TABLET_COUNTERS_AGGREGATOR, + ES_TABLET_COUNTERS_AGGREGATOR, ES_DEPRECATED_4121, ES_PROXY_BUS, //4122 ES_BOOTSTRAPPER, diff --git a/ydb/core/base/services_assert.cpp b/ydb/core/base/services_assert.cpp index 97fa3b8222..6b51b2dd77 100644 --- a/ydb/core/base/services_assert.cpp +++ b/ydb/core/base/services_assert.cpp @@ -1,5 +1,5 @@ #include <library/cpp/actors/protos/services_common.pb.h> #include <ydb/core/protos/services.pb.h> - + static_assert(static_cast<ui32>(NKikimrServices::EServiceKikimr_MIN) > static_cast<ui32>(NActorsServices::EServiceCommon_MAX), "KIKIMR SERVICES IDs SHOULD BE GREATER THAN COMMON ONES"); static_assert(NKikimrServices::TActivity::EType_ARRAYSIZE < 640, "ACTOR ACTIVITY TYPES MUST BE NOT VERY BIG TO BE ARRAY INDICES"); // If we would have many different actor activities, it is OK to increase this value. diff --git a/ydb/core/base/tablet.h b/ydb/core/base/tablet.h index 602e39c600..0e1549d44a 100644 --- a/ydb/core/base/tablet.h +++ b/ydb/core/base/tablet.h @@ -265,7 +265,7 @@ struct TEvTablet { TVector<TLogoBlobID> GcDiscovered; TVector<TLogoBlobID> GcLeft; - + TString EmbeddedLogBody; TString FollowerAux; diff --git a/ydb/core/base/tablet_types.h b/ydb/core/base/tablet_types.h index f585819299..27e89162f0 100644 --- a/ydb/core/base/tablet_types.h +++ b/ydb/core/base/tablet_types.h @@ -1,17 +1,17 @@ -#pragma once - -#include "defs.h" +#pragma once + +#include "defs.h" #include "tabletid.h" #include <ydb/core/protos/tablet.pb.h> - -//////////////////////////////////////////// -namespace NKikimr { - -//////////////////////////////////////////// -/// The TTabletTypes class -//////////////////////////////////////////// + +//////////////////////////////////////////// +namespace NKikimr { + +//////////////////////////////////////////// +/// The TTabletTypes class +//////////////////////////////////////////// struct TTabletTypes : NKikimrTabletBase::TTabletTypes { -public: +public: static constexpr EType USER_TYPE_START = UserTypeStart; static constexpr EType TYPE_INVALID = TypeInvalid; static constexpr EType FLAT_SCHEMESHARD = SchemeShard; @@ -41,11 +41,11 @@ public: static constexpr EType TESTSHARD = TestShard; static constexpr EType SEQUENCESHARD = SequenceShard; static constexpr EType REPLICATION_CONTROLLER = ReplicationController; - + static const char* TypeToStr(EType t) { return EType_Name(t).c_str(); } - + static EType StrToType(const TString& t) { EType type; if (EType_Parse(t, &type)) { @@ -54,9 +54,9 @@ public: return TypeInvalid; } } -}; - -} // end of NKikimr +}; + +} // end of NKikimr Y_DECLARE_OUT_SPEC(inline, NKikimrTabletBase::TTabletTypes::EType, os, type) { os << NKikimrTabletBase::TTabletTypes::EType_Name(type); diff --git a/ydb/core/base/ya.make b/ydb/core/base/ya.make index 83db5825c3..00e24e0717 100644 --- a/ydb/core/base/ya.make +++ b/ydb/core/base/ya.make @@ -51,7 +51,7 @@ SRCS( resource_profile.h row_version.cpp row_version.h - services_assert.cpp + services_assert.cpp shared_data.cpp shared_quota.h statestorage.cpp @@ -78,7 +78,7 @@ SRCS( tablet_resolver.h tablet_status_checker.cpp tabletid.h - tablet_types.h + tablet_types.h traceid.cpp traceid.h tracing.h diff --git a/ydb/core/blobstorage/base/blobstorage_vdiskid.h b/ydb/core/blobstorage/base/blobstorage_vdiskid.h index c8d5a818b1..8796ffa725 100644 --- a/ydb/core/blobstorage/base/blobstorage_vdiskid.h +++ b/ydb/core/blobstorage/base/blobstorage_vdiskid.h @@ -5,8 +5,8 @@ #include <ydb/core/protos/blobstorage.pb.h> #include <util/str_stl.h> -#include <util/digest/numeric.h> - +#include <util/digest/numeric.h> + namespace NKikimr { class TBlobStorageGroupInfo; diff --git a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.h b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.h index e2d1445be4..ca3049931a 100644 --- a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.h +++ b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.h @@ -11,9 +11,9 @@ #include <ydb/core/util/log_priority_mute_checker.h> #include <util/str_stl.h> -#include <util/digest/numeric.h> +#include <util/digest/numeric.h> #include <util/generic/hash_set.h> - + namespace NActors { class TNodeLocation; } // NActors diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_events.h b/ydb/core/blobstorage/vdisk/common/vdisk_events.h index 47fbd959c9..d4145d5450 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_events.h +++ b/ydb/core/blobstorage/vdisk/common/vdisk_events.h @@ -673,7 +673,7 @@ namespace NKikimr { } if (record.HasHandleClass()) { str << " HandleClass# " << record.GetHandleClass(); - } + } if (record.HasMsgQoS()) { str << " "; TEvBlobStorage::TEvVPut::OutMsgQos(record.GetMsgQoS(), str); diff --git a/ydb/core/client/client_ut.cpp b/ydb/core/client/client_ut.cpp index b94c722588..5de6892871 100644 --- a/ydb/core/client/client_ut.cpp +++ b/ydb/core/client/client_ut.cpp @@ -1200,7 +1200,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { { TString binQuery; NKikimrMiniKQL::TResult readRes; - + const TString readQuery = R"___( ( (let from (Parameter 'FROM (DataType 'Uint64))) diff --git a/ydb/core/engine/mkql_keys.cpp b/ydb/core/engine/mkql_keys.cpp index 05afb89adc..254b961318 100644 --- a/ydb/core/engine/mkql_keys.cpp +++ b/ydb/core/engine/mkql_keys.cpp @@ -3,7 +3,7 @@ #include <ydb/library/yql/minikql/mkql_node_cast.h> #include <ydb/core/base/domain.h> #include <ydb/core/scheme_types/scheme_types_defs.h> - + #include <util/generic/maybe.h> #include <util/generic/algorithm.h> #include <functional> diff --git a/ydb/core/protos/tablet_database.proto b/ydb/core/protos/tablet_database.proto index a6658688a6..614548cffd 100644 --- a/ydb/core/protos/tablet_database.proto +++ b/ydb/core/protos/tablet_database.proto @@ -42,7 +42,7 @@ message TExecutorSettings { optional TCompactionPolicy CompactionPolicy = 10; repeated TLocalityGroupPolicy LocalityGroupPolicy = 11; - + reserved 100; //optional bool ExposeCounters = 100; } diff --git a/ydb/core/scheme/tablet_scheme.h b/ydb/core/scheme/tablet_scheme.h index 4373b3576a..62d59d2293 100644 --- a/ydb/core/scheme/tablet_scheme.h +++ b/ydb/core/scheme/tablet_scheme.h @@ -1,4 +1,4 @@ #pragma once #include <ydb/public/lib/scheme_types/scheme_type_id.h> #include <ydb/core/scheme_types/scheme_raw_type_value.h> - + diff --git a/ydb/core/scheme/tablet_scheme_defs.h b/ydb/core/scheme/tablet_scheme_defs.h index 697638079d..9003980df6 100644 --- a/ydb/core/scheme/tablet_scheme_defs.h +++ b/ydb/core/scheme/tablet_scheme_defs.h @@ -1,37 +1,37 @@ -#pragma once - -#include "defs.h" -#include <util/string/builder.h> - -//////////////////////////////////////////// -namespace NKikimr { - -//////////////////////////////////////////// -class TTagDetails { -public: - // - TTagDetails(const TStringBuf& name, ui32 idx, ui32 valueType, ui32 payloadType) - : Name(name) - , Idx(idx) - , ValueType(valueType) - , PayloadType(payloadType) - { - } - - ~TTagDetails() {} - +#pragma once + +#include "defs.h" +#include <util/string/builder.h> + +//////////////////////////////////////////// +namespace NKikimr { + +//////////////////////////////////////////// +class TTagDetails { +public: + // + TTagDetails(const TStringBuf& name, ui32 idx, ui32 valueType, ui32 payloadType) + : Name(name) + , Idx(idx) + , ValueType(valueType) + , PayloadType(payloadType) + { + } + + ~TTagDetails() {} + TString Name; - ui32 Idx; - ui32 ValueType; - ui32 PayloadType; - - bool IsLeaf() const { - return !!PayloadType; - } - - bool IsSingular() const { - return !ValueType; - } + ui32 Idx; + ui32 ValueType; + ui32 PayloadType; + + bool IsLeaf() const { + return !!PayloadType; + } + + bool IsSingular() const { + return !ValueType; + } inline bool operator==(const TTagDetails& other) const { return Idx == other.Idx && ValueType == other.ValueType && PayloadType == other.PayloadType @@ -41,23 +41,23 @@ public: inline bool operator!=(const TTagDetails& other) const { return !operator==(other); } -}; - -//////////////////////////////////////////// -class TTagDetailsExtended { -public: - // - static const ui32 DEFAULT_LOCALITY_GROUP = 0; - - // - explicit TTagDetailsExtended(ui32 localityGroupId = DEFAULT_LOCALITY_GROUP) - : LocalityGroupId(localityGroupId) - {} - ~TTagDetailsExtended() {} - - // - ui32 LocalityGroupId; -}; - -} // end of the NKikimr namespace - +}; + +//////////////////////////////////////////// +class TTagDetailsExtended { +public: + // + static const ui32 DEFAULT_LOCALITY_GROUP = 0; + + // + explicit TTagDetailsExtended(ui32 localityGroupId = DEFAULT_LOCALITY_GROUP) + : LocalityGroupId(localityGroupId) + {} + ~TTagDetailsExtended() {} + + // + ui32 LocalityGroupId; +}; + +} // end of the NKikimr namespace + diff --git a/ydb/core/scheme_types/scheme_type_registry.cpp b/ydb/core/scheme_types/scheme_type_registry.cpp index d737254361..93339fa00c 100644 --- a/ydb/core/scheme_types/scheme_type_registry.cpp +++ b/ydb/core/scheme_types/scheme_type_registry.cpp @@ -1,18 +1,18 @@ -#include "scheme_type_registry.h" -#include "scheme_types.h" +#include "scheme_type_registry.h" +#include "scheme_types.h" #include "scheme_types_defs.h" #include <util/digest/murmur.h> #include <util/generic/algorithm.h> - + #define REGISTER_TYPE(name, size, ...) RegisterType<T##name>(); - + namespace NKikimr { namespace NScheme { -TTypeRegistry::TTypeRegistry() -{ +TTypeRegistry::TTypeRegistry() +{ // move to 'init defaults?' RegisterType<TInt32>(); RegisterType<TUint32>(); @@ -36,8 +36,8 @@ TTypeRegistry::TTypeRegistry() RegisterType<TTimestamp>(); RegisterType<TInterval>(); RegisterType<TDyNumber>(); -} - +} + void TTypeRegistry::CalculateMetadataEtag() { } diff --git a/ydb/core/scheme_types/scheme_type_registry.h b/ydb/core/scheme_types/scheme_type_registry.h index a82af19267..7e89e8ac1f 100644 --- a/ydb/core/scheme_types/scheme_type_registry.h +++ b/ydb/core/scheme_types/scheme_type_registry.h @@ -1,33 +1,33 @@ -#pragma once - -#include "scheme_types.h" +#pragma once + +#include "scheme_types.h" #include "scheme_type_metadata.h" -#include <util/generic/map.h> +#include <util/generic/map.h> #include <util/generic/maybe.h> #include <util/generic/singleton.h> #include <util/generic/vector.h> #include <util/string/builder.h> - + namespace NKikimr { namespace NScheme { -//////////////////////////////////////////////////////// -/// The TTypeRegistry class -/// this class is _not_ threadsafe!!!! -/// it's intentionally -class TTypeRegistry : public TThrRefBase, TNonCopyable { -public: - // - TTypeRegistry(); - - // - template <typename T> +//////////////////////////////////////////////////////// +/// The TTypeRegistry class +/// this class is _not_ threadsafe!!!! +/// it's intentionally +class TTypeRegistry : public TThrRefBase, TNonCopyable { +public: + // + TTypeRegistry(); + + // + template <typename T> void RegisterType() { RegisterType(Singleton<T>()); - } - + } + void RegisterType(const IType *type) { const TTypeId typeId = type->GetTypeId(); Y_VERIFY(typeId <= Max<TTypeId>()); @@ -38,7 +38,7 @@ public: TypeMetadataRegistry.Register(type); } - // + // ITypeSP GetType(TTypeId typeId) const { if (typeId) { auto iter = TypeByIdMap.find(typeId); @@ -46,10 +46,10 @@ public: Y_VERIFY_DEBUG(iter->second); return iter->second; } - } + } return typeId; - } - + } + ::TString GetTypeName(TTypeId typeId) const { if (!typeId) { return "Null"; @@ -102,17 +102,17 @@ public: return MetadataEtag; } -private: - // +private: + // typedef TMap<ui32, const IType *> TTypeByIdMap; typedef TMap<::TString, const IType *> TTypeByNameMap; - + TTypeByIdMap TypeByIdMap; TTypeByNameMap TypeByNameMap; TTypeMetadataRegistry TypeMetadataRegistry; ui64 MetadataEtag = 0; -}; - +}; + } // namespace NScheme } // namespace NKikimr - + diff --git a/ydb/core/scheme_types/scheme_types.h b/ydb/core/scheme_types/scheme_types.h index 3034843a24..47709cd74a 100644 --- a/ydb/core/scheme_types/scheme_types.h +++ b/ydb/core/scheme_types/scheme_types.h @@ -1,8 +1,8 @@ #pragma once - + #include <ydb/public/lib/scheme_types/scheme_type_id.h> - -#include <util/string/hex.h> + +#include <util/string/hex.h> #include <util/string/cast.h> #include <typeinfo> @@ -11,7 +11,7 @@ namespace NKikimr { namespace NScheme { -//////////////////////////////////////////////////////// +//////////////////////////////////////////////////////// class ITypeMetadata { public: enum class EFlags { @@ -37,33 +37,33 @@ friend class ITypeSP; friend class TTypeRegistry; }; -//////////////////////////////////////////////////////// +//////////////////////////////////////////////////////// class ITypeSP { -public: - // +public: + // ITypeSP(const IType* t = nullptr) - : Type(t) + : Type(t) , TypeId(t ? t->GetTypeId() : 0) {} ITypeSP(TTypeId typeId) - : Type(nullptr) - , TypeId(typeId) + : Type(nullptr) + , TypeId(typeId) {} - // + // const IType* operator->() const noexcept { return Type; } explicit operator bool() const noexcept { return TypeId != 0; } - + bool IsKnownType() const noexcept { return Type != nullptr; } - + TTypeId GetTypeId() const noexcept { return TypeId; } const IType* GetType() const noexcept { return Type; } - -private: + +private: const IType* Type; TTypeId TypeId; -}; - +}; + } // namspace NScheme } // namespace NKikimr diff --git a/ydb/core/scheme_types/scheme_types_defs.h b/ydb/core/scheme_types/scheme_types_defs.h index bb06b09702..11cb4ff059 100644 --- a/ydb/core/scheme_types/scheme_types_defs.h +++ b/ydb/core/scheme_types/scheme_types_defs.h @@ -1,8 +1,8 @@ -#pragma once - -#include "scheme_types.h" +#pragma once + +#include "scheme_types.h" #include "scheme_raw_type_value.h" - + #include <util/charset/utf8.h> #include <util/generic/hash.h> #include <util/stream/output.h> // for IOutputStream @@ -13,30 +13,30 @@ namespace NKikimr { namespace NScheme { - + const ui32 MaxKeyValueSize = 4096; -//////////////////////////////////////////////////////// +//////////////////////////////////////////////////////// template<typename T, typename TDerived, TTypeId TypeId_, const char* Name_> class TTypedType : public IType { -public: - // - typedef T TValueType; +public: + // + typedef T TValueType; static constexpr TTypeId TypeId = TypeId_; - // - class TInstance { - public: - // - const T Value; - - TInstance(const T& v) : Value(v) {} - - operator TRawTypeValue() const { - return TDerived::ToRawTypeValue(Value); - } - }; - + // + class TInstance { + public: + // + const T Value; + + TInstance(const T& v) : Value(v) {} + + operator TRawTypeValue() const { + return TDerived::ToRawTypeValue(Value); + } + }; + TTypedType() = default; // IType interface @@ -48,27 +48,27 @@ public: return sizeof(T); } TTypeId GetTypeId() const override { return TypeId; } - static TRawTypeValue ToRawTypeValue(const T& value) { + static TRawTypeValue ToRawTypeValue(const T& value) { return TRawTypeValue((void*)&value, sizeof(T), TypeId); - } - + } + static const char* TypeName() { return Name_; } -}; - -//////////////////////////////////////////////////////// +}; + +//////////////////////////////////////////////////////// template<typename T, ui32 TypeId, const char* Name> class IIntegerTypeWithKeyString : public TTypedType<T, IIntegerTypeWithKeyString<T, TypeId, Name>, TypeId, Name> { static_assert(std::is_integral<T>::value, "expect std::is_integral<T>::value"); public: -}; - -//////////////////////////////////////////////////////// -/// Integer types -/// 0x01 - 0x20 -/// DO NOT FORGET TO REGISTER THE TYPES in Library::OpenLibrary() / file tablet_library.h +}; + +//////////////////////////////////////////////////////// +/// Integer types +/// 0x01 - 0x20 +/// DO NOT FORGET TO REGISTER THE TYPES in Library::OpenLibrary() / file tablet_library.h namespace NNames { extern const char Int32[6]; extern const char Uint32[7]; @@ -112,31 +112,31 @@ public: class TDouble : public TRealBase<double, TDouble, NTypeIds::Double, NNames::Double> {}; class TFloat : public TRealBase<float, TFloat, NTypeIds::Float, NNames::Float> {}; -//////////////////////////////////////////////////////// +//////////////////////////////////////////////////////// template<typename TFirst, typename TSecond, ui32 TypeId, const char* Name> -class IIntegerPair : public TTypedType< +class IIntegerPair : public TTypedType< std::pair<TFirst, TSecond>, IIntegerPair<TFirst, TSecond, TypeId, Name>, TypeId, Name - > -{ -}; - -//////////////////////////////////////////////////////// -/// Integer pair types -/// 0x101 - 0x200 -/// DO NOT FORGET TO REGISTER THE TYPES in Library::OpenLibrary() / file tablet_library.h + > +{ +}; + +//////////////////////////////////////////////////////// +/// Integer pair types +/// 0x101 - 0x200 +/// DO NOT FORGET TO REGISTER THE TYPES in Library::OpenLibrary() / file tablet_library.h namespace NNames { extern const char PairUi64Ui64[13]; } - + class TPairUi64Ui64 : public IIntegerPair<ui64, ui64, NTypeIds::PairUi64Ui64, NNames::PairUi64Ui64> {}; -//////////////////////////////////////////////////////// -/// Byte strings -/// 0x1001 - 0x2000 -/// DO NOT FORGET TO REGISTER THE TYPES in Library::OpenLibrary() / file tablet_library.h +//////////////////////////////////////////////////////// +/// Byte strings +/// 0x1001 - 0x2000 +/// DO NOT FORGET TO REGISTER THE TYPES in Library::OpenLibrary() / file tablet_library.h // TODO: this String implementation is not quite correct - think about it later - once we decide to use it - AL class TStringImpl { public: @@ -144,8 +144,8 @@ public: template <typename TDerived, TTypeId TypeId, const char* Name> class TStringBase : public TTypedType<::TString, TDerived, TypeId, Name> -{ -public: +{ +public: static constexpr ui32 GetFixedSize() { return 0; } @@ -153,8 +153,8 @@ public: static TRawTypeValue ToRawTypeValue(const ::TString& value) { return TRawTypeValue((const void*)value.data(), value.size(), TypeId); } -}; - +}; + namespace NNames { extern const char String[7]; extern const char Utf8[5]; diff --git a/ydb/core/tablet/bootstrapper.cpp b/ydb/core/tablet/bootstrapper.cpp index d2e5dd8b7f..11abf6a67f 100644 --- a/ydb/core/tablet/bootstrapper.cpp +++ b/ydb/core/tablet/bootstrapper.cpp @@ -562,9 +562,9 @@ public: , BootstrapperInfo(bootstrapperInfo) , RoundCounter(0xdeadbeefdeadbeefull) , SelfSeed(0xdeadbeefdeadbeefull) - { + { Y_VERIFY(TTabletTypes::TYPE_INVALID != TabletInfo->TabletType); - } + } TAutoPtr<IEventHandle> AfterRegister(const TActorId &selfId, const TActorId &parentId) override { Y_UNUSED(parentId); diff --git a/ydb/core/tablet/defs.h b/ydb/core/tablet/defs.h index b982be8e2c..712f88560e 100644 --- a/ydb/core/tablet/defs.h +++ b/ydb/core/tablet/defs.h @@ -4,9 +4,9 @@ #include <ydb/core/base/events.h> #include <ydb/core/base/logoblob.h> -namespace NKikimr { - -class TFlatBlobDataOutputStream; - -} +namespace NKikimr { +class TFlatBlobDataOutputStream; + +} + diff --git a/ydb/core/tablet/tablet_counters_aggregator.cpp b/ydb/core/tablet/tablet_counters_aggregator.cpp index 1885b26e09..36f82ffdfd 100644 --- a/ydb/core/tablet/tablet_counters_aggregator.cpp +++ b/ydb/core/tablet/tablet_counters_aggregator.cpp @@ -1,4 +1,4 @@ -#include "tablet_counters_aggregator.h" +#include "tablet_counters_aggregator.h" #include "tablet_counters_app.h" #include <library/cpp/actors/core/log.h> #include <ydb/core/mon/mon.h> @@ -22,14 +22,14 @@ #include <util/generic/xrange.h> #include <util/string/vector.h> #include <util/string/split.h> - -#ifdef _darwin_ -#pragma GCC diagnostic ignored "-Wformat" -#endif - -//////////////////////////////////////////// -namespace NKikimr { - + +#ifdef _darwin_ +#pragma GCC diagnostic ignored "-Wformat" +#endif + +//////////////////////////////////////////// +namespace NKikimr { + TActorId MakeTabletCountersAggregatorID(ui32 node, bool follower) { if (!follower) { char x[12] = {'t','a','b','l','c','o','u','n','t','a','g','g'}; @@ -52,15 +52,15 @@ bool IsHistogramAggregateSimpleName(TStringBuf name) { return !GetHistogramAggregateSimpleName(name).empty(); } -//////////////////////////////////////////// -namespace { - +//////////////////////////////////////////// +namespace { + const ui32 WAKEUP_TIMEOUT_SECONDS = 4; -//////////////////////////////////////////// +//////////////////////////////////////////// using TCountersVector = TVector<NMonitoring::TDynamicCounters::TCounterPtr>; - + struct THistogramCounter { TVector<TTabletPercentileCounter::TRangeDef> Ranges; TVector<NMonitoring::TDynamicCounters::TCounterPtr> Values; @@ -96,28 +96,28 @@ struct THistogramCounter { using THistogramVector = TVector<THolder<THistogramCounter>>; class TAggregatedSimpleCounters { -public: - // - TAggregatedSimpleCounters(NMonitoring::TDynamicCounterPtr counterGroup) - : CounterGroup(counterGroup) - {} - +public: + // + TAggregatedSimpleCounters(NMonitoring::TDynamicCounterPtr counterGroup) + : CounterGroup(counterGroup) + {} + void AddSimpleCounter(const char* name, THolder<THistogramCounter> percentileAggregate = THolder<THistogramCounter>()) { auto fnAddCounter = [this](const char* name, TVector<NMonitoring::TDynamicCounters::TCounterPtr>& container) { - auto counter = CounterGroup->GetCounter(name, false); - container.push_back(counter); - }; - - CountersByTabletID.push_back(TCountersByTabletIDMap()); + auto counter = CounterGroup->GetCounter(name, false); + container.push_back(counter); + }; + + CountersByTabletID.push_back(TCountersByTabletIDMap()); ChangedCounters.push_back(true); TString maxName = Sprintf("MAX(%s)", name); TString sumName = Sprintf("SUM(%s)", name); - + fnAddCounter(maxName.data(), MaxSimpleCounters); fnAddCounter(sumName.data(), SumSimpleCounters); HistSimpleCounters.emplace_back(std::move(percentileAggregate)); - } + } ui64 GetSum(ui32 counterIndex) const { Y_VERIFY(counterIndex < SumSimpleCounters.size(), @@ -157,7 +157,7 @@ public: ChangedCounters[counterIndex] = true; } } - + void ForgetTablet(ui64 tabletId) { for (ui32 idx : xrange(CountersByTabletID.size())) { auto &counters = CountersByTabletID[idx]; @@ -165,7 +165,7 @@ public: ChangedCounters[idx] = true; } } - + void RecalcAll() { for (ui32 idx : xrange(CountersByTabletID.size())) { if (ChangedCounters[idx]) @@ -177,7 +177,7 @@ public: private: // NMonitoring::TDynamicCounterPtr CounterGroup; - + TCountersVector MaxSimpleCounters; TCountersVector SumSimpleCounters; THistogramVector HistSimpleCounters; @@ -191,27 +191,27 @@ private: auto &counters = CountersByTabletID[idx]; THistogramCounter* histCounter = HistSimpleCounters[idx].Get(); - ui64 maxVal = 0; - ui64 sumVal = 0; - + ui64 maxVal = 0; + ui64 sumVal = 0; + if (histCounter) { histCounter->Clear(); } for (auto&& t : counters) { ui64 tValue = t.second; - maxVal = Max(tValue, maxVal); - sumVal += tValue; + maxVal = Max(tValue, maxVal); + sumVal += tValue; if (histCounter) { histCounter->IncrementFor(tValue); } - } - + } + *MaxSimpleCounters[idx].Get() = maxVal; *SumSimpleCounters[idx].Get() = sumVal; - } -}; - + } +}; + class TAggregatedCumulativeCounters { public: // @@ -464,34 +464,34 @@ private: -} - -//////////////////////////////////////////// -class TTabletMon { -public: - // +} + +//////////////////////////////////////////// +class TTabletMon { +public: + // TTabletMon(NMonitoring::TDynamicCounterPtr counters, bool isFollower, TActorId dbWatcherActorId) : Counters(GetServiceCounters(counters, isFollower ? "followers" : "tablets")) - , AllTypes(Counters.Get(), "type", "all", true) + , AllTypes(Counters.Get(), "type", "all", true) , IsFollower(isFollower) , DbWatcherActorId(dbWatcherActorId) - { + { if (!IsFollower) { YdbCounters = MakeIntrusive<TYdbTabletCounters>(GetServiceCounters(counters, "ydb")); } - } - + } + void Apply(ui64 tabletID, TTabletTypes::EType tabletType, TPathId tenantPathId, const TTabletCountersBase* executorCounters, const TTabletCountersBase* appCounters, const TActorContext& ctx) { AllTypes.Apply(tabletID, executorCounters, nullptr, tabletType); - // + // auto* typeCounters = GetOrAddCountersByTabletType(tabletType, CountersByTabletType, Counters); if (typeCounters) { typeCounters->Apply(tabletID, executorCounters, appCounters, tabletType); - } - // + } + // if (!IsFollower && AppData(ctx)->FeatureFlags.GetEnableDbCounters() && tenantPathId) { auto dbCounters = GetDbCounters(tenantPathId, ctx); if (dbCounters) { @@ -514,8 +514,8 @@ public: quietStats.second = new TTabletCountersBase(); quietStats.second->Populate(*appCounters); } - } - + } + void ApplyLabeledCounters(ui64 tabletID, TTabletTypes::EType tabletType, const TTabletLabeledCountersBase* labeledCounters) { auto iterTabletType = LabeledCountersByTabletTypeAndGroup.find(std::make_pair(tabletType, labeledCounters->GetGroup())); @@ -579,8 +579,8 @@ public: TString tabletIdStr = Sprintf("%" PRIu64, tabletID); Counters->RemoveSubgroup("tabletid", tabletIdStr.data()); - } - + } + void Query(const NKikimrTabletCountersAggregator::TEvTabletCountersRequest& request, NKikimrTabletCountersAggregator::TEvTabletCountersResponse& response) { TVector<ui64> tabletIDs(request.GetTabletIds().begin(), request.GetTabletIds().end()); if (tabletIDs.empty()) { @@ -698,19 +698,19 @@ public: CountersByPathId.erase(pathId); } -private: - // subgroups - class TTabletCountersForTabletType { - public: - // - TTabletCountersForTabletType(NMonitoring::TDynamicCounters* owner, const char* category, const char* name, bool doAggregateSimpleCountrers) - : TabletCountersSection(owner->GetSubgroup(category, name)) - , TabletExecutorCountersSection(TabletCountersSection->GetSubgroup("category", "executor")) - , TabletAppCountersSection(TabletCountersSection->GetSubgroup("category", "app")) - , TabletExecutorCounters(TabletExecutorCountersSection, doAggregateSimpleCountrers) - , TabletAppCounters(TabletAppCountersSection, doAggregateSimpleCountrers) - {} - +private: + // subgroups + class TTabletCountersForTabletType { + public: + // + TTabletCountersForTabletType(NMonitoring::TDynamicCounters* owner, const char* category, const char* name, bool doAggregateSimpleCountrers) + : TabletCountersSection(owner->GetSubgroup(category, name)) + , TabletExecutorCountersSection(TabletCountersSection->GetSubgroup("category", "executor")) + , TabletAppCountersSection(TabletCountersSection->GetSubgroup("category", "app")) + , TabletExecutorCounters(TabletExecutorCountersSection, doAggregateSimpleCountrers) + , TabletAppCounters(TabletAppCountersSection, doAggregateSimpleCountrers) + {} + void Apply(ui64 tabletID, const TTabletCountersBase* executorCounters, const TTabletCountersBase* appCounters, @@ -718,22 +718,22 @@ private: const TTabletCountersBase* limitedAppCounters = {}) { Y_VERIFY(executorCounters); - + if (executorCounters) { if (!TabletExecutorCounters.IsInitialized) { TabletExecutorCounters.Initialize(executorCounters); } TabletExecutorCounters.Apply(tabletID, executorCounters, tabletType); } - + if (appCounters) { if (!TabletAppCounters.IsInitialized) { TabletAppCounters.Initialize(limitedAppCounters ? limitedAppCounters : appCounters); } TabletAppCounters.Apply(tabletID, appCounters, tabletType); } - } - + } + void Forget(ui64 tabletId) { if (TabletExecutorCounters.IsInitialized) { TabletExecutorCounters.Forget(tabletId); @@ -794,29 +794,29 @@ private: } } - private: - // + private: + // class TSolomonCounters { - public: - // + public: + // bool IsInitialized; TSolomonCounters(NMonitoring::TDynamicCounterPtr counterGroup, bool doAggregateCounters) - : IsInitialized(false) + : IsInitialized(false) , DoAggregateSimpleCounters(doAggregateCounters) - , AggregatedSimpleCounters(counterGroup) + , AggregatedSimpleCounters(counterGroup) , DoAggregateCumulativeCounters(doAggregateCounters) , AggregatedCumulativeCounters(counterGroup) - , CounterGroup(counterGroup) - {} - - void Initialize(const TTabletCountersBase* counters) { + , CounterGroup(counterGroup) + {} + + void Initialize(const TTabletCountersBase* counters) { Y_VERIFY(!IsInitialized); - - if (counters) { + + if (counters) { THashMap<TString, THolder<THistogramCounter>> histogramAggregates; - // percentile counters + // percentile counters FullSizePercentile = counters->Percentile().Size(); for (ui32 i = 0; i < FullSizePercentile; ++i) { if (!counters->PercentileCounterName(i)) { @@ -826,10 +826,10 @@ private: // old style PercentileCounters.push_back(TVector<NMonitoring::TDynamicCounters::TCounterPtr>()); - auto counterRBeginIter = PercentileCounters.rbegin(); - + auto counterRBeginIter = PercentileCounters.rbegin(); + auto& percentileCounter = counters->Percentile()[i]; - const char* percentileCounterName = counters->PercentileCounterName(i); + const char* percentileCounterName = counters->PercentileCounterName(i); TStringBuf counterName(percentileCounterName); TStringBuf simpleCounterName = GetHistogramAggregateSimpleName(counterName); bool histogramAggregate = !simpleCounterName.empty(); @@ -838,11 +838,11 @@ private: auto rangeCount = percentileCounter.GetRangeCount(); for (ui32 r = 0; r < rangeCount; ++r) { - const char* rangeName = percentileCounter.GetRangeName(r); + const char* rangeName = percentileCounter.GetRangeName(r); auto subgroup = CounterGroup->GetSubgroup("range", rangeName); auto counter = subgroup->GetCounter(percentileCounterName, isDerivative); - counterRBeginIter->push_back(counter); - } + counterRBeginIter->push_back(counter); + } // new style NMonitoring::TBucketBounds bucketBounds; @@ -857,7 +857,7 @@ private: histogramAggregates.emplace(simpleCounterName, new THistogramCounter( percentileCounter.GetRanges(), std::move(*counterRBeginIter), histogram)); } - } + } // simple counters FullSizeSimple = counters->Simple().Size(); @@ -899,15 +899,15 @@ private: auto counter = CounterGroup->GetCounter(name, true); CumulativeCounters.push_back(counter); } - } - - // - IsInitialized = true; - } - + } + + // + IsInitialized = true; + } + void Apply(ui64 tabletID, const TTabletCountersBase* counters, TTabletTypes::EType tabletType) { Y_VERIFY(counters); - + TInstant now = TInstant::Now(); auto it = LastAggregateUpdateTime.find(tabletID); TDuration diff; @@ -918,23 +918,23 @@ private: LastAggregateUpdateTime.emplace(tabletID, now); } - // simple counters + // simple counters ui32 nextSimpleOffset = 0; for (ui32 i = 0; i < FullSizeSimple; ++i) { if (!counters->SimpleCounterName(i)) { continue; } const ui32 offset = nextSimpleOffset++; - const ui64 value = counters->Simple()[i].Get(); - if (DoAggregateSimpleCounters) { + const ui64 value = counters->Simple()[i].Get(); + if (DoAggregateSimpleCounters) { AggregatedSimpleCounters.SetValue(tabletID, offset, value, tabletType); } else { Y_VERIFY(offset < SimpleCounters.size(), "inconsistent counters for tablet type %s", TTabletTypes::TypeToStr(tabletType)); *SimpleCounters[offset] = value; - } - } - - // cumulative counters + } + } + + // cumulative counters ui32 nextCumulativeOffset = 0; for (ui32 i = 0; i < FullSizeCumulative; ++i) { if (!counters->CumulativeCounterName(i)) { @@ -950,15 +950,15 @@ private: } Y_VERIFY(offset < CumulativeCounters.size(), "inconsistent counters for tablet type %s", TTabletTypes::TypeToStr(tabletType)); *CumulativeCounters[offset] += valueDiff; - } - - // percentile counters + } + + // percentile counters ui32 nextPercentileOffset = 0; for (ui32 i = 0; i < FullSizePercentile; ++i) { if (!counters->PercentileCounterName(i)) { continue; } - + const ui32 offset = nextPercentileOffset++; Y_VERIFY(offset < PercentileCounters.size(), "inconsistent counters for tablet type %s", TTabletTypes::TypeToStr(tabletType)); @@ -978,7 +978,7 @@ private: } else { *pcx[r] += percentileCounter.GetRangeValue(r); } - } + } if (rangeCount < 2) { continue; @@ -996,9 +996,9 @@ private: histogram->Collect( Max<NMonitoring::TBucketBound>(), percentileCounter.GetRangeValue(rangeCount - 1)); - } - } - + } + } + void Forget(ui64 tabletId) { Y_VERIFY(IsInitialized); @@ -1124,39 +1124,39 @@ private: Convert<false>(sumCounters, maxCounters); } - private: + private: ui32 FullSizeSimple = 0; THashSet<ui32> DeprecatedSimple; ui32 FullSizeCumulative = 0; THashSet<ui32> DeprecatedCumulative; ui32 FullSizePercentile = 0; THashSet<ui32> DeprecatedPercentile; - // - bool DoAggregateSimpleCounters; - TCountersVector SimpleCounters; + // + bool DoAggregateSimpleCounters; + TCountersVector SimpleCounters; TAggregatedSimpleCounters AggregatedSimpleCounters; - + bool DoAggregateCumulativeCounters; - TCountersVector CumulativeCounters; + TCountersVector CumulativeCounters; TAggregatedCumulativeCounters AggregatedCumulativeCounters; THashMap<ui64, TInstant> LastAggregateUpdateTime; TVector<TCountersVector> PercentileCounters; // old style TVector<NMonitoring::THistogramPtr> Histograms; // new style - - NMonitoring::TDynamicCounterPtr CounterGroup; - }; - - // - NMonitoring::TDynamicCounterPtr TabletCountersSection; - - NMonitoring::TDynamicCounterPtr TabletExecutorCountersSection; - NMonitoring::TDynamicCounterPtr TabletAppCountersSection; - + + NMonitoring::TDynamicCounterPtr CounterGroup; + }; + + // + NMonitoring::TDynamicCounterPtr TabletCountersSection; + + NMonitoring::TDynamicCounterPtr TabletExecutorCountersSection; + NMonitoring::TDynamicCounterPtr TabletAppCountersSection; + TSolomonCounters TabletExecutorCounters; TSolomonCounters TabletAppCounters; - }; - + }; + typedef TMap<TTabletTypes::EType, TAutoPtr<TTabletCountersForTabletType> > TCountersByTabletType; static TTabletCountersForTabletType* FindCountersByTabletType( @@ -1522,17 +1522,17 @@ private: } private: - // - NMonitoring::TDynamicCounterPtr Counters; - TTabletCountersForTabletType AllTypes; + // + NMonitoring::TDynamicCounterPtr Counters; + TTabletCountersForTabletType AllTypes; bool IsFollower = false; - + typedef THashMap<TPathId, TIntrusivePtr<TTabletCountersForDb>> TCountersByPathId; typedef TMap<TTabletTypes::EType, THolder<TTabletCountersBase>> TAppCountersByTabletType; - + typedef TMap<std::pair<TTabletTypes::EType, TString>, TAutoPtr<TAggregatedLabeledCounters> > TLabeledCountersByTabletTypeAndGroup; - TCountersByTabletType CountersByTabletType; + TCountersByTabletType CountersByTabletType; TCountersByPathId CountersByPathId; TActorId DbWatcherActorId; TAppCountersByTabletType LimitedAppCounters; // without txs @@ -1541,8 +1541,8 @@ private: TLabeledCountersByTabletTypeAndGroup LabeledCountersByTabletTypeAndGroup; THashMap<ui64, std::pair<TAutoPtr<TTabletCountersBase>, TAutoPtr<TTabletCountersBase>>> QuietTabletCounters; -}; - +}; + TIntrusivePtr<NSysView::IDbCounters> CreateTabletDbCounters( NMonitoring::TDynamicCounterPtr externalGroup, @@ -1553,29 +1553,29 @@ TIntrusivePtr<NSysView::IDbCounters> CreateTabletDbCounters( externalGroup, internalGroup, std::move(executorCounters)); } -//////////////////////////////////////////// -/// The TTabletCountersAggregatorActor class -//////////////////////////////////////////// -class TTabletCountersAggregatorActor : public TActorBootstrapped<TTabletCountersAggregatorActor> { -public: +//////////////////////////////////////////// +/// The TTabletCountersAggregatorActor class +//////////////////////////////////////////// +class TTabletCountersAggregatorActor : public TActorBootstrapped<TTabletCountersAggregatorActor> { +public: static constexpr NKikimrServices::TActivity::EType ActorActivityType() { return NKikimrServices::TActivity::TABLET_COUNTERS_AGGREGATOR; } - // + // TTabletCountersAggregatorActor(bool follower); - virtual ~TTabletCountersAggregatorActor(); - - // - void Bootstrap(const TActorContext &ctx); - - // - STFUNC(StateWork); - -private: - // - void HandleWork(TEvTabletCounters::TEvTabletAddCounters::TPtr &ev, const TActorContext &ctx); - void HandleWork(TEvTabletCounters::TEvTabletCountersForgetTablet::TPtr &ev, const TActorContext &ctx); + virtual ~TTabletCountersAggregatorActor(); + + // + void Bootstrap(const TActorContext &ctx); + + // + STFUNC(StateWork); + +private: + // + void HandleWork(TEvTabletCounters::TEvTabletAddCounters::TPtr &ev, const TActorContext &ctx); + void HandleWork(TEvTabletCounters::TEvTabletCountersForgetTablet::TPtr &ev, const TActorContext &ctx); void HandleWork(TEvTabletCounters::TEvTabletCountersRequest::TPtr &ev, const TActorContext &ctx); void HandleWork(TEvTabletCounters::TEvTabletAddLabeledCounters::TPtr &ev, const TActorContext &ctx); void HandleWork(TEvTabletCounters::TEvTabletLabeledCountersRequest::TPtr &ev, const TActorContext &ctx); @@ -1583,32 +1583,32 @@ private: void HandleWork(NMon::TEvHttpInfo::TPtr& ev, const TActorContext &ctx); void HandleWakeup(const TActorContext &ctx); void HandleWork(TEvTabletCounters::TEvRemoveDatabase::TPtr& ev); - - // - TAutoPtr<TTabletMon> TabletMon; + + // + TAutoPtr<TTabletMon> TabletMon; TActorId DbWatcherActorId; THashMap<TActorId, std::pair<TActorId, TAutoPtr<NMon::TEvHttpInfo>>> HttpRequestHandlers; THashSet<ui32> TabletTypeOfReceivedLabeledCounters; bool Follower; -}; - -//////////////////////////////////////////// -/// The TTabletCountersAggregatorActor class -//////////////////////////////////////////// +}; + +//////////////////////////////////////////// +/// The TTabletCountersAggregatorActor class +//////////////////////////////////////////// TTabletCountersAggregatorActor::TTabletCountersAggregatorActor(bool follower) : Follower(follower) {} - -//////////////////////////////////////////// -TTabletCountersAggregatorActor::~TTabletCountersAggregatorActor() -{} - -//////////////////////////////////////////// -void -TTabletCountersAggregatorActor::Bootstrap(const TActorContext &ctx) { - Become(&TThis::StateWork); - - TAppData* appData = AppData(ctx); + +//////////////////////////////////////////// +TTabletCountersAggregatorActor::~TTabletCountersAggregatorActor() +{} + +//////////////////////////////////////////// +void +TTabletCountersAggregatorActor::Bootstrap(const TActorContext &ctx) { + Become(&TThis::StateWork); + + TAppData* appData = AppData(ctx); Y_VERIFY(!TabletMon); if (AppData(ctx)->FeatureFlags.GetEnableDbCounters() && !Follower) { @@ -1626,19 +1626,19 @@ TTabletCountersAggregatorActor::Bootstrap(const TActorContext &ctx) { } ctx.Schedule(TDuration::Seconds(WAKEUP_TIMEOUT_SECONDS), new TEvents::TEvWakeup()); -} - +} + -//////////////////////////////////////////// -void -TTabletCountersAggregatorActor::HandleWork(TEvTabletCounters::TEvTabletAddCounters::TPtr &ev, const TActorContext &ctx) { +//////////////////////////////////////////// +void +TTabletCountersAggregatorActor::HandleWork(TEvTabletCounters::TEvTabletAddCounters::TPtr &ev, const TActorContext &ctx) { Y_UNUSED(ctx); - TEvTabletCounters::TEvTabletAddCounters* msg = ev->Get(); + TEvTabletCounters::TEvTabletAddCounters* msg = ev->Get(); TabletMon->Apply(msg->TabletID, msg->TabletType, msg->TenantPathId, msg->ExecutorCounters.Get(), msg->AppCounters.Get(), ctx); -} - -//////////////////////////////////////////// -void +} + +//////////////////////////////////////////// +void TTabletCountersAggregatorActor::HandleWork(TEvTabletCounters::TEvTabletAddLabeledCounters::TPtr &ev, const TActorContext &ctx) { TEvTabletCounters::TEvTabletAddLabeledCounters* msg = ev->Get(); LOG_DEBUG_S(ctx, NKikimrServices::TABLET_AGGREGATOR, "got labeledCounters from tablet " << msg->TabletID); @@ -1649,13 +1649,13 @@ TTabletCountersAggregatorActor::HandleWork(TEvTabletCounters::TEvTabletAddLabele //////////////////////////////////////////// void -TTabletCountersAggregatorActor::HandleWork(TEvTabletCounters::TEvTabletCountersForgetTablet::TPtr &ev, const TActorContext &ctx) { +TTabletCountersAggregatorActor::HandleWork(TEvTabletCounters::TEvTabletCountersForgetTablet::TPtr &ev, const TActorContext &ctx) { Y_UNUSED(ctx); - TEvTabletCounters::TEvTabletCountersForgetTablet* msg = ev->Get(); + TEvTabletCounters::TEvTabletCountersForgetTablet* msg = ev->Get(); TabletMon->ForgetTablet(msg->TabletID, msg->TabletType, msg->TenantPathId); -} - -//////////////////////////////////////////// +} + +//////////////////////////////////////////// void TTabletCountersAggregatorActor::HandleWork(TEvTabletCounters::TEvTabletCountersRequest::TPtr &ev, const TActorContext &ctx) { TEvTabletCounters::TEvTabletCountersRequest* msg = ev->Get(); @@ -1828,13 +1828,13 @@ TTabletCountersAggregatorActor::HandleWakeup(const TActorContext &ctx) { } //////////////////////////////////////////// -/// public state functions -//////////////////////////////////////////// -STFUNC(TTabletCountersAggregatorActor::StateWork) { +/// public state functions +//////////////////////////////////////////// +STFUNC(TTabletCountersAggregatorActor::StateWork) { Y_UNUSED(ctx); - switch (ev->GetTypeRewrite()) { - HFunc(TEvTabletCounters::TEvTabletAddCounters, HandleWork); - HFunc(TEvTabletCounters::TEvTabletCountersForgetTablet, HandleWork); + switch (ev->GetTypeRewrite()) { + HFunc(TEvTabletCounters::TEvTabletAddCounters, HandleWork); + HFunc(TEvTabletCounters::TEvTabletCountersForgetTablet, HandleWork); HFunc(TEvTabletCounters::TEvTabletCountersRequest, HandleWork); HFunc(TEvTabletCounters::TEvTabletAddLabeledCounters, HandleWork); HFunc(TEvTabletCounters::TEvTabletLabeledCountersRequest, HandleWork); @@ -1843,24 +1843,24 @@ STFUNC(TTabletCountersAggregatorActor::StateWork) { HFunc(NMon::TEvHttpInfo, HandleWork); CFunc(TEvents::TSystem::Wakeup, HandleWakeup); - // HFunc(TEvents::TEvPoisonPill, Handle); // we do not need PoisonPill for the actor - } -} - -//////////////////////////////////////////// + // HFunc(TEvents::TEvPoisonPill, Handle); // we do not need PoisonPill for the actor + } +} + +//////////////////////////////////////////// static ui32 AGGREGATOR_TIMEOUT_SECONDS = 60; -IActor* +IActor* CreateTabletCountersAggregator(bool follower) { return new TTabletCountersAggregatorActor(follower); -} - +} + void TabletCountersForgetTablet(ui64 tabletId, TTabletTypes::EType tabletType, TPathId tenantPathId, bool follower, TActorIdentity identity) { const TActorId countersAggregator = MakeTabletCountersAggregatorID(identity.NodeId(), follower); identity.Send(countersAggregator, new TEvTabletCounters::TEvTabletCountersForgetTablet(tabletId, tabletType, tenantPathId)); } - + /////////////////////////////////////////// TString ReplaceDelimiter(const TString& groups) { diff --git a/ydb/core/tablet/tablet_counters_aggregator.h b/ydb/core/tablet/tablet_counters_aggregator.h index db350d41cb..9c1957bd51 100644 --- a/ydb/core/tablet/tablet_counters_aggregator.h +++ b/ydb/core/tablet/tablet_counters_aggregator.h @@ -1,67 +1,67 @@ -#pragma once - -//////////////////////////////////////////// -#include "defs.h" +#pragma once + +//////////////////////////////////////////// +#include "defs.h" #include "tablet_counters.h" - + #include <library/cpp/actors/core/defs.h> #include <library/cpp/actors/core/actor.h> #include <library/cpp/actors/core/event.h> - + #include <ydb/core/base/blobstorage.h> #include <ydb/core/protos/tablet_counters_aggregator.pb.h> #include <ydb/core/sys_view/common/events.h> - -//////////////////////////////////////////// -namespace NKikimr { - -//////////////////////////////////////////// + +//////////////////////////////////////////// +namespace NKikimr { + +//////////////////////////////////////////// TActorId MakeTabletCountersAggregatorID(ui32 node, bool follower = false); - + static const ui32 WORKERS_COUNT = 0; -//////////////////////////////////////////// -struct TEvTabletCounters { - // - enum EEv { - EvTabletAddCounters = EventSpaceBegin(TKikimrEvents::ES_TABLET_COUNTERS_AGGREGATOR), +//////////////////////////////////////////// +struct TEvTabletCounters { + // + enum EEv { + EvTabletAddCounters = EventSpaceBegin(TKikimrEvents::ES_TABLET_COUNTERS_AGGREGATOR), EvDeprecated1, - EvTabletCountersForgetTablet, + EvTabletCountersForgetTablet, EvTabletCountersRequest, EvTabletCountersResponse, EvTabletAddLabeledCounters, EvTabletLabeledCountersRequest, EvTabletLabeledCountersResponse, EvRemoveDatabase, - EvEnd - }; - - static_assert(EvEnd < EventSpaceEnd(TKikimrEvents::ES_TABLET_COUNTERS_AGGREGATOR), "expect EvEnd < EventSpaceEnd(TKikimrEvents::ES_TABLET_COUNTERS)"); - + EvEnd + }; + + static_assert(EvEnd < EventSpaceEnd(TKikimrEvents::ES_TABLET_COUNTERS_AGGREGATOR), "expect EvEnd < EventSpaceEnd(TKikimrEvents::ES_TABLET_COUNTERS)"); + // Used just as an atomic counter struct TInFlightCookie : TThrRefBase {}; - struct TEvTabletAddCounters : public TEventLocal<TEvTabletAddCounters, EvTabletAddCounters> { - // + struct TEvTabletAddCounters : public TEventLocal<TEvTabletAddCounters, EvTabletAddCounters> { + // const ui64 TabletID; const TTabletTypes::EType TabletType; const TPathId TenantPathId; - TAutoPtr<TTabletCountersBase> ExecutorCounters; - TAutoPtr<TTabletCountersBase> AppCounters; + TAutoPtr<TTabletCountersBase> ExecutorCounters; + TAutoPtr<TTabletCountersBase> AppCounters; TIntrusivePtr<TInFlightCookie> InFlightCounter; // Used to detect when previous event has been consumed by the aggregator - + TEvTabletAddCounters(TIntrusivePtr<TInFlightCookie> inFlightCounter, ui64 tabletID, TTabletTypes::EType tabletType, TPathId tenantPathId, TAutoPtr<TTabletCountersBase> executorCounters, TAutoPtr<TTabletCountersBase> appCounters) - : TabletID(tabletID) - , TabletType(tabletType) + : TabletID(tabletID) + , TabletType(tabletType) , TenantPathId(tenantPathId) - , ExecutorCounters(executorCounters) - , AppCounters(appCounters) + , ExecutorCounters(executorCounters) + , AppCounters(appCounters) , InFlightCounter(inFlightCounter) - {} - }; - + {} + }; + struct TEvTabletAddLabeledCounters : public TEventLocal<TEvTabletAddLabeledCounters, EvTabletAddLabeledCounters> { // const ui64 TabletID; @@ -76,20 +76,20 @@ struct TEvTabletCounters { {} }; - // - struct TEvTabletCountersForgetTablet : public TEventLocal<TEvTabletCountersForgetTablet, EvTabletCountersForgetTablet> { - // + // + struct TEvTabletCountersForgetTablet : public TEventLocal<TEvTabletCountersForgetTablet, EvTabletCountersForgetTablet> { + // const ui64 TabletID; const TTabletTypes::EType TabletType; const TPathId TenantPathId; - + TEvTabletCountersForgetTablet(ui64 tabletID, TTabletTypes::EType tabletType, TPathId tenantPathId) - : TabletID(tabletID) + : TabletID(tabletID) , TabletType(tabletType) , TenantPathId(tenantPathId) - {} - }; - + {} + }; + // struct TEvTabletCountersRequest : public TEventPB<TEvTabletCountersRequest, NKikimrTabletCountersAggregator::TEvTabletCountersRequest, EvTabletCountersRequest> { }; @@ -112,15 +112,15 @@ struct TEvTabletCounters { {} }; -}; - -//////////////////////////////////////////// +}; + +//////////////////////////////////////////// void TabletCountersForgetTablet(ui64 tabletId, TTabletTypes::EType tabletType, TPathId tenantPathId, bool follower, TActorIdentity identity); TStringBuf GetHistogramAggregateSimpleName(TStringBuf name); bool IsHistogramAggregateSimpleName(TStringBuf name); - -//////////////////////////////////////////// + +//////////////////////////////////////////// TIntrusivePtr<NSysView::IDbCounters> CreateTabletDbCounters( NMonitoring::TDynamicCounterPtr externalGroup, NMonitoring::TDynamicCounterPtr internalGroup, @@ -128,7 +128,7 @@ TIntrusivePtr<NSysView::IDbCounters> CreateTabletDbCounters( //////////////////////////////////////////// IActor* CreateTabletCountersAggregator(bool follower); - + //////////////////////////////////////////// //will create actor that aggregate LabeledCounters from all nodes and reports them as TEvTabletLabeledCountersResponse to parentActor @@ -145,5 +145,5 @@ IActor* CreateClusterLabeledCountersAggregatorActor( ui32 version = 1, const TString& group = TString(), const ui32 TotalWorkersCount = WORKERS_COUNT); -} // end of the NKikimr namespace - +} // end of the NKikimr namespace + diff --git a/ydb/core/tablet/tablet_exception.h b/ydb/core/tablet/tablet_exception.h index b2d7f655bf..d905075308 100644 --- a/ydb/core/tablet/tablet_exception.h +++ b/ydb/core/tablet/tablet_exception.h @@ -1,22 +1,22 @@ -#pragma once - -#include "defs.h" - -//////////////////////////////////////////// -namespace NKikimr { - -//////////////////////////////////////////// -/// The TTabletException class -//////////////////////////////////////////// +#pragma once + +#include "defs.h" + +//////////////////////////////////////////// +namespace NKikimr { + +//////////////////////////////////////////// +/// The TTabletException class +//////////////////////////////////////////// #define TABLET_EXCEPTION(TExcName) \ class TExcName : public yexception {}; - + TABLET_EXCEPTION(TNotReadyTabletException) TABLET_EXCEPTION(TNotExistTabletException) TABLET_EXCEPTION(TSchemeErrorTabletException) -TABLET_EXCEPTION(TTooLongTxException) - +TABLET_EXCEPTION(TTooLongTxException) + #undef TABLET_EXCEPTION - -} // end of the NKikimr namespace - + +} // end of the NKikimr namespace + diff --git a/ydb/core/tablet/tablet_monitoring_proxy.cpp b/ydb/core/tablet/tablet_monitoring_proxy.cpp index a61a43b7e5..f72448fc93 100644 --- a/ydb/core/tablet/tablet_monitoring_proxy.cpp +++ b/ydb/core/tablet/tablet_monitoring_proxy.cpp @@ -1,5 +1,5 @@ -#include "tablet_monitoring_proxy.h" - +#include "tablet_monitoring_proxy.h" + #include <library/cpp/actors/core/log.h> #include <ydb/core/mon/mon.h> #include <library/cpp/actors/core/mon.h> @@ -12,10 +12,10 @@ #include <ydb/core/tx/tx.h> #include <library/cpp/monlib/service/pages/templates.h> #include <util/string/builder.h> - -//////////////////////////////////////////// -namespace NKikimr { namespace NTabletMonitoringProxy { - + +//////////////////////////////////////////// +namespace NKikimr { namespace NTabletMonitoringProxy { + namespace { class TForwardingActor : public TActorBootstrapped<TForwardingActor> { @@ -121,54 +121,54 @@ private: } -//////////////////////////////////////////// -class TTabletMonitoringProxyActor : public TActorBootstrapped<TTabletMonitoringProxyActor> { -public: +//////////////////////////////////////////// +class TTabletMonitoringProxyActor : public TActorBootstrapped<TTabletMonitoringProxyActor> { +public: static constexpr NKikimrServices::TActivity::EType ActorActivityType() { return NKikimrServices::TActivity::TABLET_MONITORING_PROXY; } - // + // TTabletMonitoringProxyActor(TTabletMonitoringProxyConfig config); - virtual ~TTabletMonitoringProxyActor(); - - // - void Bootstrap(const TActorContext &ctx); - - // - STFUNC(StateWork); - -private: - // - void Handle(NMon::TEvHttpInfo::TPtr &ev, const TActorContext &ctx); + virtual ~TTabletMonitoringProxyActor(); + + // + void Bootstrap(const TActorContext &ctx); + + // + STFUNC(StateWork); + +private: + // + void Handle(NMon::TEvHttpInfo::TPtr &ev, const TActorContext &ctx); private: TTabletMonitoringProxyConfig Config; -}; - -//////////////////////////////////////////// -/// The TTabletMonitoringProxyActor class -//////////////////////////////////////////// +}; + +//////////////////////////////////////////// +/// The TTabletMonitoringProxyActor class +//////////////////////////////////////////// TTabletMonitoringProxyActor::TTabletMonitoringProxyActor(TTabletMonitoringProxyConfig config) : Config(std::move(config)) {} - -//////////////////////////////////////////// -TTabletMonitoringProxyActor::~TTabletMonitoringProxyActor() -{} - -//////////////////////////////////////////// -void -TTabletMonitoringProxyActor::Bootstrap(const TActorContext &ctx) { - Become(&TThis::StateWork); - - NActors::TMon* mon = AppData(ctx)->Mon; - - if (mon) { - mon->RegisterActorPage(nullptr, "tablets", "Tablets", false, ctx.ExecutorThread.ActorSystem, ctx.SelfID); - } -} - + +//////////////////////////////////////////// +TTabletMonitoringProxyActor::~TTabletMonitoringProxyActor() +{} + +//////////////////////////////////////////// +void +TTabletMonitoringProxyActor::Bootstrap(const TActorContext &ctx) { + Become(&TThis::StateWork); + + NActors::TMon* mon = AppData(ctx)->Mon; + + if (mon) { + mon->RegisterActorPage(nullptr, "tablets", "Tablets", false, ctx.ExecutorThread.ActorSystem, ctx.SelfID); + } +} + static ui64 TryParseTabletId(TStringBuf tabletIdParam) { if (tabletIdParam.StartsWith("0x")) { ui64 result = 0; @@ -179,13 +179,13 @@ static ui64 TryParseTabletId(TStringBuf tabletIdParam) { } } -//////////////////////////////////////////// -void -TTabletMonitoringProxyActor::Handle(NMon::TEvHttpInfo::TPtr &ev, const TActorContext &ctx) { - // - NMon::TEvHttpInfo* msg = ev->Get(); +//////////////////////////////////////////// +void +TTabletMonitoringProxyActor::Handle(NMon::TEvHttpInfo::TPtr &ev, const TActorContext &ctx) { + // + NMon::TEvHttpInfo* msg = ev->Get(); const TCgiParameters* cgi; - + if (msg->Request.GetMethod() == HTTP_METHOD_POST) { cgi = &msg->Request.GetPostParams(); } else { @@ -213,7 +213,7 @@ TTabletMonitoringProxyActor::Handle(NMon::TEvHttpInfo::TPtr &ev, const TActorCon } bool hasIdParam = cgi->Has("TabletID"); - if (hasIdParam) { + if (hasIdParam) { const TString &tabletIdParam = cgi->Get("TabletID"); const ui64 tabletId = TryParseTabletId(tabletIdParam); if (tabletId) { @@ -221,7 +221,7 @@ TTabletMonitoringProxyActor::Handle(NMon::TEvHttpInfo::TPtr &ev, const TActorCon ctx.ExecutorThread.RegisterActor(new TForwardingActor(Config, tabletId, false, ev->Sender, std::move(url), msg->Request.GetMethod())); return; } - } + } if (cgi->Has("SsId")) { const TString &ssIdParam = cgi->Get("SsId"); @@ -382,24 +382,24 @@ TTabletMonitoringProxyActor::Handle(NMon::TEvHttpInfo::TPtr &ev, const TActorCon str << "</form>" << Endl; } ctx.Send(ev->Sender, new NMon::TEvHttpInfoRes(str.Str())); -} - -//////////////////////////////////////////// -/// public state functions -//////////////////////////////////////////// -STFUNC(TTabletMonitoringProxyActor::StateWork) { - switch (ev->GetTypeRewrite()) { - HFunc(NMon::TEvHttpInfo, Handle); - - // HFunc(TEvents::TEvPoisonPill, Handle); // we do not need PoisonPill for the actor - } -} - -//////////////////////////////////////////// -/// actor make function -//////////////////////////////////////////// +} + +//////////////////////////////////////////// +/// public state functions +//////////////////////////////////////////// +STFUNC(TTabletMonitoringProxyActor::StateWork) { + switch (ev->GetTypeRewrite()) { + HFunc(NMon::TEvHttpInfo, Handle); + + // HFunc(TEvents::TEvPoisonPill, Handle); // we do not need PoisonPill for the actor + } +} + +//////////////////////////////////////////// +/// actor make function +//////////////////////////////////////////// IActor* CreateTabletMonitoringProxy(TTabletMonitoringProxyConfig config) { return new TTabletMonitoringProxyActor(std::move(config)); -} - -} } // end of the NKikimr::NCompactionService namespace +} + +} } // end of the NKikimr::NCompactionService namespace diff --git a/ydb/core/tablet/tablet_monitoring_proxy.h b/ydb/core/tablet/tablet_monitoring_proxy.h index 07fd7888db..f6c2aa0f1c 100644 --- a/ydb/core/tablet/tablet_monitoring_proxy.h +++ b/ydb/core/tablet/tablet_monitoring_proxy.h @@ -1,18 +1,18 @@ -#pragma once - -//////////////////////////////////////////// -#include "defs.h" - +#pragma once + +//////////////////////////////////////////// +#include "defs.h" + #include <library/cpp/actors/core/defs.h> #include <library/cpp/actors/core/actor.h> #include <library/cpp/actors/core/event.h> - + #include <ydb/core/base/blobstorage.h> #include <ydb/core/base/tablet_pipe.h> - -//////////////////////////////////////////// -namespace NKikimr { namespace NTabletMonitoringProxy { - + +//////////////////////////////////////////// +namespace NKikimr { namespace NTabletMonitoringProxy { + struct TTabletMonitoringProxyConfig { bool PreferLocal = true; NTabletPipe::TClientRetryPolicy RetryPolicy; @@ -22,14 +22,14 @@ struct TTabletMonitoringProxyConfig { } }; -// +// inline TActorId MakeTabletMonitoringProxyID(ui32 node = 0) { - char x[12] = {'t','a','b','l','m','o','n','p','r','o','x','y'}; + char x[12] = {'t','a','b','l','m','o','n','p','r','o','x','y'}; return TActorId(node, TStringBuf(x, 12)); -} - -// +} + +// IActor* CreateTabletMonitoringProxy(TTabletMonitoringProxyConfig config = TTabletMonitoringProxyConfig()); - -} } // end of the NKikimr::NCompactionService namespace - + +} } // end of the NKikimr::NCompactionService namespace + diff --git a/ydb/core/tablet/tablet_req_rebuildhistory.cpp b/ydb/core/tablet/tablet_req_rebuildhistory.cpp index c0b4c0c2bc..6675de7e2c 100644 --- a/ydb/core/tablet/tablet_req_rebuildhistory.cpp +++ b/ydb/core/tablet/tablet_req_rebuildhistory.cpp @@ -4,12 +4,12 @@ #include <ydb/core/tablet/tablet_metrics.h> #include <util/generic/map.h> #include <util/generic/set.h> -#include <util/string/builder.h> +#include <util/string/builder.h> #include <library/cpp/actors/core/log.h> #include <ydb/core/protos/services.pb.h> #include <google/protobuf/text_format.h> - + #include "tablet_tracing_signals.h" #if defined BLOG_D || defined BLOG_I || defined BLOG_ERROR @@ -333,7 +333,7 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil LOG_DEBUG(*TlsActivationContext, NKikimrServices::TABLET_MAIN, [&](){ TStringBuilder sb; - sb << "TTabletReqRebuildHistoryGraph::ProcessLogEntry - TabletID: " << id.TabletID() << ", id " << id + sb << "TTabletReqRebuildHistoryGraph::ProcessLogEntry - TabletID: " << id.TabletID() << ", id " << id << ", refs: ["; for (auto&& t : logEntry.GetReferences()) @@ -651,16 +651,16 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil if (satisfied) { entry.Status = TLogEntry::StatusOk; - + LOG_DEBUG(*TlsActivationContext, NKikimrServices::TABLET_MAIN, [&](){ - TStringBuilder sb; + TStringBuilder sb; sb << "TTabletReqRebuildHistoryGraph::BuildHistory - THE TAIL - "; - - sb << "References: ["; + + sb << "References: ["; for (auto&& t : entry.References) sb << t.ToString() << ","; sb << "] for " << Info->TabletID; - + if (entry.GcDiscovered) { sb << ", Gc+: ["; for (auto&& t : entry.GcDiscovered) @@ -676,8 +676,8 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil } return (TString) sb; - }()); - + }()); + if (entry.EmbeddedLogBody) graph->AddEntry(id, entry.EmbeddedLogBody, entry.GcDiscovered, entry.GcLeft); else @@ -702,20 +702,20 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil if (step <= gx.Cutoff) { switch (entry.Status) { case TLogEntry::StatusOk: - + LOG_DEBUG(*TlsActivationContext, NKikimrServices::TABLET_MAIN, [&](){ - TStringBuilder sb; + TStringBuilder sb; sb << "TTabletReqRebuildHistoryGraph::BuildHistory - NOT A TAIL - "; - sb << "References: ["; - for (auto&& t : entry.References) { - sb << t.ToString(); - sb << ","; - } + sb << "References: ["; + for (auto&& t : entry.References) { + sb << t.ToString(); + sb << ","; + } sb << "] for " << Info->TabletID; - + return (TString) sb; - }()); - + }()); + if (entry.EmbeddedLogBody) graph->AddEntry(id, entry.EmbeddedLogBody, entry.GcDiscovered, entry.GcLeft); else diff --git a/ydb/core/tablet/tablet_req_writelog.cpp b/ydb/core/tablet/tablet_req_writelog.cpp index 7c4d02c405..7bf01e3431 100644 --- a/ydb/core/tablet/tablet_req_writelog.cpp +++ b/ydb/core/tablet/tablet_req_writelog.cpp @@ -43,7 +43,7 @@ class TTabletReqWriteLog : public TActorBootstrapped<TTabletReqWriteLog> { switch (msg->Status) { case NKikimrProto::OK: LOG_DEBUG_S(ctx, NKikimrServices::TABLET_MAIN, "Put Result: " << msg->Print(false)); - + GroupWrittenBytes[std::make_pair(msg->Id.Channel(), msg->GroupId)] += msg->Id.BlobSize(); GroupWrittenOps[std::make_pair(msg->Id.Channel(), msg->GroupId)] += 1; @@ -121,11 +121,11 @@ public: // todo: adaptive save-with-retry and timeouts // todo: cancelation - + const auto handleClass = NKikimrBlobStorage::TabletLog; for (const auto &ref : References) SendToBS(ref.Id, ref.Buffer, ctx, handleClass); - + const TLogoBlobID actualLogEntryId = TLogoBlobID( LogEntryID.TabletID(), LogEntryID.Generation(), diff --git a/ydb/core/tablet/tablet_sys.cpp b/ydb/core/tablet/tablet_sys.cpp index 44bfac7b2d..8e5deaa186 100644 --- a/ydb/core/tablet/tablet_sys.cpp +++ b/ydb/core/tablet/tablet_sys.cpp @@ -1613,7 +1613,7 @@ void TTablet::HandleStopped() { void TTablet::HandlePoisonPill() { return CancelTablet(TEvTablet::TEvTabletDead::ReasonPill); } - + void TTablet::HandleDemoted() { StopTablet(TEvTablet::TEvTabletStop::ReasonDemoted, TEvTablet::TEvTabletDead::ReasonDemotedByStateStorage); } diff --git a/ydb/core/tablet/ut/ya.make b/ydb/core/tablet/ut/ya.make index 52440600e1..6c4cfc5c3a 100644 --- a/ydb/core/tablet/ut/ya.make +++ b/ydb/core/tablet/ut/ya.make @@ -1,5 +1,5 @@ UNITTEST_FOR(ydb/core/tablet) - + OWNER( vvvv g:kikimr @@ -13,16 +13,16 @@ TIMEOUT(600) SPLIT_FACTOR(50) -PEERDIR( +PEERDIR( library/cpp/getopt library/cpp/regex/pcre library/cpp/svnversion ydb/core/testlib -) - +) + YQL_LAST_ABI_VERSION() -SRCS( +SRCS( pipe_tracker_ut.cpp resource_broker_ut.cpp tablet_counters_aggregator_ut.cpp @@ -31,6 +31,6 @@ SRCS( tablet_pipecache_ut.cpp tablet_req_blockbs_ut.cpp tablet_resolver_ut.cpp -) - -END() +) + +END() diff --git a/ydb/core/tablet/ya.make b/ydb/core/tablet/ya.make index 25e611b408..5805ad87f5 100644 --- a/ydb/core/tablet/ya.make +++ b/ydb/core/tablet/ya.make @@ -18,8 +18,8 @@ SRCS( resource_broker_impl.h tablet_counters.cpp tablet_counters.h - tablet_counters_aggregator.cpp - tablet_counters_aggregator.h + tablet_counters_aggregator.cpp + tablet_counters_aggregator.h tablet_counters_app.cpp tablet_counters_app.h tablet_counters_protobuf.h @@ -31,8 +31,8 @@ SRCS( tablet_list_renderer.h tablet_metrics.h tablet_metrics.cpp - tablet_monitoring_proxy.cpp - tablet_monitoring_proxy.h + tablet_monitoring_proxy.cpp + tablet_monitoring_proxy.h tablet_pipecache.cpp tablet_pipe_client.cpp tablet_pipe_client_cache.cpp diff --git a/ydb/core/testlib/tablet_helpers.cpp b/ydb/core/testlib/tablet_helpers.cpp index a853040b93..67b6112891 100644 --- a/ydb/core/testlib/tablet_helpers.cpp +++ b/ydb/core/testlib/tablet_helpers.cpp @@ -26,7 +26,7 @@ #include <ydb/core/tx/time_cast/time_cast.h> #include <ydb/core/persqueue/pq_l2_service.h> #include <ydb/core/util/console.h> - + #include <google/protobuf/text_format.h> #include <util/folder/dirut.h> diff --git a/ydb/core/tx/coordinator/coordinator.h b/ydb/core/tx/coordinator/coordinator.h index e7a76df3ce..0653b35e63 100644 --- a/ydb/core/tx/coordinator/coordinator.h +++ b/ydb/core/tx/coordinator/coordinator.h @@ -4,7 +4,7 @@ #include <ydb/core/util/queue_oneone_inplace.h> #include <util/generic/bitmap.h> #include <util/generic/set.h> -#include <util/generic/hash.h> +#include <util/generic/hash.h> #include <util/generic/map.h> #include <util/generic/hash_set.h> diff --git a/ydb/core/tx/coordinator/coordinator_impl.cpp b/ydb/core/tx/coordinator/coordinator_impl.cpp index b4eeb184e2..baf365ddb9 100644 --- a/ydb/core/tx/coordinator/coordinator_impl.cpp +++ b/ydb/core/tx/coordinator/coordinator_impl.cpp @@ -62,7 +62,7 @@ TTxCoordinator::TTxCoordinator(TTabletStorageInfo *info, const TActorId &tablet) #endif Config.PlanAhead = 50; - Config.Resolution = 1250; + Config.Resolution = 1250; Config.RapidSlotFlushSize = 1000; // todo: something meaningful MonCounters.CurrentTxInFly = 0; diff --git a/ydb/core/util/blob_data_stream.h b/ydb/core/util/blob_data_stream.h index dac5c0234b..419af38fba 100644 --- a/ydb/core/util/blob_data_stream.h +++ b/ydb/core/util/blob_data_stream.h @@ -1,205 +1,205 @@ -#pragma once - -#include "defs.h" - -#include <util/generic/buffer.h> - -//////////////////////////////////////////// -namespace NKikimr { - -//////////////////////////////////////////// -class TFlatBlobDataInputStream { -public: - // - TFlatBlobDataInputStream() {} - TFlatBlobDataInputStream(const TStringBuf& buffer) - : Buffer(buffer) - {} - ~TFlatBlobDataInputStream() {} - - // - const void* ReadAt(ui32 offset, ui32 size) const { +#pragma once + +#include "defs.h" + +#include <util/generic/buffer.h> + +//////////////////////////////////////////// +namespace NKikimr { + +//////////////////////////////////////////// +class TFlatBlobDataInputStream { +public: + // + TFlatBlobDataInputStream() {} + TFlatBlobDataInputStream(const TStringBuf& buffer) + : Buffer(buffer) + {} + ~TFlatBlobDataInputStream() {} + + // + const void* ReadAt(ui32 offset, ui32 size) const { Y_VERIFY_DEBUG(Buffer.size() >= offset + size); Y_UNUSED(size); - + return Buffer.data() + offset; - } - - // - template<typename T> - const T* ReadAt(ui32 offset) const { - return (const T*)ReadAt(offset, sizeof(T)); - } - -private: - // - TStringBuf Buffer; -}; - -//////////////////////////////////////////// -class TFlatBlobDataOutputStream { -public: - // - TFlatBlobDataOutputStream() - {} + } + + // + template<typename T> + const T* ReadAt(ui32 offset) const { + return (const T*)ReadAt(offset, sizeof(T)); + } + +private: + // + TStringBuf Buffer; +}; + +//////////////////////////////////////////// +class TFlatBlobDataOutputStream { +public: + // + TFlatBlobDataOutputStream() + {} TFlatBlobDataOutputStream(TString bufferToGrab) - : Buffer(bufferToGrab) - {} - ~TFlatBlobDataOutputStream() {} - - // IBlobDataStream intarface - ui32 GetCurrentOffset() const { + : Buffer(bufferToGrab) + {} + ~TFlatBlobDataOutputStream() {} + + // IBlobDataStream intarface + ui32 GetCurrentOffset() const { return Buffer.size(); - } - - template<typename T> - void WritePOD(const T& dt) { - Write((const char*)&dt, (ui32)sizeof(T)); - } - - void Write(const char* data, ui32 size) { - Buffer.AppendNoAlias(data, size); - } - - void WriteAtPosition(ui32 position, const char* data, ui32 size) { + } + + template<typename T> + void WritePOD(const T& dt) { + Write((const char*)&dt, (ui32)sizeof(T)); + } + + void Write(const char* data, ui32 size) { + Buffer.AppendNoAlias(data, size); + } + + void WriteAtPosition(ui32 position, const char* data, ui32 size) { memcpy((char*)Buffer.data() + position, data, size); - } - - void Write(const TFlatBlobDataOutputStream* anotherStream) { - TStringBuf buf = anotherStream->CurrentBuffer(); + } + + void Write(const TFlatBlobDataOutputStream* anotherStream) { + TStringBuf buf = anotherStream->CurrentBuffer(); Write(buf.data(), buf.size()); - } - - TStringBuf CurrentBuffer() const { + } + + TStringBuf CurrentBuffer() const { return TStringBuf(Buffer.data(), Buffer.size()); - } - + } + const TString& GetBuffer() const { - return Buffer; - } - - //////////////////////////////////////////// - class TFutureValueBase { - public: - // - TFutureValueBase(TFlatBlobDataOutputStream* dataStream, ui32 position, ui32 size) - : DataStream(dataStream) - , Position(position) - , Size(size) - {} - ~TFutureValueBase() {} - - // - bool IsValid() const { return DataStream != nullptr; } - explicit operator bool() const { return IsValid(); } - bool operator !() const { return !IsValid(); } - - protected: - // - TFlatBlobDataOutputStream* DataStream; - ui32 Position; - ui32 Size; - }; - - - //////////////////////////////////////////// - class TFutureValue : public TFutureValueBase { - public: - // - TFutureValue(TFlatBlobDataOutputStream* dataStream = nullptr, ui32 position = 0, ui32 size = 0) - : TFutureValueBase(dataStream, position, size) - {} - ~TFutureValue() {} - - // - template<typename T> - void SetValue(const T& value) { + return Buffer; + } + + //////////////////////////////////////////// + class TFutureValueBase { + public: + // + TFutureValueBase(TFlatBlobDataOutputStream* dataStream, ui32 position, ui32 size) + : DataStream(dataStream) + , Position(position) + , Size(size) + {} + ~TFutureValueBase() {} + + // + bool IsValid() const { return DataStream != nullptr; } + explicit operator bool() const { return IsValid(); } + bool operator !() const { return !IsValid(); } + + protected: + // + TFlatBlobDataOutputStream* DataStream; + ui32 Position; + ui32 Size; + }; + + + //////////////////////////////////////////// + class TFutureValue : public TFutureValueBase { + public: + // + TFutureValue(TFlatBlobDataOutputStream* dataStream = nullptr, ui32 position = 0, ui32 size = 0) + : TFutureValueBase(dataStream, position, size) + {} + ~TFutureValue() {} + + // + template<typename T> + void SetValue(const T& value) { Y_VERIFY(sizeof(T) == Size); - DataStream->WriteAtPosition(Position, (const char*)&value, sizeof(T)); - } - }; - - //////////////////////////////////////////// - template<typename T> - class TFutureValuePOD : public TFutureValueBase { - public: - // - TFutureValuePOD(TFlatBlobDataOutputStream* dataStream = nullptr, ui32 position = 0, ui32 size = 0) - : TFutureValueBase(dataStream, position, size) - {} - ~TFutureValuePOD() {} - - // - void SetValue(const T& value) { + DataStream->WriteAtPosition(Position, (const char*)&value, sizeof(T)); + } + }; + + //////////////////////////////////////////// + template<typename T> + class TFutureValuePOD : public TFutureValueBase { + public: + // + TFutureValuePOD(TFlatBlobDataOutputStream* dataStream = nullptr, ui32 position = 0, ui32 size = 0) + : TFutureValueBase(dataStream, position, size) + {} + ~TFutureValuePOD() {} + + // + void SetValue(const T& value) { Y_VERIFY(sizeof(T) == Size); - DataStream->WriteAtPosition(Position, (const char*)&value, sizeof(T)); - } - }; - - // - TFutureValue FutureWrite(const char* data, ui32 size) { - ui32 currentOffset = GetCurrentOffset(); - Write(data, size); - return TFutureValue(this, currentOffset, size); - } - - template <typename T> - TFutureValuePOD<T> FutureWritePOD(const T& dt) { - ui32 currentOffset = GetCurrentOffset(); - WritePOD<T>(dt); - return TFutureValuePOD<T>(this, currentOffset, (ui32)sizeof(T)); - } - -private: - // + DataStream->WriteAtPosition(Position, (const char*)&value, sizeof(T)); + } + }; + + // + TFutureValue FutureWrite(const char* data, ui32 size) { + ui32 currentOffset = GetCurrentOffset(); + Write(data, size); + return TFutureValue(this, currentOffset, size); + } + + template <typename T> + TFutureValuePOD<T> FutureWritePOD(const T& dt) { + ui32 currentOffset = GetCurrentOffset(); + WritePOD<T>(dt); + return TFutureValuePOD<T>(this, currentOffset, (ui32)sizeof(T)); + } + +private: + // TString Buffer; -}; - -//////////////////////////////////////////// -class TBufferReader { -public: - // - TBufferReader(const TStringBuf& buffer) - : Buffer(buffer) - , Offset(0) - {} - ~TBufferReader() {} - - void SetOffset(ui32 newOffset) { - Offset = newOffset; +}; + +//////////////////////////////////////////// +class TBufferReader { +public: + // + TBufferReader(const TStringBuf& buffer) + : Buffer(buffer) + , Offset(0) + {} + ~TBufferReader() {} + + void SetOffset(ui32 newOffset) { + Offset = newOffset; Y_VERIFY_DEBUG(Offset <= Buffer.size()); - } - void AddOffset(ui32 incOffset) { - Offset += incOffset; + } + void AddOffset(ui32 incOffset) { + Offset += incOffset; Y_VERIFY_DEBUG(Offset <= Buffer.size()); - } - - // - template<typename T> - const T* ReadData() { + } + + // + template<typename T> + const T* ReadData() { Y_VERIFY_DEBUG(Offset + sizeof(T) <= Buffer.size()); T* retVal = (T*) (Buffer.data() + Offset); - Offset += sizeof(T); - return retVal; - } - - TStringBuf ReadData(ui32 len) { + Offset += sizeof(T); + return retVal; + } + + TStringBuf ReadData(ui32 len) { Y_VERIFY_DEBUG(Offset + len <= Buffer.size()); TStringBuf retVal(Buffer.data() + Offset, len); - Offset += len; - return retVal; - } - - TStringBuf GetBuffer() const { + Offset += len; + return retVal; + } + + TStringBuf GetBuffer() const { Y_VERIFY_DEBUG(Buffer.size() > Offset); return TStringBuf(Buffer.data() + Offset, Buffer.size() - Offset); - } - -private: - // - TStringBuf Buffer; - ui32 Offset; -}; - -} // end of the NKikimr namespace - + } + +private: + // + TStringBuf Buffer; + ui32 Offset; +}; + +} // end of the NKikimr namespace + diff --git a/ydb/core/util/cache.cpp b/ydb/core/util/cache.cpp index c698880874..2c67b9e364 100644 --- a/ydb/core/util/cache.cpp +++ b/ydb/core/util/cache.cpp @@ -1,6 +1,6 @@ #include "cache.h" - -// static field(s) -const NKikimr::NCache::TCacheStatistics NKikimr::NCache::TNullStatisticsPolicy::Statistics; - - + +// static field(s) +const NKikimr::NCache::TCacheStatistics NKikimr::NCache::TNullStatisticsPolicy::Statistics; + + diff --git a/ydb/core/util/cache.h b/ydb/core/util/cache.h index 916701ebc7..8b59fe40f3 100644 --- a/ydb/core/util/cache.h +++ b/ydb/core/util/cache.h @@ -30,66 +30,66 @@ struct TCacheStatistics { } }; -class TDefaultStatisticsPolicy { -public: - TDefaultStatisticsPolicy() {} - ~TDefaultStatisticsPolicy() {} - - const TCacheStatistics& GetStatistics() const { - return Statistics; - } - - void IncFindCount() { ++Statistics.FindCount; } - void IncFindHitCount() { ++Statistics.FindHitCount; } - void IncFindWithoutPromoteCount() { ++Statistics.FindWithoutPromoteCount; } - void IncFindWithoutPromoteHitCount() { ++Statistics.FindWithoutPromoteHitCount; } - void IncInsertCount() { ++Statistics.InsertCount; } - void IncInsertExistingCount() { ++Statistics.InsertExistingCount; } - void IncEraseCount() { ++Statistics.EraseCount; } - void IncEraseMissingCount() { ++Statistics.EraseMissingCount; } - void IncPopCount() { ++Statistics.PopCount; } - void IncPopEmptyCount() { ++Statistics.PopEmptyCount; } - void IncPopWhileOverflowCount() { ++Statistics.PopWhileOverflowCount; } - void IncClearCount() { ++Statistics.ClearCount; } - void IncEvictionCount() { ++Statistics.EvictionCount; } - void IncKeyEvictionCount() { ++Statistics.KeyEvictionCount; } - void ClearStatistics() { - Zero(Statistics); - } - -private: - TCacheStatistics Statistics; -}; - -class TNullStatisticsPolicy { -public: - TNullStatisticsPolicy() {} - ~TNullStatisticsPolicy() {} - - const TCacheStatistics& GetStatistics() const { - return Statistics; - } - - void IncFindCount() {} - void IncFindHitCount() {} - void IncFindWithoutPromoteCount() {} - void IncFindWithoutPromoteHitCount() {} - void IncInsertCount() {} - void IncInsertExistingCount() {} - void IncEraseCount() {} - void IncEraseMissingCount() {} - void IncPopCount() {} - void IncPopEmptyCount() {} - void IncPopWhileOverflowCount() {} - void IncClearCount() {} - void IncEvictionCount() {} - void IncKeyEvictionCount() {} - void ClearStatistics() {} - -private: - const static TCacheStatistics Statistics; -}; - +class TDefaultStatisticsPolicy { +public: + TDefaultStatisticsPolicy() {} + ~TDefaultStatisticsPolicy() {} + + const TCacheStatistics& GetStatistics() const { + return Statistics; + } + + void IncFindCount() { ++Statistics.FindCount; } + void IncFindHitCount() { ++Statistics.FindHitCount; } + void IncFindWithoutPromoteCount() { ++Statistics.FindWithoutPromoteCount; } + void IncFindWithoutPromoteHitCount() { ++Statistics.FindWithoutPromoteHitCount; } + void IncInsertCount() { ++Statistics.InsertCount; } + void IncInsertExistingCount() { ++Statistics.InsertExistingCount; } + void IncEraseCount() { ++Statistics.EraseCount; } + void IncEraseMissingCount() { ++Statistics.EraseMissingCount; } + void IncPopCount() { ++Statistics.PopCount; } + void IncPopEmptyCount() { ++Statistics.PopEmptyCount; } + void IncPopWhileOverflowCount() { ++Statistics.PopWhileOverflowCount; } + void IncClearCount() { ++Statistics.ClearCount; } + void IncEvictionCount() { ++Statistics.EvictionCount; } + void IncKeyEvictionCount() { ++Statistics.KeyEvictionCount; } + void ClearStatistics() { + Zero(Statistics); + } + +private: + TCacheStatistics Statistics; +}; + +class TNullStatisticsPolicy { +public: + TNullStatisticsPolicy() {} + ~TNullStatisticsPolicy() {} + + const TCacheStatistics& GetStatistics() const { + return Statistics; + } + + void IncFindCount() {} + void IncFindHitCount() {} + void IncFindWithoutPromoteCount() {} + void IncFindWithoutPromoteHitCount() {} + void IncInsertCount() {} + void IncInsertExistingCount() {} + void IncEraseCount() {} + void IncEraseMissingCount() {} + void IncPopCount() {} + void IncPopEmptyCount() {} + void IncPopWhileOverflowCount() {} + void IncClearCount() {} + void IncEvictionCount() {} + void IncKeyEvictionCount() {} + void ClearStatistics() {} + +private: + const static TCacheStatistics Statistics; +}; + template <typename TKey, typename TValue> class ICache { public: @@ -151,10 +151,10 @@ public: } }; -template <typename TKey, typename TValue, typename TDerived, typename TStatisticsPolicy> +template <typename TKey, typename TValue, typename TDerived, typename TStatisticsPolicy> class TCacheBase : public ICache<TKey, TValue>, private TNonCopyable { public: - typedef TCacheBase<TKey, TValue, TDerived, TStatisticsPolicy> TSelf; + typedef TCacheBase<TKey, TValue, TDerived, TStatisticsPolicy> TSelf; typedef ICache<TKey, TValue> TInterface; typedef typename TInterface::TEvictionCallback TEvictionCallback; typedef typename TInterface::TKeyEvictionCallback TKeyEvictionCallback; @@ -186,10 +186,10 @@ public: bool Find(const TKey& key, TValue*& value) override final { value = nullptr; - Statistics.IncFindCount(); + Statistics.IncFindCount(); bool result = static_cast<TDerived*>(this)->DoFind(key, value); if (result) { - Statistics.IncFindHitCount(); + Statistics.IncFindHitCount(); } return result; @@ -197,10 +197,10 @@ public: bool FindWithoutPromote(const TKey& key, TValue*& value) const override final { value = nullptr; - Statistics.IncFindWithoutPromoteCount(); + Statistics.IncFindWithoutPromoteCount(); bool result = static_cast<const TDerived*>(this)->DoFindWithoutPromote(key, value); if (result) { - Statistics.IncFindWithoutPromoteHitCount(); + Statistics.IncFindWithoutPromoteHitCount(); } return result; @@ -208,37 +208,37 @@ public: bool Insert(const TKey& key, const TValue& value, TValue*& currentValue) override final { currentValue = nullptr; - Statistics.IncInsertCount(); + Statistics.IncInsertCount(); bool result = static_cast<TDerived*>(this)->DoInsert(key, value, currentValue); if (!result) { - Statistics.IncInsertExistingCount(); + Statistics.IncInsertExistingCount(); } return result; } bool Erase(const TKey& key) override final { - Statistics.IncEraseCount(); + Statistics.IncEraseCount(); bool result = static_cast<TDerived*>(this)->DoErase(key); if (!result) { - Statistics.IncEraseMissingCount(); + Statistics.IncEraseMissingCount(); } return result; } bool Pop() override final { - Statistics.IncPopCount(); + Statistics.IncPopCount(); bool result = static_cast<TDerived*>(this)->DoPop(); if (!result) { - Statistics.IncPopEmptyCount(); + Statistics.IncPopEmptyCount(); } return result; } void PopWhileOverflow() override final { - Statistics.IncPopWhileOverflowCount(); + Statistics.IncPopWhileOverflowCount(); while (IsOverflow()) { bool result = static_cast<TDerived*>(this)->DoPop(); if (!result) @@ -251,7 +251,7 @@ public: } void Clear() override final { - Statistics.IncClearCount(); + Statistics.IncClearCount(); for (;;) { bool result = static_cast<TDerived*>(this)->DoPop(); if (!result) @@ -268,22 +268,22 @@ public: void OnEvict(const TKey& key, TValue& value, ui64 size) override { EvictionCallback(key, value, size); - Statistics.IncEvictionCount(); + Statistics.IncEvictionCount(); UsedSize -= size; --Count; } void OnKeyEvict(const TKey& key) override { KeyEvictionCallback(key); - Statistics.IncKeyEvictionCount(); + Statistics.IncKeyEvictionCount(); } const TCacheStatistics& GetStatistics() const override final { - return Statistics.GetStatistics(); + return Statistics.GetStatistics(); } void ClearStatistics() override final { - Statistics.ClearStatistics(); + Statistics.ClearStatistics(); } void SetEvictionCallback(const TEvictionCallback& callback) override final { @@ -319,24 +319,24 @@ private: TEvictionCallback EvictionCallback; TKeyEvictionCallback KeyEvictionCallback; TOverflowCallback OverflowCallback; - mutable TStatisticsPolicy Statistics; + mutable TStatisticsPolicy Statistics; ui64 Count; ui64 UsedSize; }; -template <typename TKey, typename TValue, typename TContainer, typename TStatisticsPolicy = TDefaultStatisticsPolicy> -class TUnboundedCacheBase : public TCacheBase<TKey, TValue, TUnboundedCacheBase<TKey, TValue, TContainer, TStatisticsPolicy>, TStatisticsPolicy> { +template <typename TKey, typename TValue, typename TContainer, typename TStatisticsPolicy = TDefaultStatisticsPolicy> +class TUnboundedCacheBase : public TCacheBase<TKey, TValue, TUnboundedCacheBase<TKey, TValue, TContainer, TStatisticsPolicy>, TStatisticsPolicy> { public: - typedef TCacheBase<TKey, TValue, TUnboundedCacheBase<TKey, TValue, TContainer, TStatisticsPolicy>, TStatisticsPolicy> TBase; - typedef TUnboundedCacheBase<TKey, TValue, TContainer, TStatisticsPolicy> TSelf; + typedef TCacheBase<TKey, TValue, TUnboundedCacheBase<TKey, TValue, TContainer, TStatisticsPolicy>, TStatisticsPolicy> TBase; + typedef TUnboundedCacheBase<TKey, TValue, TContainer, TStatisticsPolicy> TSelf; typedef typename TBase::TMeasureCallback TMeasureCallback; - TUnboundedCacheBase() - : TUnboundedCacheBase(&TBase::DefaultMeasureCallback) + TUnboundedCacheBase() + : TUnboundedCacheBase(&TBase::DefaultMeasureCallback) { } - explicit TUnboundedCacheBase(const TMeasureCallback& measureCallback) + explicit TUnboundedCacheBase(const TMeasureCallback& measureCallback) : TBase(measureCallback) { } @@ -397,35 +397,35 @@ public: } private: - TContainer Items; + TContainer Items; }; -template <typename TKey, typename TValue, typename TStatisticsPolicy = TDefaultStatisticsPolicy> +template <typename TKey, typename TValue, typename TStatisticsPolicy = TDefaultStatisticsPolicy> class TUnboundedCacheOnMap : public TUnboundedCacheBase<TKey, TValue, TMap<TKey, TValue>, TStatisticsPolicy> { -public: +public: using TBase = TUnboundedCacheBase<TKey, TValue, TMap<TKey, TValue>, TStatisticsPolicy>; - using TMeasureCallback = typename TBase::TMeasureCallback; - TUnboundedCacheOnMap() - {} - - explicit TUnboundedCacheOnMap(const TMeasureCallback& measureCallback) - : TBase(measureCallback) - {} -}; - -template <typename TKey, typename TValue, typename TKeyHash = ::THash<TKey>, typename TStatisticsPolicy = TDefaultStatisticsPolicy> + using TMeasureCallback = typename TBase::TMeasureCallback; + TUnboundedCacheOnMap() + {} + + explicit TUnboundedCacheOnMap(const TMeasureCallback& measureCallback) + : TBase(measureCallback) + {} +}; + +template <typename TKey, typename TValue, typename TKeyHash = ::THash<TKey>, typename TStatisticsPolicy = TDefaultStatisticsPolicy> class TUnboundedCacheOnHash : public TUnboundedCacheBase<TKey, TValue, THashMap<TKey, TValue, TKeyHash>, TStatisticsPolicy> { -public: +public: using TBase = TUnboundedCacheBase<TKey, TValue, THashMap<TKey, TValue, TKeyHash>, TStatisticsPolicy>; - using TMeasureCallback = typename TBase::TMeasureCallback; - TUnboundedCacheOnHash() - {} - - explicit TUnboundedCacheOnHash(const TMeasureCallback& measureCallback) - : TBase(measureCallback) - {} -}; - + using TMeasureCallback = typename TBase::TMeasureCallback; + TUnboundedCacheOnHash() + {} + + explicit TUnboundedCacheOnHash(const TMeasureCallback& measureCallback) + : TBase(measureCallback) + {} +}; + template <typename TKey, typename TValue> class TSizeBasedOverflowCallback : private TNonCopyable { public: @@ -446,11 +446,11 @@ private: ui64 MaxSize; }; -template <typename TKey, typename TValue, typename TKeyHash = ::THash<TKey>, typename TStatisticsPolicy = TDefaultStatisticsPolicy> -class TLruCache : public TCacheBase<TKey, TValue, TLruCache<TKey, TValue, TKeyHash, TStatisticsPolicy>, TStatisticsPolicy> { +template <typename TKey, typename TValue, typename TKeyHash = ::THash<TKey>, typename TStatisticsPolicy = TDefaultStatisticsPolicy> +class TLruCache : public TCacheBase<TKey, TValue, TLruCache<TKey, TValue, TKeyHash, TStatisticsPolicy>, TStatisticsPolicy> { public: - typedef TCacheBase<TKey, TValue, TLruCache<TKey, TValue, TKeyHash, TStatisticsPolicy>, TStatisticsPolicy> TBase; - typedef TLruCache<TKey, TValue, TKeyHash, TStatisticsPolicy> TSelf; + typedef TCacheBase<TKey, TValue, TLruCache<TKey, TValue, TKeyHash, TStatisticsPolicy>, TStatisticsPolicy> TBase; + typedef TLruCache<TKey, TValue, TKeyHash, TStatisticsPolicy> TSelf; typedef typename TBase::TMeasureCallback TMeasureCallback; TLruCache() @@ -585,15 +585,15 @@ struct T2QCacheConfig : public TThrRefBase { } }; -template <typename TKey, typename TValue, typename TKeyHash = ::THash<TKey>, typename TStatisticsPolicy = TDefaultStatisticsPolicy> -class T2QCache : public TCacheBase<TKey, TValue, T2QCache<TKey, TValue, TKeyHash, TStatisticsPolicy>, TStatisticsPolicy> { +template <typename TKey, typename TValue, typename TKeyHash = ::THash<TKey>, typename TStatisticsPolicy = TDefaultStatisticsPolicy> +class T2QCache : public TCacheBase<TKey, TValue, T2QCache<TKey, TValue, TKeyHash, TStatisticsPolicy>, TStatisticsPolicy> { public: - typedef TCacheBase<TKey, TValue, T2QCache<TKey, TValue, TKeyHash, TStatisticsPolicy>, TStatisticsPolicy> TBase; - typedef T2QCache<TKey, TValue, TKeyHash, TStatisticsPolicy> TSelf; + typedef TCacheBase<TKey, TValue, T2QCache<TKey, TValue, TKeyHash, TStatisticsPolicy>, TStatisticsPolicy> TBase; + typedef T2QCache<TKey, TValue, TKeyHash, TStatisticsPolicy> TSelf; typedef typename TBase::TMeasureCallback TMeasureCallback; - typedef typename TLruCache<TKey, TValue, TKeyHash, TStatisticsPolicy>::TItem TItem; + typedef typename TLruCache<TKey, TValue, TKeyHash, TStatisticsPolicy>::TItem TItem; typedef typename TLruCache<TKey, TValue, TKeyHash, TStatisticsPolicy>::TListType TListType; - typedef typename TLruCache<TKey, TValue, TKeyHash, TStatisticsPolicy>::TIndex TIndex; + typedef typename TLruCache<TKey, TValue, TKeyHash, TStatisticsPolicy>::TIndex TIndex; struct TItemKey : public TIntrusiveListItem <TItemKey> { typedef TIntrusiveListItem<TItemKey> TBase; |