Skip to content

Commit 310d169

Browse files
committed
fix concurrent rw hash map (ydb-platform#9008)
1 parent 6e413ab commit 310d169

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
@@ -49,15 +49,15 @@ class TConcurrentRWHashMap {
4949
bucket.Map[key] = value;
5050
}
5151

52-
V& InsertIfAbsent(const K& key, const V& value) {
52+
V InsertIfAbsent(const K& key, const V& value) {
5353
TBucket& bucket = GetBucketForKey(key);
5454
TWriteGuard guard(bucket.RWLock);
5555

5656
return bucket.Map.insert(std::make_pair(key, value)).first->second;
5757
}
5858

5959
template <typename Callable>
60-
V& InsertIfAbsentWithInit(const K& key, Callable initFunc) {
60+
V InsertIfAbsentWithInit(const K& key, Callable initFunc) {
6161
TBucket& bucket = GetBucketForKey(key);
6262
TWriteGuard guard(bucket.RWLock);
6363

0 commit comments

Comments
 (0)