Browse Source

Restoring authorship annotation for <haposik@yandex-team.ru>. Commit 2 of 2.

haposik 3 years ago
parent
commit
f28ae3e275

+ 1 - 1
library/cpp/actors/core/mailbox.h

@@ -178,7 +178,7 @@ namespace NActors {
                             mp->emplace(ActorsInfo.Array.ActorsArray->Actors[i].ActorId, ActorsInfo.Array.ActorsArray->Actors[i].Actor);
                         }
                         mp->emplace(localActorId, actor);
-                        ActorPack = TMailboxActorPack::Map; 
+                        ActorPack = TMailboxActorPack::Map;
                         ActorsInfo.Array.ActorsCount = 0;
                         delete ActorsInfo.Array.ActorsArray;
                         ActorsInfo.Map.ActorsMap = mp;

+ 23 - 23
library/cpp/containers/stack_vector/stack_vec.h

@@ -45,18 +45,18 @@ namespace NPrivate {
         };
 
     public:
-        TStackBasedAllocator() = default; 
- 
-        template < 
-            typename... TArgs, 
-            typename = std::enable_if_t< 
-                std::is_constructible_v<Alloc, TArgs...> 
-            > 
-        > 
-        TStackBasedAllocator(TArgs&&... args) 
-            : Alloc(std::forward<TArgs>(args)...) 
-        {} 
- 
+        TStackBasedAllocator() = default;
+
+        template <
+            typename... TArgs,
+            typename = std::enable_if_t<
+                std::is_constructible_v<Alloc, TArgs...>
+            >
+        >
+        TStackBasedAllocator(TArgs&&... args)
+            : Alloc(std::forward<TArgs>(args)...)
+        {}
+
         T* allocate(size_type n) {
             if (!IsStorageUsed && CountOnStack >= n) {
                 IsStorageUsed = true;
@@ -95,7 +95,7 @@ template <typename T, size_t CountOnStack, bool UseFallbackAlloc, class Alloc>
 class TStackVec: public TVector<T, ::NPrivate::TStackBasedAllocator<T, CountOnStack, UseFallbackAlloc, TReboundAllocator<Alloc, T>>> {
 private:
     using TBase = TVector<T, ::NPrivate::TStackBasedAllocator<T, CountOnStack, UseFallbackAlloc, TReboundAllocator<Alloc, T>>>;
-    using TAllocator = typename TBase::allocator_type; 
+    using TAllocator = typename TBase::allocator_type;
 
 public:
     using typename TBase::const_iterator;
@@ -106,14 +106,14 @@ public:
     using typename TBase::value_type;
 
 public:
-    TStackVec(const TAllocator& alloc = TAllocator()) 
-        : TBase(alloc) 
+    TStackVec(const TAllocator& alloc = TAllocator())
+        : TBase(alloc)
     {
         TBase::reserve(CountOnStack);
     }
 
-    explicit TStackVec(size_type count, const TAllocator& alloc = TAllocator()) 
-        : TBase(alloc) 
+    explicit TStackVec(size_type count, const TAllocator& alloc = TAllocator())
+        : TBase(alloc)
     {
         if (count <= CountOnStack) {
             TBase::reserve(CountOnStack);
@@ -121,8 +121,8 @@ public:
         TBase::resize(count);
     }
 
-    TStackVec(size_type count, const T& val, const TAllocator& alloc = TAllocator()) 
-        : TBase(alloc) 
+    TStackVec(size_type count, const T& val, const TAllocator& alloc = TAllocator())
+        : TBase(alloc)
     {
         if (count <= CountOnStack) {
             TBase::reserve(CountOnStack);
@@ -141,14 +141,14 @@ public:
     {
     }
 
-    TStackVec(std::initializer_list<T> il, const TAllocator& alloc = TAllocator()) 
-        : TStackVec(il.begin(), il.end(), alloc) 
+    TStackVec(std::initializer_list<T> il, const TAllocator& alloc = TAllocator())
+        : TStackVec(il.begin(), il.end(), alloc)
     {
     }
 
     template <class TIter>
-    TStackVec(TIter first, TIter last, const TAllocator& alloc = TAllocator()) 
-        : TBase(alloc) 
+    TStackVec(TIter first, TIter last, const TAllocator& alloc = TAllocator())
+        : TBase(alloc)
     {
         // NB(eeight) Since we want to call 'reserve' here, we cannot just delegate to TVector ctor.
         // The best way to insert values afterwards is to call TVector::insert. However there is a caveat.

+ 31 - 31
library/cpp/containers/stack_vector/stack_vec_ut.cpp

@@ -19,28 +19,28 @@ namespace {
 
         char Junk[JunkPayloadSize]{sizeof(T)};
     };
- 
-    template <class T> 
-    struct TStatefulAlloc: public std::allocator<T> { 
-        using TBase = std::allocator<T>; 
- 
-        template <class U> 
-        struct rebind { 
-            using other = TStatefulAlloc<U>; 
-        }; 
- 
-        TStatefulAlloc(size_t* allocCount) 
-            : AllocCount(allocCount) 
-        {} 
- 
-        size_t* AllocCount; 
- 
-        T* allocate(size_t n) 
-        { 
-            *AllocCount += 1; 
-            return TBase::allocate(n); 
-        } 
-    }; 
+
+    template <class T>
+    struct TStatefulAlloc: public std::allocator<T> {
+        using TBase = std::allocator<T>;
+
+        template <class U>
+        struct rebind {
+            using other = TStatefulAlloc<U>;
+        };
+
+        TStatefulAlloc(size_t* allocCount)
+            : AllocCount(allocCount)
+        {}
+
+        size_t* AllocCount;
+
+        T* allocate(size_t n)
+        {
+            *AllocCount += 1;
+            return TBase::allocate(n);
+        }
+    };
 }
 
 Y_UNIT_TEST_SUITE(TStackBasedVectorTest) {
@@ -132,13 +132,13 @@ Y_UNIT_TEST_SUITE(TStackBasedVectorTest) {
         using TVec = TStackVec<size_t, 1, true, TThickAlloc<size_t, n>>;
         UNIT_ASSERT_LT(sizeof(TVec), 1.5 * n);
     }
- 
-    Y_UNIT_TEST(TestStatefulAlloc) { 
-        size_t count = 0; 
-        TStackVec<size_t, 1, true, TStatefulAlloc<size_t>> vec{{ &count }}; 
-        for (size_t i = 0; i < 5; ++i) { 
-            vec.push_back(1); 
-        } 
-        UNIT_ASSERT_VALUES_EQUAL(count, 3); 
-    } 
+
+    Y_UNIT_TEST(TestStatefulAlloc) {
+        size_t count = 0;
+        TStackVec<size_t, 1, true, TStatefulAlloc<size_t>> vec{{ &count }};
+        for (size_t i = 0; i < 5; ++i) {
+            vec.push_back(1);
+        }
+        UNIT_ASSERT_VALUES_EQUAL(count, 3);
+    }
 }

+ 1 - 1
ydb/core/driver_lib/run/kikimr_services_initializers.cpp

@@ -1138,7 +1138,7 @@ void TRestartsCountPublisher::InitializeServices(
     if (Config.HasRestartsCountConfig()) {
         const auto& restartsCountConfig = Config.GetRestartsCountConfig();
         if (restartsCountConfig.HasRestartsCountFile()) {
-            PublishRestartsCount(utilsCounters->GetCounter("RestartsCount", false), restartsCountConfig.GetRestartsCountFile()); 
+            PublishRestartsCount(utilsCounters->GetCounter("RestartsCount", false), restartsCountConfig.GetRestartsCountFile());
         }
     }
 }

+ 40 - 40
ydb/core/mon_alloc/monitor.cpp

@@ -45,21 +45,21 @@ namespace NKikimr {
                 TMemCounters Total;
             };
 
-            struct TTagStats { 
-                struct TBucket { 
-                    ui64 Count = 0; 
-                    ui64 Size = 0; 
- 
-                    void Update(ui64 count, ui64 size) { 
-                        Count += count; 
-                        Size += size; 
-                    } 
-                }; 
- 
-                TVector<TBucket> Buckets; 
-                TBucket Total; 
-            }; 
- 
+            struct TTagStats {
+                struct TBucket {
+                    ui64 Count = 0;
+                    ui64 Size = 0;
+
+                    void Update(ui64 count, ui64 size) {
+                        Count += count;
+                        Size += size;
+                    }
+                };
+
+                TVector<TBucket> Buckets;
+                TBucket Total;
+            };
+
         private:
             TDynamicCountersPtr CounterGroup;
 
@@ -77,11 +77,11 @@ namespace NKikimr {
                 int numSizes = 0;
                 auto info = NAllocDbg::GetPerTagAllocInfo(true, maxTag, numSizes);
 
-                THashMap<TString, TTagStats> stats; 
+                THashMap<TString, TTagStats> stats;
+
+                auto& totalStats = stats["total"];
+                totalStats.Buckets.resize(numSizes);
 
-                auto& totalStats = stats["total"]; 
-                totalStats.Buckets.resize(numSizes); 
- 
                 // enumerate through all memory tags
                 for (int tag = 0; tag < maxTag; ++tag) {
                     auto tagName = NProfiling::GetTag(tag);
@@ -89,8 +89,8 @@ namespace NKikimr {
                         tagName = "__DEFAULT__";
                     }
 
-                    auto& tagStats = stats[tagName]; 
-                    tagStats.Buckets.resize(numSizes); 
+                    auto& tagStats = stats[tagName];
+                    tagStats.Buckets.resize(numSizes);
 
                     // enumerate through all sizes of objects
                     for (int sizeIdx = 0; sizeIdx < numSizes; ++sizeIdx) {
@@ -99,16 +99,16 @@ namespace NKikimr {
                             continue;
                         }
 
-                        tagStats.Buckets[sizeIdx].Update(entry.Count, entry.Size); 
-                        tagStats.Total.Update(entry.Count, entry.Size); 
+                        tagStats.Buckets[sizeIdx].Update(entry.Count, entry.Size);
+                        tagStats.Total.Update(entry.Count, entry.Size);
 
-                        totalStats.Buckets[sizeIdx].Update(entry.Count, entry.Size); 
-                        totalStats.Total.Update(entry.Count, entry.Size); 
+                        totalStats.Buckets[sizeIdx].Update(entry.Count, entry.Size);
+                        totalStats.Total.Update(entry.Count, entry.Size);
                     }
-                } 
+                }
 
-                // update counters 
-                for (const auto& [tagName, tagStats] : stats) { 
+                // update counters
+                for (const auto& [tagName, tagStats] : stats) {
                     const auto& total = tagStats.Total;
                     TPerTagCounters& perTag = PerTag[tagName];
 
@@ -117,30 +117,30 @@ namespace NKikimr {
                         continue;
                     }
 
-                    auto tagCounters = CounterGroup->GetSubgroup("tag", tagName); 
+                    auto tagCounters = CounterGroup->GetSubgroup("tag", tagName);
                     if (!perTag.Total.Count) {
                         perTag.Total.Init(tagCounters->GetSubgroup("bucket", "total"));
                     }
 
-                    perTag.Total.Set(total.Count, total.Size); 
+                    perTag.Total.Set(total.Count, total.Size);
+
+                    for (int sizeIdx = 0; sizeIdx < numSizes; ++sizeIdx) {
+                        const auto sizeName = ToString(sizeIdx);
 
-                    for (int sizeIdx = 0; sizeIdx < numSizes; ++sizeIdx) { 
-                        const auto sizeName = ToString(sizeIdx); 
- 
                         const auto& bucket = tagStats.Buckets[sizeIdx];
-                        TMemCounters& bySize = perTag.BySize[sizeName]; 
+                        TMemCounters& bySize = perTag.BySize[sizeName];
 
                         if (bucket.Count == 0 && bucket.Size == 0 && !bySize.Count) {
                             // Skip the bucket that didn't have any allocations so far
                             continue;
                         }
 
-                        if (!bySize.Count) { 
-                            bySize.Init(tagCounters->GetSubgroup("bucket", sizeName)); 
-                        } 
- 
-                        bySize.Set(bucket.Count, bucket.Size); 
-                    } 
+                        if (!bySize.Count) {
+                            bySize.Init(tagCounters->GetSubgroup("bucket", sizeName));
+                        }
+
+                        bySize.Set(bucket.Count, bucket.Size);
+                    }
                 }
 #endif
             }

+ 1 - 1
ydb/core/protos/services.proto

@@ -848,7 +848,7 @@ message TActivity {
         YQL_PRIVATE_WRITE_TASK_ACTOR = 542;
         YQL_NODES_MANAGER_ACTOR = 543;
         KESUS_ACCOUNTING_ACTOR = 544;
-        BLOCKSTORE_PARTITION_COMMON = 545; 
+        BLOCKSTORE_PARTITION_COMMON = 545;
         INTERCONNECT_PROXY_WRAPPER = 546;
         CLOUD_STORAGE_HIVE_PROXY = 547;
         YQL_PRIVATE_NODES_HEALTH_CHECK_ACTOR = 548;

+ 1 - 1
ydb/core/testlib/basics/helpers.cpp

@@ -11,7 +11,7 @@ namespace NKikimr {
 
         x->TabletID = tabletId;
         x->TabletType = tabletType;
-        x->Channels.resize(5); 
+        x->Channels.resize(5);
 
         for (ui64 channel = 0; channel < x->Channels.size(); ++channel) {
             x->Channels[channel].Channel = channel;

+ 7 - 7
ydb/core/tx/schemeshard/schemeshard__operation_alter_fs.cpp

@@ -245,14 +245,14 @@ public:
 
 private:
     TTxState::ETxState NextState() {
-        return TTxState::CreateParts; 
+        return TTxState::CreateParts;
     }
 
     TTxState::ETxState NextState(TTxState::ETxState state) {
         switch(state) {
         case TTxState::Waiting:
-        case TTxState::CreateParts: 
-            return TTxState::ConfigureParts; 
+        case TTxState::CreateParts:
+            return TTxState::ConfigureParts;
         case TTxState::ConfigureParts:
             return TTxState::Propose;
         default:
@@ -264,8 +264,8 @@ private:
     TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
         switch(state) {
         case TTxState::Waiting:
-        case TTxState::CreateParts: 
-            return MakeHolder<TCreateParts>(OperationId); 
+        case TTxState::CreateParts:
+            return MakeHolder<TCreateParts>(OperationId);
         case TTxState::ConfigureParts:
             return MakeHolder<TConfigureParts>(OperationId);
         case TTxState::Propose:
@@ -454,7 +454,7 @@ TTxState& TAlterFileStore::PrepareChanges(
     item->PathState = TPathElement::EPathState::EPathStateAlter;
 
     TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxAlterFileStore, item->PathId);
-    txState.State = TTxState::CreateParts; 
+    txState.State = TTxState::CreateParts;
 
     ApplyChannelBindings(
         fs,
@@ -469,7 +469,7 @@ TTxState& TAlterFileStore::PrepareChanges(
         Y_VERIFY(context.SS->ShardInfos.contains(shardIdx));
         auto& shardInfo = context.SS->ShardInfos[shardIdx];
         Y_VERIFY(shardInfo.TabletID == tabletId);
-        txState.Shards.emplace_back(shardIdx, ETabletType::FileStore, TTxState::CreateParts); 
+        txState.Shards.emplace_back(shardIdx, ETabletType::FileStore, TTxState::CreateParts);
         shardInfo.CurrentTxId = operationId.GetTxId();
         context.SS->PersistShardTx(db, shardIdx, operationId.GetTxId());
     }

+ 5 - 5
ydb/core/tx/schemeshard/schemeshard_info_types.h

@@ -1842,7 +1842,7 @@ struct TBlockStoreVolumeInfo : public TSimpleRefCount<TBlockStoreVolumeInfo> {
         TVector<TTabletId> Tablets;
     };
 
-    static constexpr size_t NumVolumeTabletChannels = 3; 
+    static constexpr size_t NumVolumeTabletChannels = 3;
 
     ui32 DefaultPartitionCount = 0;
     NKikimrBlockStore::TVolumeConfig VolumeConfig;
@@ -2001,11 +2001,11 @@ struct TFileStoreInfo : public TSimpleRefCount<TFileStoreInfo> {
         Y_VERIFY(!AlterVersion);
 
         AlterConfig = MakeHolder<NKikimrFileStore::TConfig>();
-        AlterConfig->CopyFrom(alterConfig); 
+        AlterConfig->CopyFrom(alterConfig);
+
+        Y_VERIFY(!AlterConfig->GetBlockSize());
+        AlterConfig->SetBlockSize(Config.GetBlockSize());
 
-        Y_VERIFY(!AlterConfig->GetBlockSize()); 
-        AlterConfig->SetBlockSize(Config.GetBlockSize()); 
- 
         AlterVersion = Version + 1;
     }
 

+ 1 - 1
ydb/core/tx/schemeshard/ut_filestore_reboots.cpp

@@ -190,7 +190,7 @@ Y_UNIT_TEST_SUITE(TFileStoreWithReboots) {
                                    {NLs::PathNotExist});
 
                 TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
-                                   {NLs::PathVersionEqual(7), 
+                                   {NLs::PathVersionEqual(7),
                                     NLs::PathsInsideDomain(1),
                                     NLs::ShardsInsideDomain(0)});
             }