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

algod importer: Auto catchpoint label lookup. #65

Merged
merged 17 commits into from
May 4, 2023

Conversation

winder
Copy link
Contributor

@winder winder commented Apr 28, 2023

Summary

Adds a new option to automatically lookup an appropriate catchpoint label during startup.

Test Plan

New unit tests.

Manually run conduit with -r 27000001 to see that the correct catchpoint label is automatically populated.

@codecov
Copy link

codecov bot commented Apr 28, 2023

Codecov Report

Merging #65 (1e2d90f) into master (442791a) will increase coverage by 1.79%.
The diff coverage is 75.41%.

@@            Coverage Diff             @@
##           master      #65      +/-   ##
==========================================
+ Coverage   67.66%   69.45%   +1.79%     
==========================================
  Files          32       33       +1     
  Lines        1976     2118     +142     
==========================================
+ Hits         1337     1471     +134     
+ Misses        570      569       -1     
- Partials       69       78       +9     
Impacted Files Coverage Δ
conduit/data/block_export_data.go 100.00% <ø> (+92.30%) ⬆️
conduit/plugins/importers/algod/metrics.go 100.00% <ø> (ø)
...lugins/exporters/postgresql/postgresql_exporter.go 66.66% <51.21%> (-11.54%) ⬇️
conduit/pipeline/pipeline.go 66.09% <72.10%> (+0.64%) ⬆️
conduit/data/config.go 76.47% <76.47%> (ø)
conduit/plugins/importers/algod/algod_importer.go 84.69% <88.17%> (-3.62%) ⬇️
conduit/pipeline/errors.go 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@winder winder requested review from Eric-Warehime, shiqizng and a team April 28, 2023 18:47
@winder winder marked this pull request as ready for review April 28, 2023 18:47
@winder winder requested a review from Eric-Warehime May 3, 2023 12:09
@winder winder requested review from tzaffi and algochoi May 3, 2023 13:40
conduit/plugins/importers/algod/README.md Outdated Show resolved Hide resolved
docs/tutorials/IndexerWriter.md Outdated Show resolved Hide resolved
conduit/plugins/importers/algod/algod_importer.go Outdated Show resolved Hide resolved
Copy link
Contributor

@tzaffi tzaffi left a comment

Choose a reason for hiding this comment

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

Still reading but it's a good juncture to submit some feedback.

# testnet: https://algorand-catchpoints.s3.us-east-2.amazonaws.com/consolidated/testnet_catchpoints.txt
# Automatically download an appropriate catchpoint label. If false, you
# must specify a catchpoint to use fast catchup.
auto: false
Copy link
Contributor

Choose a reason for hiding this comment

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

Given the language of the algod importer plugin's README, auto is a bit confusing.

It says:

If ... the plugin will automatically run fast catchup on startup if the node is behind the current pipeline round

So to me, "auto" seems redundant, though clearly it isn't.

  • I see two approaches. Remove "automatically" from the README
  • Rename auto to something else like latest-available, or latest, or pipeline-latest, or something like that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Which approach would you recommend? I updated the readme to clarify what was being done automatically. But maybe the setting name could also be clearer?

This comment was marked as duplicate.

Copy link
Contributor

Choose a reason for hiding this comment

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

To answer your question, I'm leaning towards just modding the README. auto is a sensible name (or the opposite manual as well)

Copy link
Contributor

Choose a reason for hiding this comment

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

And to answer my own question, the following script seems to work. So yeah, you do need to call sync before starting conduit:

%%bash
export DATA_NODE=follower

just stop_and_nuke || true

just pub-create conduit mainnet

just start

just algod /v2/ledger/sync/26589217 POST
just algod /v2/ledger/sync

../cmd/conduit/conduit -d ./data --next-round-override 26589217

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for the confusion. I've figured out the problem. You need the changes in go-algorand#5349. Without them you run into this error: https://github.com/algorand/go-algorand/pull/5349/files#r1185050820

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm... I did pull down and make the latest from 5349. When I run:

❯ goal --version
12886130966
3.16.180502.dev [HEAD] (commit #28487271+)
go-algorand is licensed with AGPLv3.0
source code available at https://github.com/algorand/go-algorand

and git log gives:

commit 284872714e46ae7504e02a7288c9837a000942a3 (HEAD, will/will/follower-catchup-pause)
Author: Will Winder <wwinder.unh@gmail.com>
Date:   Wed May 3 07:19:57 2023 -0400

    Remove old test.

So are the errors I'm seeing necessarily from your link?

Copy link
Contributor

Choose a reason for hiding this comment

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

One possible issue is that I'm merging into another branch. I'll try a clean version of the commit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ran again with a clean version of this PR. Taking some notes:

Command:

❯ conduit -d ./data2 -r 10009217
... after around 30 seconds ...
{"__type":"Conduit","_name":"main","level":"info","msg":"Pipeline round: 10009217","time":"2023-05-04T10:25:38-05:00"}
... another minute or so ...
{"__type":"processor","_name":"algod","level":"error","msg":"error getting block for round 10009217 (attempt 0)","time":"2023-05-04T10:26:38-05:00"}
{"__type":"processor","_name":"algod","level":"error","msg":"error getting block for round 10009217 (attempt 1)","time":"2023-05-04T10:27:38-05:00"}

at the same time getting algod's status (30s and around 3 minutes in)

❯ just status
Last committed block: 6483
Time since last block: 0.0s
Sync Time: 33.6s
Last consensus protocol: https://github.com/algorandfoundation/specs/tree/5615adc36bad610c7f165fa2967f4ecfa75125f0
Next consensus protocol: https://github.com/algorandfoundation/specs/tree/5615adc36bad610c7f165fa2967f4ecfa75125f0
Round for next consensus protocol: 6484
Next consensus protocol supported: true
Last Catchpoint: 
Genesis ID: mainnet-v1.0
Genesis hash: wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=
RUNNING
❯ just status
Last committed block: 39148
Time since last block: 0.0s
Sync Time: 225.6s
Last consensus protocol: https://github.com/algorandfoundation/specs/tree/5615adc36bad610c7f165fa2967f4ecfa75125f0
Next consensus protocol: https://github.com/algorandfoundation/specs/tree/5615adc36bad610c7f165fa2967f4ecfa75125f0
Round for next consensus protocol: 39149
Next consensus protocol supported: true
Last Catchpoint: 
Genesis ID: mainnet-v1.0
Genesis hash: wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=
RUNNING

Copy link
Contributor

Choose a reason for hiding this comment

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

Ended up failing the same way as before.

Copy link
Contributor

@tzaffi tzaffi left a comment

Choose a reason for hiding this comment

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

not finished reading, but want to address a question

docs/tutorials/IndexerMigration.md Show resolved Hide resolved
# testnet: https://algorand-catchpoints.s3.us-east-2.amazonaws.com/consolidated/testnet_catchpoints.txt
# Automatically download an appropriate catchpoint label. If false, you
# must specify a catchpoint to use fast catchup.
auto: false

This comment was marked as duplicate.

Copy link
Contributor

@tzaffi tzaffi left a comment

Choose a reason for hiding this comment

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

Convinced that the issues I'm encountering are un-related to this PR, and that this work solves the problems in question.

@winder winder merged commit 86f8b0c into algorand:master May 4, 2023
@winder winder deleted the will/auto-fast-catchup branch May 4, 2023 17:42
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.

4 participants