Skip to content

Commit

Permalink
indexer-alt: detect and warn against unrecognised fields.
Browse files Browse the repository at this point in the history
## 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]

```
  • Loading branch information
amnn committed Nov 29, 2024
1 parent 04c768c commit d695cc8
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 40 deletions.
Loading

0 comments on commit d695cc8

Please sign in to comment.