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

Add local ingestion client to indexer-alt #19924

Merged
merged 7 commits into from
Oct 21, 2024
Merged

Conversation

lxfind
Copy link
Contributor

@lxfind lxfind commented Oct 19, 2024

Description

This PR adds an IngestionClientTrait that abstracts over checkpoint fetching.
The existing one is moved into RemoteIngestionClient.
Added a new one LocalIngestionClient to read from files.
The retry logic is kept in a top-level struct, which then calls into the traits. Each trait decides the type of error for various cases.

Test plan

Added a test.


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:

Copy link

vercel bot commented Oct 19, 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 Oct 21, 2024 3:32pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Oct 21, 2024 3:32pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Oct 21, 2024 3:32pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Oct 21, 2024 3:32pm

Copy link
Member

@amnn amnn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @lxfind ! Some minor suggestions but this is good to go. This will also be helpful for the pipeline tests I was wanting to run based off captured checkpoint data.

crates/sui-indexer-alt/src/ingestion/client.rs Outdated Show resolved Hide resolved
crates/sui-indexer-alt/src/ingestion/error.rs Outdated Show resolved Hide resolved
crates/sui-indexer-alt/src/ingestion/mod.rs Outdated Show resolved Hide resolved
@@ -57,9 +62,18 @@ impl IngestionService {
metrics: Arc<IndexerMetrics>,
cancel: CancellationToken,
) -> Result<Self> {
// TODO: Potentially support a hybrid mode where we can fetch from both local and remote.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious to hear more about this might work (what scenario you're thinking of).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Local file sources are not as reliable as remote sources, so if we use local file source, it is always better to have a fallback remote source. For instance, if the FN just started up and is still warming up, or if the FN gets stuck or even crashes for whatever reason, we would want to keep the ingestion alive.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this assuming the co-located inotify based approach? I had thought that was somewhat off the table for the near term.

Onboard for the idea of having a fallback though -- this is similar to what I had in mind for the remote ingestion set-up as well -- where the indexer would periodicially check with a fullnode whether it should switch to the fullnode's REST API for ingestion (if the fullnode is responsive and leading the indexer by a short amount), and would otherwise fallback to the ingestion service.

crates/sui-indexer-alt/src/ingestion/remote_client.rs Outdated Show resolved Hide resolved
@lxfind
Copy link
Contributor Author

lxfind commented Oct 19, 2024

All feedback addressed.
The error cleanup is non-trivial so might be worth taking another look.

Copy link
Member

@amnn amnn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

crates/sui-indexer-alt/src/ingestion/client.rs Outdated Show resolved Hide resolved
crates/sui-indexer-alt/src/ingestion/local_client.rs Outdated Show resolved Hide resolved
crates/sui-indexer-alt/src/ingestion/remote_client.rs Outdated Show resolved Hide resolved
crates/sui-indexer-alt/src/ingestion/remote_client.rs Outdated Show resolved Hide resolved
@lxfind lxfind enabled auto-merge (squash) October 21, 2024 15:31
@lxfind lxfind merged commit 6831e94 into main Oct 21, 2024
50 checks passed
@lxfind lxfind deleted the indexer-alt-add-local-client branch October 21, 2024 16:37
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