-
Notifications
You must be signed in to change notification settings - Fork 174
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
RCORE-2174 Bootstrap store is not being reset if initial subscription bootstrap is interrupted by role change #7831
Changes from 3 commits
2b7a64b
ae731ac
19b8450
fe7c4a5
8c775e5
928a466
303cb7f
edf832e
76219d0
5a59f54
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,8 @@ | |
|
||
### Fixed | ||
* <How do the end-user experience this issue? what was the impact?> ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?) | ||
* None. | ||
* Fix data from a previous interrupted bootstrap was potentially being included with the bootstrap data during retry attempt | ||
and complete bootstraps were potentially not being applied if the session restarted once fully downloaded. ([#7827](https://github.com/realm/realm-core/issues/7827), since 14.8.0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess the data would be re-downloaded right? |
||
|
||
### Breaking changes | ||
* None. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -850,7 +850,7 @@ bool SessionImpl::process_flx_bootstrap_message(const SyncProgress& progress, Do | |
} | ||
|
||
try { | ||
process_pending_flx_bootstrap(); | ||
process_pending_flx_bootstrap(); // throws | ||
} | ||
catch (const IntegrationException& e) { | ||
on_integration_failure(e); | ||
|
@@ -869,8 +869,6 @@ void SessionImpl::process_pending_flx_bootstrap() | |
if (!m_is_flx_sync_session || m_state != State::Active) { | ||
return; | ||
} | ||
// Should never be called if session is not active | ||
REALM_ASSERT_EX(m_state == SessionImpl::Active, m_state); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this assertion didn't really make sense |
||
auto bootstrap_store = m_wrapper.get_flx_pending_bootstrap_store(); | ||
if (!bootstrap_store->has_pending()) { | ||
return; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1527,6 +1527,16 @@ void Session::cancel_resumption_delay() | |
if (unbind_process_complete()) | ||
initiate_rebind(); // Throws | ||
|
||
try { | ||
process_pending_flx_bootstrap(); // throws | ||
} | ||
catch (const IntegrationException& error) { | ||
on_integration_failure(error); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what happens if we have an integration failure here? I guess the client will just continue to resume the session but without applying the bootstrap? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes - it's the same if there is an integration failure during |
||
} | ||
catch (...) { | ||
on_integration_failure(IntegrationException(exception_to_status())); | ||
} | ||
|
||
m_conn.one_more_active_unsuspended_session(); // Throws | ||
if (m_try_again_activation_timer) { | ||
m_try_again_activation_timer.reset(); | ||
|
@@ -1733,7 +1743,7 @@ void Session::activate() | |
m_conn.one_more_active_unsuspended_session(); // Throws | ||
|
||
try { | ||
process_pending_flx_bootstrap(); | ||
process_pending_flx_bootstrap(); // throws | ||
} | ||
catch (const IntegrationException& error) { | ||
on_integration_failure(error); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1550,17 +1550,16 @@ inline void ClientImpl::Session::initiate_rebind() | |
inline void ClientImpl::Session::reset_protocol_state() noexcept | ||
{ | ||
// clang-format off | ||
m_enlisted_to_send = false; | ||
m_bind_message_sent = false; | ||
m_error_to_send = false; | ||
m_ident_message_sent = false; | ||
m_unbind_message_sent = false; | ||
m_unbind_message_send_complete = false; | ||
m_error_message_received = false; | ||
m_unbound_message_received = false; | ||
m_client_error = util::none; | ||
|
||
m_upload_progress = m_progress.upload; | ||
m_enlisted_to_send = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why did this all change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reverted - I had reformatted the function when I was playing around with moving the bootstrap apply to this funciton. |
||
m_bind_message_sent = false; | ||
m_error_to_send = false; | ||
m_ident_message_sent = false; | ||
m_unbind_message_sent = false; | ||
m_unbind_message_send_complete = false; | ||
m_error_message_received = false; | ||
m_unbound_message_received = false; | ||
m_client_error = util::none; | ||
m_upload_progress = m_progress.upload; | ||
m_last_version_selected_for_upload = m_upload_progress.client_version; | ||
m_last_download_mark_sent = m_last_download_mark_received; | ||
// clang-format on | ||
|
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.
Couldn't this potentially cause diverging history?
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.
Not immediately, but manually removing the extra entries may cause a diverging history error when merged with the server, since it expects those to not be in the local realm.
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.
Not sure what you mean.
After thinking a bit more, I think it can actually cause orphaned objects not diverging history.
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.
Yes, orphaned objects is what I was trying to say
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.
@kmorkos correct me if i'm wrong, but I think this will just lead to compensating writes rather than diverging history.
But also, this changelog entry is super confusing. The audience for changelog entries are SDK engineers and end users who likely don't know about the pending bootstrap store. Perhaps something like
Also, I don't think this started in 14.8.0 - I think this started in v12.0.0 https://github.com/realm/realm-core/blob/master/CHANGELOG.md#1200-release-notes.
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.
@jbreams I think we can refer to those objects as orphaned objects as we do in other places, otherwise I agree with your suggestion for changelog entry.
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 think the bug is that the client may end up with objects that the server doesn't think it has (if the object was in the new query's view during the first attempt, but then moved out that query's view before the second attempt).
From there, one of three things could happen:
I think for all intents and purposes @jbreams' description is more accurate than referring to them as "orphaned objects" unless that terminology is used elsewhere to refer to the above scenario
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 reworded the changelog entry based on Jonathan's recommendation - hopefully it is clearer now.