Skip to content

Commit eb90b5d

Browse files
Fix tx counters crash (ydb-platform#9515)
1 parent 960b100 commit eb90b5d

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

ydb/core/persqueue/partition_write.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -470,20 +470,14 @@ void TPartition::UpdateAfterWriteCounters(bool writeComplete) {
470470
// If supportive - update counters only prior to write, otherwise - only after writes;
471471
return;
472472
}
473-
if (BytesWrittenGrpc)
474-
BytesWrittenGrpc.Inc(WriteNewSizeInternal);
475-
if (BytesWrittenTotal)
476-
BytesWrittenTotal.Inc(WriteNewSize);
477-
478-
if (BytesWrittenUncompressed)
479-
BytesWrittenUncompressed.Inc(WriteNewSizeUncompressed);
473+
BytesWrittenGrpc.Inc(WriteNewSizeInternal);
474+
BytesWrittenTotal.Inc(WriteNewSize);
475+
BytesWrittenUncompressed.Inc(WriteNewSizeUncompressed);
480476
if (BytesWrittenComp)
481477
BytesWrittenComp.Inc(WriteCycleSize);
482-
if (MsgsWrittenGrpc)
483-
MsgsWrittenGrpc.Inc(WriteNewMessagesInternal);
484-
if (MsgsWrittenTotal) {
485-
MsgsWrittenTotal.Inc(WriteNewMessages);
486-
}
478+
479+
MsgsWrittenGrpc.Inc(WriteNewMessagesInternal);
480+
MsgsWrittenTotal.Inc(WriteNewMessages);
487481
}
488482

489483
void TPartition::HandleWriteResponse(const TActorContext& ctx) {

ydb/core/persqueue/percentile_counter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ void TPartitionHistogramWrapper::Setup(bool isSupportivePartition, std::unique_p
177177
}
178178
}
179179
void TPartitionHistogramWrapper::IncFor(ui64 key, ui64 value) {
180+
if (!Inited)
181+
return;
182+
180183
if (!IsSupportivePartition) {
181184
return Histogram->IncFor(key, value);
182185
}

ydb/core/persqueue/percentile_counter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ NKikimr::NPQ::TPercentileCounter CreateSLIDurationCounter(
5959

6060
class TPartitionCounterWrapper {
6161
private:
62-
bool DoSave;
63-
bool DoReport;
62+
bool DoSave = false;
63+
bool DoReport = false;
6464
TMaybe<NKikimr::NPQ::TMultiCounter> Counter;
6565
ui64 CounterValue = 0;
6666
bool Inited = false;

0 commit comments

Comments
 (0)