AuditorReplicasCheckTask.replicasCheck() scans all ledger metadata in LedgerRange
chunks. At the top of every range iteration it reset the three
numLedgersFoundHaving{NoReplica,LessThanAQ,LessThanWQ}OfAnEntry counters to 0, but
runTask() 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_ENTRY gauges reflected only the last
ledger 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
Move the three counter resets to once before the range loop so they accumulate across
all ledger ranges. The ledgersWithMissingEntries / ledgersWithUnavailableBookies maps
remain per-range scratch state (still cleared each iteration and reported at the end of
that iteration).
Add 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 0 instead of 1) 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.
In order to uphold a high standard for quality for code contributions, Apache BookKeeper runs various precommit
checks for pull requests. A pull request can only be merged when it passes precommit checks.
Be sure to do all the following to help us incorporate your contribution
quickly and easily:
If this PR is a BookKeeper Proposal (BP):
Make sure the PR title is formatted like:
<BP-#>: Description of bookkeeper proposal
e.g. BP-1: 64 bits ledger is support
Attach the master issue link in the description of this PR.
Attach the google doc link if the BP is written in Google Doc.
Otherwise:
Make sure the PR title is formatted like:
<Issue #>: Description of pull request
e.g. Issue 123: Description ...
Make sure tests pass via mvn clean apache-rat:check install spotbugs:check.
Replace <Issue #> in the title with the actual Issue number.
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
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 in LedgerRange
chunks. At the top of every range iteration it reset the three
numLedgersFoundHaving{NoReplica,LessThanAQ,LessThanWQ}OfAnEntry counters to 0, but
runTask() 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_ENTRY gauges reflected only the last
ledger 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 / ledgersWithUnavailableBookies maps
remain per-range scratch state (still cleared each iteration and reported at the end of
that iteration).
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 0 instead of 1) 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.