-
Notifications
You must be signed in to change notification settings - Fork 42
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: Separate location for ancillary for cardano database v1 #2380
base: main
Are you sure you want to change the base?
feat: Separate location for ancillary for cardano database v1 #2380
Conversation
Test Results 3 files ± 0 57 suites ±0 11m 38s ⏱️ +3s Results for commit 80668fe. ± Comparison against base commit 81e90f7. This pull request removes 14 and adds 20 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
6883aba
to
a3294c6
Compare
…related messages Co-authored-by: Damien Lachaume <[email protected]>
This will supersede `snapshot_all` since for v1 snapshots the ancillary files will be separated into another archive. Co-authored-by: Damien Lachaume <[email protected]>
Instead of including the ancillary files. Also suppress the now unused `snapshot_all` from the `Snapshotter` trait. Co-authored-by: Damien Lachaume <[email protected]>
… creation in cdb v1 artifact builder In order to re-use the name for the ancillary archive later. Co-authored-by: Damien Lachaume <[email protected]>
…of only the last Co-authored-by: Damien Lachaume <[email protected]>
… builder Co-authored-by: Damien Lachaume <[email protected]>
…oads Superseding the previously used `LocalSnapshotUploader`. This is needed because the previous uploaders return the same location for two differents path that contains a same digest, meaning that the ancillary location was targetting the immutable location in snapshot artifacts. Co-authored-by: Damien Lachaume <[email protected]>
By splitting the `fake` module into several files so they can be browsed more easily. Co-authored-by: Damien Lachaume <[email protected]>
…fake ancillary archive Co-authored-by: Damien Lachaume <[email protected]>
Co-authored-by: Damien Lachaume <[email protected]>
Co-authored-by: Damien Lachaume <[email protected]>
…db v1 snapshot + add new feedback events related to this download. Co-authored-by: Damien Lachaume <[email protected]>
…heck Co-authored-by: Damien Lachaume <[email protected]>
a3294c6
to
e582efe
Compare
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.
LGTM
@@ -151,7 +151,7 @@ impl CardanoDbDownloadCommand { | |||
CardanoDbDownloadChecker::ensure_dir_exist(db_dir)?; | |||
if let Err(e) = CardanoDbDownloadChecker::check_prerequisites_for_archive( | |||
db_dir, | |||
cardano_db.size, | |||
cardano_db.size + cardano_db.ancillary_size.unwrap_or(0), |
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.
Is it make sense to create a function on Snapshot that compute this total size ?
pub size: u64, | ||
|
||
/// Locations where the binary content of the snapshot can be retrieved | ||
/// Size of the ancillary files in Bytes |
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.
I wonder if there is a structure that can be created with size + locations which can be used for immutable and ancillary (with an option).
It may be too much work to do that without a real value.
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.
LGTM 🚀
@@ -126,7 +127,7 @@ pub struct SnapshotClient { | |||
#[cfg(feature = "fs")] | |||
http_file_downloader: Arc<dyn FileDownloader>, | |||
#[cfg(feature = "fs")] | |||
feedback_sender: FeedbackSender, | |||
_feedback_sender: FeedbackSender, |
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.
Could you explain why this field is prefixed with an underscore? Is it to avoid a breaking change in the API?
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.
A comment was added to clarify the reason for the underscore prefix.
// Ugly horror needed to update the snapshot location after the server is started, server | ||
// which need said snapshot to start and run in another thread. | ||
// The RwLock is needed to mutate the value across threads and the Arc to transfer it | ||
// to the server thread while keeping an access on the main thread. |
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.
Maybe this comment is not really relevant:
// Ugly horror needed to update the snapshot location after the server is started, server | |
// which need said snapshot to start and run in another thread. | |
// The RwLock is needed to mutate the value across threads and the Arc to transfer it | |
// to the server thread while keeping an access on the main thread. |
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.
The comment was removed.
debug!(self.logger, ">> create_ancillary_snapshot_archive"); | ||
|
||
let snapshotter = self.snapshotter.clone(); | ||
let snapshot_name = format!("ancillary-{base_file_name_without_extension}"); |
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.
I guess that this format is better as it will be easy to see files related to the same snapshot when listed alphabetically:
let snapshot_name = format!("ancillary-{base_file_name_without_extension}"); | |
let snapshot_name = format!("{base_file_name_without_extension}-ancillary"); |
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.
Done, we modified the name by adding .ancillary
at the end to both meet your request and the function that extracts the digest from the file name:
let snapshot_name = format!("{base_file_name_without_extension}.ancillary");
…illary' at the end, and removal of the explanation comment about the technical reason for the use of RwLock in the test tooling of client integration tests.
5581b05
to
f2da5a6
Compare
… `SnapshotClient` API compatibility
Content
This PR upgrade cardano database v1 snapshots, instead of producing one archive that contains the whole database, two archives are produced:
locations
andsize
).ancillary_locations
andancillary_size
).No breaking changes are introduced
Details
open-api & mithril-common
ancillary_locations
andancillary_size
fields toSnapshot
artifact and messagesSnapshot
: removednew
ctor, the additions of the new fields triggered the "more than 7 parameters" clippy lint, and since it was not used that much it was more easy to just construct the structure directly than introduce a sub-structure to solve the issue.DummyCardanoDb
: store the path to the created files in the ledger directorymithril-aggregator
CardanoImmutableFilesFullArtifactBuilder
: separate build and upload for completed immutable files and ancillaryLocalSnapshotUploader
: removed, its role was to copy the file to its storage location (something also covered by theLocalUploader
) and to compute the location uri, but that uri was targeting the/artifact/snapshot/{digest}/download
route which could not be easily reused for ancillary download. Instead aLocalUploader
is used meaning that, when local upload is set, the locations in the artifact are now/snapshot_download/{filename}
.snapshotter
:snapshot_all_completed_immutables
snapshot_all
since they are no usage anymoremithril-client
snapshot_client
: updated to also download the ancillary archive if a location is set inancillary_locations
.SnapshotAncillaryDownloadStarted
,SnapshotAncillaryDownloadProgress
, andSnapshotAncillaryDownloadCompleted
).fake.rs
as a directory and split its component so there's one file for each integration testssnapshot_archives.rs
module so they can easily be reused in multiple scenario.mithril-client-cli
dev.json
configuration file: thegenesis_verification_key
was not the one used inmithril-end-to-end
example-cardano-database (v1)
Pre-submit checklist
Issue(s)
Relates to #2362