-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat: add and port to SnapshotManager #3520
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
Conversation
@generall This is -- in my opinion -- the smallest PR that makes sense and doesn't break build. It might still be too big, but it doesn't include the S3 code, so that's one less thing to test and review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @mogery, thanks for PR! I think overall it is moving into the right direction, however I think it might benefit from making
SnapshotManager
less global and more independent entity. Here is how I can see that:
-
SnapshotManager
doesn't really have any internal state. It can be easily created from the configuration (even with s3 support enabled).
All relevant structures in the code (ToC, Collection, Shard) have access to storage configuration, so it should be easy to buildSnapshotManager
on demand. -
Current
SnapshotManager
knows too much about the whole project structure. E.g. it knows about the concept of shard_ids and collections. At the same time Collection should know aboutSnapshotManager
which either create circular dependency or forces us to drop proper types at compile time (see the commend about u32 as shard is). I propose to makeSnapshotManager
more local, let it only work with single given "directory" and abstract it away from differenciation of the snapshot types.
Those two changes should allow making PR much more compact, avoid extra parameters in seemingly unrelated function, and also should allow to test Snapshot manager independently from the ToC and other storage structures.
Thank you for the review @generall!
Great catch! I didn't realize that but I totally agree.
I think we can do it even better: in the S3 code to handle I'll make the changes this afternoon. |
- not a global struct, instead it is easily instantiatable anytime - snapshotfile has been deleted, snapshotmanagers work with paths and are scoped to single directories instead and unaware of project structure
@generall Made the following changes:
I didn't have time to run any integration tests, so I'd appreciate a CI run. :) |
…ad of trying to derive name this decreases structural awareness of SnapshotManager
Fixed the failing tests. |
Hey @mogery, unfortunately the PR still have too big impact on the internals, which makes it very hard too review and validate. There are many places where I propose to remove all of those places and try to keep PR at least within 1000 lines of code (ideally within 500 lines) |
Closing in favor of #4150 |
Supersedes #3430 (part 1)
This PR centralises all snapshot file management code in a SnapshotManager struct, and ports everything to use it. This is needed to provide an abstraction for snapshot files, so that we can store them not only locally, but also on S3 (will be introduced in a future PR).
It also introduces a SnapshotFile struct which replaces
PathBuf
s that were used to refer to snapshots before.All Submissions:
dev
branch. Did you create your branch fromdev
?New Feature Submissions:
cargo +nightly fmt --all
command prior to submission?cargo clippy --all --all-features
command?Changes to Core Features: