Skip to content

Conversation

mogery
Copy link

@mogery mogery commented Jan 20, 2024

Fixes #3324
/claim #3324

This PR adds a new package, snapshot_manager, which houses the SnapshotManager struct. The SnapshotManager abstracts (SnapshotFile) the filesystem-dependent parts of snapshots away from the rest of the codebase, which allows us to write two "backends" for snapshot storage: local and S3.

The local backend is 99% ported over from the existing code. Most of the trouble is with adjusting the existing code to use this new interface.

The S3 backend is built with the rust-s3 crate, which I've found to be the most reliable. It's battle-tested by having a million all-time downloads, it supports non-AWS S3-compatible file storage services, etc.

This is a biiiig PR which changes a considerable amount of code structure. Let me know if you like it or not. I'll be doing a larger sweep of all my changes to catch structure mistakes once the todo's finished.

To-do

  • Finish porting local backend and adjusting code for compatibility (won't build without this, don't try)
  • Add S3 backend
  • Write tests?
    • Does this need explicit testing? S3-specific testing would be good, but I'm not sure where we could get a mock for that.
  • Update docs with config changes

Checklist

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --all --all-features command?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@mogery
Copy link
Author

mogery commented Jan 21, 2024

alright, everything is working on local! i have confidence i can build this now. onto S3

@mogery
Copy link
Author

mogery commented Jan 22, 2024

Screenshot 2024-01-22 at 03 29 57

*mad scientist laughter*

@mogery
Copy link
Author

mogery commented Jan 22, 2024

I'm opening this as ready for review, but take it more as "request for comments". Everything seems to work after messing around a bit, and all the tests run, but I haven't tested yet for any accidental breaking API or backwards compatibility issues.

Concerns/notes to self:

  • how does this behave on Windows? PathBuf will use \ as a delimiter, and S3 might not like that
  • i'm fairly sure i'm failing to parse S3's Last-Modified header when converting a HEAD request to a SnapshotDescription

@mogery mogery marked this pull request as ready for review January 22, 2024 03:24
@algora-pbc algora-pbc bot mentioned this pull request Jan 22, 2024
@generall
Copy link
Member

Hey @mogery, thanks for the PR!
It is indeed huge and would take significant time to review all together.
I would appreciate if you could split this PR into several independent ones, it would significantly speed up the review.

@mogery
Copy link
Author

mogery commented Jan 22, 2024

I would appreciate if you could split this PR into several independent ones, it would significantly speed up the review.

Hey, it's sort of hard to split, since it's an architectural change, and I can't really break it down without breaking build. I could break it down into two: one that just switches everything to use SnapshotManager, and another one which adds S3 support to it, but I'm not sure how much that would help.

@mogery
Copy link
Author

mogery commented Jan 22, 2024

Gonna take a look at the failing tests soon and fix 'em up.

@mogery
Copy link
Author

mogery commented Jan 23, 2024

sorry, sent that message right before realizing that i was running the tests in the wrong directory...

anyways, i've fixed everything up now. all tests run for me on local both with the local backend and with S3. hopefully this time it all passes on your side too

@mogery
Copy link
Author

mogery commented Jan 23, 2024

i've also verified that nothing is present in the local snapshot folder (at idle, temp files are still created now and then) when using S3

@mogery
Copy link
Author

mogery commented Jan 25, 2024

I'm very confused. All the integration tests run successfully on my local machine. Here's a log.

Exit code is reliably 0 for me.

EDIT: seems like i'm running the wrong test actually...

@mogery
Copy link
Author

mogery commented Jan 25, 2024

Another round of fixes done. Ran even more tests on local, everything is coming back green.

@mogery
Copy link
Author

mogery commented Jan 25, 2024

Heh, I didn't see that that one failed, because I couldn't see the exit code. Anyways, should be fixed. Thanks for bearing with me.

@mogery
Copy link
Author

mogery commented Jan 25, 2024

I'll also be running the whole test suite while mounted to S3 tomorrow.

@mogery
Copy link
Author

mogery commented Feb 1, 2024

hi there @generall, any updates on reviewing this?

@generall
Copy link
Member

generall commented Feb 2, 2024

hey @mogery, review of that big pr requires about 4 hours uninterrupted timeframe. If possible, could you please split it into smaller pieces?

@mogery
Copy link
Author

mogery commented Feb 4, 2024

@generall Closing this PR and splitting it into two.

@mogery mogery closed this Feb 4, 2024
@mogery mogery mentioned this pull request Feb 4, 2024
9 tasks
@mogery
Copy link
Author

mogery commented Feb 4, 2024

Superseded by #3520 and [TBD]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants