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: generate .forest.car.zst files by default #3283

Merged
merged 3 commits into from
Jul 27, 2023

Conversation

lemmih
Copy link
Contributor

@lemmih lemmih commented Jul 27, 2023

Summary of changes

Changes introduced in this pull request:

  • forest-cli snapshot export generates .forest.car.zst output,
  • forest-cli archive export generates .forest.car.zst output.
  • bug fix: use tipset timestamp (rather than now()) when exporting.

It's more work to generate .forest.car.zst files but the new encoder is much faster than the old one. All in all, exporting is now a lot faster and the generated compressed files can be loaded directly into Forest.

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

@lemmih lemmih marked this pull request as ready for review July 27, 2023 10:06
@lemmih lemmih requested a review from a team as a code owner July 27, 2023 10:06
@lemmih lemmih requested review from hanabi1224 and sudo-shashank and removed request for a team July 27, 2023 10:06
tipset: &Tipset,
lookup_depth: ChainEpochDelta,
writer: W,
compressed: bool,
writer: impl AsyncWrite + Unpin,
Copy link
Contributor

Choose a reason for hiding this comment

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

How about writer: impl AsyncBufWrite + Unpin to enforce using BufWriter here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we want to enforce that?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see most of the export calls are passing File instead of BufWriter, should it be beneficial to use BufWriter given these exported snapshots are pretty large? if it is, should we enforce using BufWriter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

BufWriter isn't automatically better, and it only improves performance when you have a lot of small writes. We do not have a lot of small writes.

@lemmih lemmih added this pull request to the merge queue Jul 27, 2023
@@ -54,6 +54,8 @@
lookup errors instead of silently ignoring them.
- [#2999](https://github.com/ChainSafe/forest/issues/2999): Restored `--tipset`
flag to `forest-cli snapshot export` to allow export at a specific tipset.
- [#3283](https://github.com/ChainSafe/forest/pull/3283): All generated car
Copy link
Member

Choose a reason for hiding this comment

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

It's a breaking change, right?

Copy link
Member

Choose a reason for hiding this comment

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

In other words, should any services (e.g., upload snapshot) be updated to this logic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Surprisingly it is not! The files are all backward compatible. The new snapshots can still be used with old versions of Forest or even with Lotus. They just won't get any of the new cool benefits.

Copy link
Member

Choose a reason for hiding this comment

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

Are we also good with extensions and many regular expressions to match files?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh,yeah, we'll need to update some regexes.

@LesnyRumcajs
Copy link
Member

It'd be nice to update tests to enforce this behaviour.
https://github.com/ChainSafe/forest/blob/main/scripts/tests/calibnet_export_check.sh#L18-L19

Merged via the queue into main with commit 6dbd776 Jul 27, 2023
23 checks passed
@lemmih lemmih deleted the lemmih/forest-car-zst-default branch July 27, 2023 13:32
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.

None yet

4 participants