diff --git a/cloud/blockstore/libs/storage/core/disk_counters.h b/cloud/blockstore/libs/storage/core/disk_counters.h index bac5e5f2f84..c9717700512 100644 --- a/cloud/blockstore/libs/storage/core/disk_counters.h +++ b/cloud/blockstore/libs/storage/core/disk_counters.h @@ -203,6 +203,10 @@ struct TSimpleDiskCounters EPublishingPolicy::DiskRegistryBased, TSimpleCounter::ECounterType::Generic, ECounterExpirationPolicy::Permanent}; + TCounter ChecksumMismatches{ + EPublishingPolicy::DiskRegistryBased, + TSimpleCounter::ECounterType::Generic, + ECounterExpirationPolicy::Permanent}; static constexpr TMeta AllCounters[] = { MakeMeta<&TSimpleDiskCounters::BytesCount>(), @@ -233,6 +237,7 @@ struct TSimpleDiskCounters MakeMeta<&TSimpleDiskCounters::HasBrokenDevice>(), MakeMeta<&TSimpleDiskCounters::HasBrokenDeviceSilent>(), MakeMeta<&TSimpleDiskCounters::ScrubbingProgress>(), + MakeMeta<&TSimpleDiskCounters::ChecksumMismatches>(), }; }; static_assert( diff --git a/cloud/blockstore/libs/storage/partition_nonrepl/part_mirror_actor.cpp b/cloud/blockstore/libs/storage/partition_nonrepl/part_mirror_actor.cpp index 69ad03cc167..2eb20cd5f76 100644 --- a/cloud/blockstore/libs/storage/partition_nonrepl/part_mirror_actor.cpp +++ b/cloud/blockstore/libs/storage/partition_nonrepl/part_mirror_actor.cpp @@ -204,6 +204,7 @@ void TMirrorPartitionActor::CompareChecksums(const TActorContext& ctx) DescribeRange(GetScrubbingRange()).c_str(), checksums[i]); } + ++ChecksumMismatches; ReportMirroredDiskChecksumMismatch(); if (Config->GetResyncRangeAfterScrubbing()) { diff --git a/cloud/blockstore/libs/storage/partition_nonrepl/part_mirror_actor.h b/cloud/blockstore/libs/storage/partition_nonrepl/part_mirror_actor.h index bf6a61f1fd6..5f38bf9e6e4 100644 --- a/cloud/blockstore/libs/storage/partition_nonrepl/part_mirror_actor.h +++ b/cloud/blockstore/libs/storage/partition_nonrepl/part_mirror_actor.h @@ -77,6 +77,7 @@ class TMirrorPartitionActor final ui64 ScrubbingThroughput = 0; TInstant ScrubbingRangeStarted; bool ResyncRangeStarted = false; + ui32 ChecksumMismatches = 0; public: TMirrorPartitionActor( diff --git a/cloud/blockstore/libs/storage/partition_nonrepl/part_mirror_actor_stats.cpp b/cloud/blockstore/libs/storage/partition_nonrepl/part_mirror_actor_stats.cpp index 2d2416cfb95..857aab0e138 100644 --- a/cloud/blockstore/libs/storage/partition_nonrepl/part_mirror_actor_stats.cpp +++ b/cloud/blockstore/libs/storage/partition_nonrepl/part_mirror_actor_stats.cpp @@ -62,6 +62,7 @@ void TMirrorPartitionActor::SendStats(const TActorContext& ctx) } } + stats->Simple.ChecksumMismatches.Value = ChecksumMismatches; stats->Simple.ScrubbingProgress.Value = 100 * GetScrubbingRange().Start / State.GetBlockCount(); stats->Cumulative.ScrubbingThroughput.Value = ScrubbingThroughput; diff --git a/cloud/blockstore/libs/storage/partition_nonrepl/part_mirror_ut.cpp b/cloud/blockstore/libs/storage/partition_nonrepl/part_mirror_ut.cpp index ca26103f4e0..24222167297 100644 --- a/cloud/blockstore/libs/storage/partition_nonrepl/part_mirror_ut.cpp +++ b/cloud/blockstore/libs/storage/partition_nonrepl/part_mirror_ut.cpp @@ -1184,6 +1184,7 @@ Y_UNIT_TEST_SUITE(TMirrorPartitionTest) 2 * 4_MB, counters.Cumulative.ScrubbingThroughput.Value); UNIT_ASSERT_VALUES_EQUAL(33, counters.Simple.ScrubbingProgress.Value); + UNIT_ASSERT_VALUES_EQUAL(0, counters.Simple.ChecksumMismatches.Value); } Y_UNIT_TEST(ShouldFindChecksumMismatch) @@ -1234,6 +1235,7 @@ Y_UNIT_TEST_SUITE(TMirrorPartitionTest) true); UNIT_ASSERT_VALUES_EQUAL(2, mirroredDiskChecksumMismatch->Val()); + UNIT_ASSERT_VALUES_EQUAL(2, counters.Simple.ChecksumMismatches.Value); const auto range3 = TBlockRange64::WithLength(1025, 50); env.WriteMirror(range3, 'A'); @@ -1250,6 +1252,7 @@ Y_UNIT_TEST_SUITE(TMirrorPartitionTest) runtime.AdvanceCurrentTime(UpdateCountersInterval); runtime.DispatchEvents({}, TDuration::MilliSeconds(50)); } + UNIT_ASSERT_VALUES_EQUAL(3, counters.Simple.ChecksumMismatches.Value); UNIT_ASSERT_VALUES_EQUAL(3, mirroredDiskChecksumMismatch->Val()); // check that all ranges was resynced and there is no more mismatches @@ -1264,6 +1267,7 @@ Y_UNIT_TEST_SUITE(TMirrorPartitionTest) runtime.AdvanceCurrentTime(UpdateCountersInterval); runtime.DispatchEvents({}, TDuration::MilliSeconds(50)); } + UNIT_ASSERT_VALUES_EQUAL(3, counters.Simple.ChecksumMismatches.Value); UNIT_ASSERT_VALUES_EQUAL(3, mirroredDiskChecksumMismatch->Val()); }