Fix replicas-check counters being reset per ledger range#4822
Open
SongOf wants to merge 1 commit into
Open
Conversation
9f21b5c to
f73b696
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Descriptions of the changes in this PR:
Motivation
AuditorReplicasCheckTask.replicasCheck()scans all ledger metadata inLedgerRangechunks. At the top of every range iteration it reset the three
numLedgersFoundHaving{NoReplica,LessThanAQ,LessThanWQ}OfAnEntrycounters to0, butrunTask()reads them and publishes the gauges only once, after the whole run completes.As a result, a finding in an earlier range was wiped by any later range, so the
NUM_LEDGERS_HAVING_NO_REPLICA_OF_AN_ENTRY/NUM_LEDGERS_HAVING_LESS_THAN_AQ_REPLICAS_OF_AN_ENTRY/NUM_LEDGERS_HAVING_LESS_THAN_WQ_REPLICAS_OF_AN_ENTRYgauges reflected only the lastledger range and severely undercounted ledgers with missing / under-replicated entries
whenever ledgers span more than one range. Monitoring and alerting built on these gauges
is therefore misleading.
Changes
all ledger ranges. The
ledgersWithMissingEntries/ledgersWithUnavailableBookiesmapsremain per-range scratch state (still cleared each iteration and reported at the end of
that iteration).
AuditorReplicasCheckTaskCrossRangeTest, a focused Mockito unit test (no cluster,fully deterministic): two ledger ranges, an unhealthy ledger below write-quorum in the
first range and a healthy ledger in the second. It fails on the unpatched code
(gauge
0instead of1) and passes after the fix.This is an internal metric-accounting fix; it does not change any public API, schema, wire
protocol, REST endpoint, CLI option, or configuration.