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: chunk put allow retrying un-get-able chunks #1047

Merged
merged 2 commits into from Dec 5, 2023

Conversation

grumbach
Copy link
Member

@grumbach grumbach commented Dec 5, 2023

Description

Depends on #1022, please merge #1022 first!

Summary generated by Reviewpad on 05 Dec 23 09:36 UTC

This pull request includes the following changes:

  • The verify_uploaded_chunks method has been removed from the Files struct. Instead, the logic of this method has been moved to the upload_file method of the same struct, which now calls the verify_uploaded_chunks method on the client field.
  • Several import statements have been added for external modules and the standard library.
  • A new method verify_uploaded_chunks has been added to the Client struct. This method takes a vector of chunk paths and a batch size, and returns a vector of chunks that could not be verified.
  • A nested function get_register_from_record has been implemented, which converts a record into a signed register.
  • The upload_files function in the sn_cli/src/subcommands/files/mod.rs file has been modified. The changes include adding error handling to check if the wallet is empty before uploading files, initializing the ChunkManager with the provided root_dir, adding a call to determine the chunk path for the given files path, printing messages for uploaded and verified files, handling different scenarios based on the existence of chunks to upload, and logging and printing payment and upload information.
  • Import statements for io::BufRead and io::BufReader have been removed.
  • The variable child has been assigned but is unused.

These changes aim to refactor the code, improve the upload process, handle failed chunks, provide better information about the upload and payment details, and remove unused imports and variables.

@reviewpad reviewpad bot added Large Large sized PR waiting-for-review labels Dec 5, 2023
println!("\"{file_name:?}\" {addr:x}");
info!("Uploaded {file_name:?} to {addr:x}");
// make sure we don't have any failed chunks in those
let chunks = chunk_manager.already_put_chunks(&files_path)?;
Copy link
Member

Choose a reason for hiding this comment

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

I think this would create chunks in the artifacts dir and if they're not marked as completed when failed_chunks is not empty (L172), then during the next run, we'd get resume the chunks at line 162 and we'll try to upload them again (L166 returns false).

Copy link
Member

Choose a reason for hiding this comment

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

So should we make chunk_manager.already_put_chunks(&files_path)?; create the chunks to a temp dir for verification?

That might avoid complication.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch! Marked the non-failed chunks as completed just below. And if they fail, it's reasonable to keep them around for next time!

@grumbach grumbach force-pushed the chunk_put_smart_retries branch 2 times, most recently from 467e87a to 352e07b Compare December 5, 2023 10:38
@reviewpad reviewpad bot added Medium Medium sized PR and removed Large Large sized PR labels Dec 5, 2023
@grumbach grumbach added this pull request to the merge queue Dec 5, 2023
Merged via the queue into maidsafe:main with commit 9e3b05a Dec 5, 2023
31 checks passed
@grumbach grumbach deleted the chunk_put_smart_retries branch December 5, 2023 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Medium Medium sized PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants