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

indexer-alt: detect and warn against unrecognised fields. #20463

Merged
merged 1 commit into from
Nov 29, 2024

Conversation

amnn
Copy link
Contributor

@amnn amnn commented Nov 28, 2024

Description

Add an extra flattened generic, toml::Table to every file-based config struct to pick up any flags that were not recognised by the indexer.

Extra fields will be logged as a warning and then ignored when processing flags, so that we are aware of potential typos, but will not cause an error to preserve some form of backwards compatibility (e.g. imagine a new pipeline is added to the indexer, and we update its TOML and try and run an old version of the indexer with the config that mentions the new pipeline).

Test plan

Try merging together some configs that contain typos in them:

STDERR:

2024-11-27T00:29:37.177152Z  WARN sui_indexer_alt::config: Found unrecognized committer field which will be ignored by this indexer. This could be because of a typo, or because it was introduced in a newer version of the indexer:
collect-interval-secs = 1000

2024-11-27T00:29:37.177242Z  WARN sui_indexer_alt::config: Found unrecognized pipeline field which will be ignored by this indexer. This could be because of a typo, or because it was introduced in a newer version of the indexer:
[tx-affected-objects]
collect-interval-ms = 5000

2024-11-27T00:29:37.177328Z  WARN sui_indexer_alt::config: Found unrecognized consistency field which will be ignored by this indexer. This could be because of a typo, or because it was introduced in a newer version of the indexer:
consistency-range = 1000

STDOUT:

[ingestion]

[consistency]

[committer]

[pruner]

[pipeline.sum_obj_types]

[pipeline.kv_objects]

[pipeline.kv_transactions]

[pipeline.tx_calls]

Stack


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:
  • REST API:

@amnn amnn self-assigned this Nov 28, 2024
Copy link

vercel bot commented Nov 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 29, 2024 5:13pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Nov 29, 2024 5:13pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Nov 29, 2024 5:13pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Nov 29, 2024 5:13pm

## Description

Add an extra flattened generic, `toml::Table` to every file-based config
struct to pick up any flags that were not recognised by the indexer.

Extra fields will be logged as a warning and then ignored when
processing flags, so that we are aware of potential typos, but will not
cause an error to preserve some form of backwards compatibility (e.g.
imagine a new pipeline is added to the indexer, and we update its TOML
and try and run an old version of the indexer with the config that
mentions the new pipeline).

## Test plan

Try merging together some configs that contain typos in them:

STDERR:
```
2024-11-27T00:29:37.177152Z  WARN sui_indexer_alt::config: Found unrecognized committer field which will be ignored by this indexer. This could be because of a typo, or because it was introduced in a newer version of the indexer:
collect-interval-secs = 1000

2024-11-27T00:29:37.177242Z  WARN sui_indexer_alt::config: Found unrecognized pipeline field which will be ignored by this indexer. This could be because of a typo, or because it was introduced in a newer version of the indexer:
[tx-affected-objects]
collect-interval-ms = 5000

2024-11-27T00:29:37.177328Z  WARN sui_indexer_alt::config: Found unrecognized consistency field which will be ignored by this indexer. This could be because of a typo, or because it was introduced in a newer version of the indexer:
consistency-range = 1000
```

STDOUT:
```
[ingestion]

[consistency]

[committer]

[pruner]

[pipeline.sum_obj_types]

[pipeline.kv_objects]

[pipeline.kv_transactions]

[pipeline.tx_calls]

```
@amnn amnn force-pushed the amnn/idx-merge-cfg branch from 989b8c0 to 8d60b0d Compare November 29, 2024 17:09
@amnn amnn temporarily deployed to sui-typescript-aws-kms-test-env November 29, 2024 17:09 — with GitHub Actions Inactive
Base automatically changed from amnn/idx-merge-cfg to amnn/idx-cfg-ms November 29, 2024 18:17
@amnn amnn merged commit b09c57b into amnn/idx-cfg-ms Nov 29, 2024
49 checks passed
@amnn amnn deleted the amnn/idx-extra branch November 29, 2024 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants