Repository navigation
fix(indexer): retry a message when a configured verifier did not start #1634
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
Open
carte7000
wants to merge
2
commits into
feat/indexer/replica/devenv
from
feat/indexer/replica/unavailable-verifier
+344
−12
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
changelog/2026-11-23_indexer_unavailable_verifier_retry.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # Indexer retries a message when a configured verifier did not start | ||
|
|
||
| ## Executive Summary | ||
|
|
||
| - When the reader of a configured verifier does not start, the indexer now counts that verifier as unavailable. The message retries until its deadline. | ||
| - Before this change, the task treated the address as unknown and ignored it. The message could become `SUCCESS` without the verifications of that verifier. | ||
| - Config validation now rejects an invalid or repeated issuer address in a verifier, so a config error stops the indexer at boot. Only a reader that does not start makes a verifier unavailable. | ||
| - Two new metrics show unavailable verifiers and the message attempts that they block. | ||
| - This change affects `indexer/pkg/registry`, `indexer/pkg/worker`, `indexer/pkg/config`, `indexer/pkg/monitoring`, `indexer/pkg/common` and `indexer/cmd`. | ||
| - It adds two registry methods, two labeler methods and one pool method. It has no schema changes. | ||
|
|
||
| ## AI Adapter Index | ||
|
|
||
| | Symbol | Kind | Search | Location | Section | | ||
| |---|---|---|---|---| | ||
| | `worker.TaskResult.UnavailableCCVs` | behavior-changed | `UnavailableCCVs` | `indexer/pkg/worker/worker.go` | [#unavailable-ccvs-include-unstarted-verifiers](#unavailable-ccvs-include-unstarted-verifiers) | | ||
| | `registry.VerifierRegistry.MarkUnavailable`, `IsUnavailable` | added | `MarkUnavailable\(\|IsUnavailable\(` | `indexer/pkg/registry/verifier_registry.go` | [#registry-records-unstarted-verifiers](#registry-records-unstarted-verifiers) | | ||
| | `common.IndexerMetricLabeler.RecordVerifierUnavailableGauge`, `IncrementUnavailableVerifierRetries` | signature-changed | `IndexerMetricLabeler\b` | `indexer/pkg/common/metrics.go` | [#metrics](#metrics) | | ||
| | `worker.Pool.SetMetrics` | added | `SetMetrics\(` | `indexer/pkg/worker/worker_pool.go` | [#metrics](#metrics) | | ||
| | `config.Config.Validate` issuer addresses | behavior-changed | `IssuerAddresses` | `indexer/pkg/config/config.go` | [#config-validation-rejects-bad-issuer-addresses](#config-validation-rejects-bad-issuer-addresses) | | ||
|
|
||
| ## Breaking Changes | ||
|
|
||
| ### Config validation rejects bad issuer addresses | ||
|
|
||
| - **What changed:** `Config.Validate` rejects a `[[Verifiers]]` entry with an issuer address that is not valid hex, or with the same address two times. Before, startup skipped that verifier. | ||
| - The same address in two verifiers is still valid. HA setups use it. | ||
| - **Who is affected:** deploy configs with a bad issuer address. The indexer does not start until you correct the config. | ||
|
|
||
| ### IndexerMetricLabeler has two new methods | ||
|
|
||
| - **Who is affected:** custom `IndexerMetricLabeler` implementations. Add the two methods in [Metrics](#metrics). Regenerate mocks with `just mock`. | ||
|
|
||
| ## Migration Guide | ||
|
|
||
| 1. Validate each deploy config before the rollout. Correct all invalid or repeated issuer addresses. | ||
| 2. Add `RecordVerifierUnavailableGauge` and `IncrementUnavailableVerifierRetries` to custom `IndexerMetricLabeler` implementations. | ||
| 3. Regenerate mocks: `just mock`. | ||
|
|
||
| ## New Features / Additions | ||
|
|
||
| ### Registry records unstarted verifiers | ||
|
|
||
| - `VerifierRegistry.MarkUnavailable(address, name)` records a configured address whose reader did not start, and its verifier name. | ||
| - `VerifierRegistry.IsUnavailable(address)` returns true when the address is marked and has no registered reader. | ||
| - `cmd/main.go` calls `MarkUnavailable` for each issuer address of a verifier that `createReadersForVerifier` skips. | ||
| - After the config validation, a skip occurs only when the reader cannot be created or started. | ||
|
|
||
| ### Unavailable CCVs include unstarted verifiers | ||
|
|
||
| - `Task.loadVerifierReaders` returns a fourth list: the addresses that are configured but have no started reader. | ||
| - `Execute` adds these addresses to `TaskResult.UnavailableCCVs`. The worker retries a message while `UnavailableCCVs > 0`. | ||
| - An address that is in no `[[Verifiers]]` entry stays unknown. The task logs it and does not count it, as before. | ||
| - **Why:** With more than one replica, each replica builds its own registry. A replica with a failed reader could set `SUCCESS` before the other replicas collect the missing verification. | ||
|
|
||
| ## Metrics | ||
|
|
||
| - **Added:** `indexer_verifier_unavailable` (gauge, label `verifier`). It is 1 when a configured verifier has no started reader on this replica, else 0. Startup records it for each verifier. Alert when it is above 0. | ||
| - **Added:** `indexer_unavailable_verifier_retries_total` (counter, label `verifier`). It counts the message attempts that retry because the verifier has no started reader. `Pool.SetMetrics` gives the labeler to the tasks. | ||
|
|
||
| ## Compatibility & Requirements | ||
|
|
||
| - **Rollout:** no special steps. The change applies per replica at startup. | ||
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In what situation would we have a case of unavailable CCVs in practice? Seems like it would be very rare? Looking at the bootup toml code unknown Type is already rejected. deduplication is also done so there won't be duplicates. so most likely the error will be due to invalid Issuer address if they are hand-typed in the config. But even that comes from datastore
I generally agree that marking UNAVAILABLE is better than not even registering. But doesn't this open a silent delay in messages if there is a misconfigured verifier config. Because all messages will continue to retry until timeout because the verifier is unavailable. Would be nicer if this is caught before boot (like reject the toml invalid error)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's a good callout, we should catch as much as we can early in the config validation and only have unavailable in exceptional case. We should be loud about it if it ever happen so will add the metric there as well