Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Fix for binary download resume #1571

Merged
merged 4 commits into from
Feb 27, 2020
Merged

Fix for binary download resume #1571

merged 4 commits into from
Feb 27, 2020

Conversation

eu-siemann
Copy link
Contributor

This can be considered a hotfix for the issue with download resume after a nongraceful shutdown (OLPSUP-9401).
I plan to follow up this PR with another one, removing usage of target_images table for binary downloads and possibly moving this functionality to (Binary) package manager.

Copy link
Collaborator

@pattivacek pattivacek left a comment

Choose a reason for hiding this comment

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

Looks pretty good.

@@ -9,7 +9,7 @@ struct DownloadMetaStruct {
target{std::move(target_in)},
token{token_in},
progress_cb{std::move(progress_cb_in)} {}
uint64_t downloaded_length{0};
uintmax_t downloaded_length{0};
Copy link
Collaborator

Choose a reason for hiding this comment

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

I get why size_t was wrong, but is uintmax_t really necessary (compared to uint64_t)?

Copy link
Contributor

Choose a reason for hiding this comment

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

I had the same question, it seems that the reason is that the c++ filesystem api (also boost) returns this type for file sizes: https://en.cppreference.com/w/cpp/filesystem/file_size.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be not necessary, just wanted to be consistent with return types from boost.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fair enough. Seems fine.

@@ -56,7 +56,7 @@ void resume(const Uptane::Target& target) {
EXPECT_TRUE(res);
}

void pause_and_die(const Uptane::Target& target) {
void try_and_die(const Uptane::Target& target, bool graceful) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hilarious name. :)

@lbonn
Copy link
Contributor

lbonn commented Feb 26, 2020

Looks fine to me, we can merge it after fixing the minor format nit.

@pattivacek pattivacek mentioned this pull request Feb 26, 2020
Eugene Smirnov added 4 commits February 26, 2020 19:22
Signed-off-by: Eugene Smirnov <[email protected]>
For 32-bit arch SIZE_MAX == (2^32 - 1), which will
break on files > 4 GB.

Signed-off-by: Eugene Smirnov <[email protected]>
@codecov-io
Copy link

codecov-io commented Feb 26, 2020

Codecov Report

Merging #1571 into master will decrease coverage by 0.09%.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #1571     +/-   ##
========================================
- Coverage   82.19%   82.1%   -0.1%     
========================================
  Files         189     189             
  Lines       11859   11855      -4     
========================================
- Hits         9748    9734     -14     
- Misses       2111    2121     +10
Impacted Files Coverage Δ
src/libaktualizr/storage/sqlstorage.h 50% <ø> (ø) ⬆️
src/libaktualizr/storage/sql_utils.h 86.11% <ø> (ø) ⬆️
src/libaktualizr/storage/invstorage.h 97.95% <100%> (ø) ⬆️
src/libaktualizr/storage/sqlstorage.cc 77.59% <100%> (-0.28%) ⬇️
...tualizr/package_manager/packagemanagerinterface.cc 94.28% <100%> (ø) ⬆️
src/libaktualizr/storage/sqlstorage_base.h 60% <0%> (-40%) ⬇️
src/libaktualizr/storage/sqlstorage_base.cc 74.32% <0%> (-4.06%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 89dc151...4865dbf. Read the comment docs.

@eu-siemann
Copy link
Contributor Author

It's weird, but the order of commits on the branch doesn't match the order on github. Commit 864bcf0 goes before f4db090, so it's easier to test that the following commits are fixing the failing test. On github 864bcf0 is shown as the last commit.

Copy link
Collaborator

@pattivacek pattivacek left a comment

Choose a reason for hiding this comment

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

It's weird, but the order of commits on the branch doesn't match the order on github. Commit 864bcf0 goes before f4db090, so it's easier to test that the following commits are fixing the failing test. On github 864bcf0 is shown as the last commit.

I've seen that happen before. Seems like a github bug. Anyway, LGTM, thanks!

@pattivacek pattivacek merged commit 061f801 into master Feb 27, 2020
@pattivacek pattivacek deleted the fix/binary-resume branch February 27, 2020 08:15
@lbonn
Copy link
Contributor

lbonn commented Feb 27, 2020

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

Successfully merging this pull request may close these issues.

4 participants