Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tx counters crash #9514

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions ydb/core/persqueue/partition_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions ydb/core/persqueue/percentile_counter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions ydb/core/persqueue/percentile_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ NKikimr::NPQ::TPercentileCounter CreateSLIDurationCounter(

class TPartitionCounterWrapper {
private:
bool DoSave;
bool DoReport;
bool DoSave = false;
bool DoReport = false;
TMaybe<NKikimr::NPQ::TMultiCounter> Counter;
ui64 CounterValue = 0;
bool Inited = false;
Expand Down
Loading