Skip to content

Commit 62a72cf

Browse files
Fix tx counters bug (#9498)
1 parent 502a29d commit 62a72cf

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

ydb/core/persqueue/partition_write.cpp

+6-12
Original file line numberDiff line numberDiff line change
@@ -472,20 +472,14 @@ void TPartition::UpdateAfterWriteCounters(bool writeComplete) {
472472
// If supportive - update counters only prior to write, otherwise - only after writes;
473473
return;
474474
}
475-
if (BytesWrittenGrpc)
476-
BytesWrittenGrpc.Inc(WriteNewSizeInternal);
477-
if (BytesWrittenTotal)
478-
BytesWrittenTotal.Inc(WriteNewSize);
479-
480-
if (BytesWrittenUncompressed)
481-
BytesWrittenUncompressed.Inc(WriteNewSizeUncompressed);
475+
BytesWrittenGrpc.Inc(WriteNewSizeInternal);
476+
BytesWrittenTotal.Inc(WriteNewSize);
477+
BytesWrittenUncompressed.Inc(WriteNewSizeUncompressed);
482478
if (BytesWrittenComp)
483479
BytesWrittenComp.Inc(WriteCycleSize);
484-
if (MsgsWrittenGrpc)
485-
MsgsWrittenGrpc.Inc(WriteNewMessagesInternal);
486-
if (MsgsWrittenTotal) {
487-
MsgsWrittenTotal.Inc(WriteNewMessages);
488-
}
480+
481+
MsgsWrittenGrpc.Inc(WriteNewMessagesInternal);
482+
MsgsWrittenTotal.Inc(WriteNewMessages);
489483
}
490484

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

ydb/core/persqueue/percentile_counter.cpp

+3
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

+2-2
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)