diff --git a/ydb/core/persqueue/partition_write.cpp b/ydb/core/persqueue/partition_write.cpp index a9a592a794eb..cdaccb425329 100644 --- a/ydb/core/persqueue/partition_write.cpp +++ b/ydb/core/persqueue/partition_write.cpp @@ -470,20 +470,14 @@ void TPartition::UpdateAfterWriteCounters(bool writeComplete) { // If supportive - update counters only prior to write, otherwise - only after writes; return; } - if (BytesWrittenGrpc) - BytesWrittenGrpc.Inc(WriteNewSizeInternal); - if (BytesWrittenTotal) - BytesWrittenTotal.Inc(WriteNewSize); - - if (BytesWrittenUncompressed) - BytesWrittenUncompressed.Inc(WriteNewSizeUncompressed); + BytesWrittenGrpc.Inc(WriteNewSizeInternal); + BytesWrittenTotal.Inc(WriteNewSize); + BytesWrittenUncompressed.Inc(WriteNewSizeUncompressed); if (BytesWrittenComp) BytesWrittenComp.Inc(WriteCycleSize); - if (MsgsWrittenGrpc) - MsgsWrittenGrpc.Inc(WriteNewMessagesInternal); - if (MsgsWrittenTotal) { - MsgsWrittenTotal.Inc(WriteNewMessages); - } + + MsgsWrittenGrpc.Inc(WriteNewMessagesInternal); + MsgsWrittenTotal.Inc(WriteNewMessages); } void TPartition::HandleWriteResponse(const TActorContext& ctx) { diff --git a/ydb/core/persqueue/percentile_counter.cpp b/ydb/core/persqueue/percentile_counter.cpp index 85edf4a950e4..dec88c19391d 100644 --- a/ydb/core/persqueue/percentile_counter.cpp +++ b/ydb/core/persqueue/percentile_counter.cpp @@ -177,6 +177,9 @@ void TPartitionHistogramWrapper::Setup(bool isSupportivePartition, std::unique_p } } void TPartitionHistogramWrapper::IncFor(ui64 key, ui64 value) { + if (!Inited) + return; + if (!IsSupportivePartition) { return Histogram->IncFor(key, value); } diff --git a/ydb/core/persqueue/percentile_counter.h b/ydb/core/persqueue/percentile_counter.h index 89ec2a2dddc9..cb78e7e49b54 100644 --- a/ydb/core/persqueue/percentile_counter.h +++ b/ydb/core/persqueue/percentile_counter.h @@ -59,8 +59,8 @@ NKikimr::NPQ::TPercentileCounter CreateSLIDurationCounter( class TPartitionCounterWrapper { private: - bool DoSave; - bool DoReport; + bool DoSave = false; + bool DoReport = false; TMaybe Counter; ui64 CounterValue = 0; bool Inited = false;