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

Update captured_transferrable when downloadable bytes value changes. #4989

Merged
merged 5 commits into from
Oct 27, 2021

Conversation

leemaguire
Copy link
Contributor

@leemaguire leemaguire commented Oct 22, 2021

What, How & Why?

The sync server can perform compaction on collections during a sync session. This means that the downloadable bytes size can change during sync progress. This PR updates the progress notifier to handle the server side compaction logic.

☑️ ToDos

  • 📝 Changelog update
  • 🚦 Tests (or not relevant)

@cla-bot cla-bot bot added the cla: yes label Oct 22, 2021
@leemaguire leemaguire force-pushed the lm/sync-progress branch 3 times, most recently from 82340cb to 962e4d5 Compare October 25, 2021 01:12
@leemaguire leemaguire marked this pull request as ready for review October 25, 2021 01:13
@leemaguire leemaguire requested a review from jbreams October 25, 2021 01:15
// We need to account for when server side compaction runs. This will change the
// value of `current_progress.downloadable` so any math that checks sync progress will
// then be invalid because of the old value.
if (is_download && (*captured_transferrable != current_progress.downloadable)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

so i think this is a behavioral change that i'm not sure is what the user is going to want/expect. the transferrable number that used to be a fixed value that you worked up to is now going to be constantly decreasing. this is probably the correct behavior, but is definitely different from how this has worked in the past. and maybe we should just get rid of the captured_transferrable variable and report that value to the user as the estimated remaining downloadable bytes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have kept captured_transferrable because totally removing would change the behaviour.

src/realm/object-store/sync/sync_session.cpp Outdated Show resolved Hide resolved
@@ -1125,11 +1125,23 @@ std::function<void()> SyncProgressNotifier::NotifierPackage::create_invocation(P
transferrable = is_download ? current_progress.downloadable : current_progress.uploadable;
}
else if (captured_transferrable) {
if (is_download && (current_progress.downloadable == 0)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without this we will never be able to pass 0 downloadable bytes to the SDK

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, but do we want to pass 0 to the SDK? We didn't used to. We just want this to expire when downloadable reaches zero.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes because that is the only thing we can do that does not involve removing captured_transferrable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If this was to just expire the SDK will not be notified of it.

@leemaguire leemaguire merged commit e5a115f into master Oct 27, 2021
@leemaguire leemaguire deleted the lm/sync-progress branch October 27, 2021 21:19
jsflax added a commit that referenced this pull request Oct 29, 2021
author Jason Flax <[email protected]> 1632927798 +0200
committer Jason Flax <[email protected]> 1635527380 +0100

parent 0a0d02a
author Jason Flax <[email protected]> 1632927798 +0200
committer Jason Flax <[email protected]> 1635527271 +0100

Replace all references of StringView/BasicStringView with std::string_view/std::basic_string_view

Address @jbreams comments

revert query_flex

fix tests

Revert query_flex.hpp

compile on windows

compile on windows

Update captured_transferrable when downloadable bytes value changes. (#4989)

Prepare release

Remove unused variables

Updated release notes

Use originating realm schema for frozen realm (#4965)

Co-authored-by: Ferdinando Papale <>

Collapase ConstTableView and TableView

Some further cleanup in TableView

Update CHANGELOG.md

re-remove files
@tgoyne
Copy link
Member

tgoyne commented Oct 29, 2021

This appears to have broken streaming download notifiers. Adding a streaming notifier before there is anything to download now results in it just never firing.

@tgoyne
Copy link
Member

tgoyne commented Oct 29, 2021

I don't really understand what this PR was even trying to do. The PR description and changelog message don't have any obvious connection, and the changes to the tests make this look like just a change in behavior that breaks things rather than a bug fix.

tgoyne added a commit that referenced this pull request Oct 29, 2021
tgoyne added a commit that referenced this pull request Oct 29, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants