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

feat(ci): create disk image after a successful full sync test #3986

Merged
merged 27 commits into from
Apr 6, 2022

Conversation

dconnolly
Copy link
Contributor

@dconnolly dconnolly commented Mar 28, 2022

Motivation

We need a fully-synced zebrad state (or pretty close) to do fast lightwalletd-zebrad tests (and maybe other things).

Solution

On successful full sync test, create a disk image in gcloud from the vm image that the test has been writing to, named zebrad-cache-$COMMIT_SHA_SHORT-mainnet.

Resolves #3545

Review

@gustavovalverde

Reviewer Checklist

  • Works correctly

Follow Up Work

It would be nice/handy to include the block height where we stopped syncing in the name of the image, we probably need to extract that with a regex from the sync logs, similar to how we do to get the container name in earlier workflow steps. Done!

We should also include the state version (v14, etc) in the name/metadata. Done!

@dconnolly dconnolly added A-infrastructure Area: Infrastructure changes A-devops Area: Pipelines, CI/CD and Dockerfiles P-High 🔥 labels Mar 28, 2022
@dconnolly dconnolly requested a review from a team as a code owner March 28, 2022 22:14
@dconnolly dconnolly self-assigned this Mar 28, 2022
@dconnolly dconnolly requested review from gustavovalverde and removed request for a team March 28, 2022 22:14
@gustavovalverde
Copy link
Member

gustavovalverde commented Mar 28, 2022

@dconnolly Are we going to add the following to this PR or in a separate one?

  • Make sure the triggers for the workflow fire on changes to state format, lightwalletd support tweaks, etc
  • Name the image with the block height
  • Put the state version in the name

@teor2345
Copy link
Contributor

  • Make sure the triggers for the workflow fire on changes to state format, lightwalletd support tweaks, etc

The cached state database version should change whenever we make lightwalletd state changes. So these checks should be the same thing.

(And the same as the existing cached state triggers for the post-Canopy sync workflow.)

Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

If we want to run a testnet sync, we'll need to change:
FULL_SYNC_MAINNET_TIMEOUT_MINUTES to:
FULL_SYNC_TESTNET_TIMEOUT_MINUTES.

This is a missing feature in the current workflow.

@dconnolly
Copy link
Contributor Author

@dconnolly Are we going to add the following to this PR or in a separate one?

  • Make sure the triggers for the workflow fire on changes to state format, lightwalletd support tweaks, etc

Oh yes, we have to update the triggers to not just be pre-merge by Mergify, or manual, right? It currently runs every time *.rs changes, deps change, or the workflow yaml changes.

  • Name the image with the block height

We can do some regex to extract this from the stdout as it is now

  • Put the state version in the name

We may have to make Zebra changes to extract this in a nice way

@teor2345
Copy link
Contributor

  • Put the state version in the name

We may have to make Zebra changes to extract this in a nice way

Zebra logs the state version and network when it opens the state, it looks like:

Mar 28 19:18:49.565 INFO {zebrad="9e065b5" net="Main"}: zebra_state::service::finalized_state::disk_db: Opened Zebra state cache at /home/user/.cache/zebra/state/v18/mainnet

@dconnolly
Copy link
Contributor Author

  • Put the state version in the name

We may have to make Zebra changes to extract this in a nice way

Zebra logs the state version and network when it opens the state, it looks like:

Mar 28 19:18:49.565 INFO {zebrad="9e065b5" net="Main"}: zebra_state::service::finalized_state::disk_db: Opened Zebra state cache at /home/user/.cache/zebra/state/v18/mainnet

Nice

Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

Is this blocked by making the full sync faster, so it actually finishes?
Or can we just merge this feature, and make the full sync faster later?

@dconnolly
Copy link
Contributor Author

Is this blocked by making the full sync faster, so it actually finishes? Or can we just merge this feature, and make the full sync faster later?

We can merge as soon as the test run succeeds, I think everything is fast enough to finish

@teor2345
Copy link
Contributor

Is this blocked by making the full sync faster, so it actually finishes? Or can we just merge this feature, and make the full sync faster later?

We can merge as soon as the test run succeeds, I think everything is fast enough to finish

We've only had one successful full sync test in the last few days, the others have timed out:
https://github.com/ZcashFoundation/zebra/actions/workflows/test-full-sync.yml

I don't think that's a blocker for adding cached state. But it is a blocker for using the cached state.

@teor2345
Copy link
Contributor

Should we also be running a full sync when the workflow changes?
Or is it ok to just manually test this workflow?

@dconnolly dconnolly added the do-not-merge Tells Mergify not to merge this PR label Mar 31, 2022
Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

I'm happy to merge this, but I'd like Gustavo to check today's fixes as well.

Copy link
Member

@gustavovalverde gustavovalverde left a comment

Choose a reason for hiding this comment

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

I added some comments, most are oriented to keep those changes in a different PR, and around the use of variables.

.github/workflows/test-full-sync.yml Outdated Show resolved Hide resolved
.github/workflows/test-full-sync.yml Outdated Show resolved Hide resolved
.github/workflows/test-full-sync.yml Outdated Show resolved Hide resolved
.github/workflows/test-full-sync.yml Outdated Show resolved Hide resolved
.github/workflows/test-full-sync.yml Show resolved Hide resolved
.github/workflows/test-full-sync.yml Show resolved Hide resolved
.github/workflows/test-full-sync.yml Show resolved Hide resolved
.github/workflows/test-full-sync.yml Show resolved Hide resolved
.github/workflows/test-full-sync.yml Outdated Show resolved Hide resolved
@dconnolly dconnolly force-pushed the create-disk-image-from-full-sync branch from 69aa670 to 5475262 Compare April 1, 2022 23:47
@dconnolly dconnolly requested a review from teor2345 April 2, 2022 02:17
@dconnolly
Copy link
Contributor Author

Yay

image

@teor2345 teor2345 added do-not-merge Tells Mergify not to merge this PR and removed do-not-merge Tells Mergify not to merge this PR labels Apr 4, 2022
@teor2345 teor2345 requested a review from gustavovalverde April 5, 2022 20:06
Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

I'm happy with this PR, but I don't want to approve it before Gustavo has checked his comments.

@gustavovalverde
Copy link
Member

gustavovalverde commented Apr 5, 2022

@teor2345 @dconnolly I posted a few review comments, are you able to see those? (just to confirm is not happening as last time that I was the only one seeing the comments)

@teor2345
Copy link
Contributor

teor2345 commented Apr 5, 2022

@teor2345 @dconnolly I posted a few review comments, are you able to see those? (just to confirm is not happening as last time that I was the only one seeing the comments)

I can see your comments, but I figured Deirdre was the best person to fix them.

@teor2345
Copy link
Contributor

teor2345 commented Apr 5, 2022

Is this blocked by making the full sync faster, so it actually finishes?

Sync speed shouldn't be a blocker for this PR, so we can merge it whenever it's done.

The address index PR series (#3934 to #4038) makes the sync slower by about 2%, which makes the full sync time out more often. But PR #4040 speeds it up by about 7%, so I'm going to merge that PR before all the database changes.

dconnolly and others added 2 commits April 6, 2022 15:33
@dconnolly
Copy link
Contributor Author

@gustavovalverde reverted some of those step id removals, applied your suggested rename, left some comments on the step outputs vs env var questions 🙏

@gustavovalverde gustavovalverde changed the title Create disk image after a successful full sync test feat(ci): create disk image after a successful full sync test Apr 6, 2022
@gustavovalverde gustavovalverde merged commit 1a4f8f6 into main Apr 6, 2022
@gustavovalverde gustavovalverde deleted the create-disk-image-from-full-sync branch April 6, 2022 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-devops Area: Pipelines, CI/CD and Dockerfiles A-infrastructure Area: Infrastructure changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate stateful disks containing lightwalletd-supporting zebra-state cache
3 participants