Skip to content

Commit 9e26730

Browse files
authored
fix concurrent rw hash map (#9008)
1 parent 4f0d854 commit 9e26730

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

ydb/core/tablet/private/aggregated_counters.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class TAggregatedHistogramCounters {
140140
TVector<TCountersByTabletIdMap> CountersByTabletId; // each index is map from tablet to counter value
141141
};
142142

143-
class TAggregatedLabeledCounters {
143+
class TAggregatedLabeledCounters : public TThrRefBase {
144144
public:
145145
//
146146
TAggregatedLabeledCounters(ui32 count, const ui8* aggrFunc, const char * const * names, const ui8* types, const TString& groupNames);

ydb/core/tablet/private/labeled_db_counters.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void TPQCounters::Apply(ui64 tabletId, const NKikimr::TTabletLabeledCountersBase
3131
}
3232
}
3333

34-
auto& el = LabeledCountersByGroup.InsertIfAbsent(group, new TAggregatedLabeledCounters(
34+
auto el = LabeledCountersByGroup.InsertIfAbsent(group, new TAggregatedLabeledCounters(
3535
labeledCounters->GetCounters().Size(), labeledCounters->GetAggrFuncs(),
3636
labeledCounters->GetNames(), labeledCounters->GetTypes(), groupNames));
3737

ydb/core/tablet/private/labeled_db_counters.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace NKikimr::NPrivate {
1313

1414
class TPQCounters : public ILabeledCounters {
1515
protected:
16-
TConcurrentRWHashMap<TString, TAutoPtr<TAggregatedLabeledCounters>, 256> LabeledCountersByGroup;
16+
TConcurrentRWHashMap<TString, TIntrusivePtr<TAggregatedLabeledCounters>, 256> LabeledCountersByGroup;
1717
NMonitoring::TDynamicCounterPtr Group;
1818

1919
public:

ydb/core/util/concurrent_rw_hash.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ class TConcurrentRWHashMap {
6363
return false;
6464
}
6565

66-
V& InsertIfAbsent(const K& key, const V& value) {
66+
V InsertIfAbsent(const K& key, const V& value) {
6767
TBucket& bucket = GetBucketForKey(key);
6868
TWriteGuard guard(bucket.RWLock);
6969

7070
return bucket.Map.insert(std::make_pair(key, value)).first->second;
7171
}
7272

7373
template <typename Callable>
74-
V& InsertIfAbsentWithInit(const K& key, Callable initFunc) {
74+
V InsertIfAbsentWithInit(const K& key, Callable initFunc) {
7575
TBucket& bucket = GetBucketForKey(key);
7676
TWriteGuard guard(bucket.RWLock);
7777

0 commit comments

Comments
 (0)