Skip to content

Commit

Permalink
Do not send empty upload message if there is no download message to ack
Browse files Browse the repository at this point in the history
  • Loading branch information
danieltabacaru committed Jul 10, 2024
1 parent 77ba427 commit b71ce67
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

### Fixed
* <How do the end-user experience this issue? what was the impact?> ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?)
* None.
* Fixed sending empty UPLOAD messages when there is no download to acknowledge ([#2129](https://jira.mongodb.org/browse/RCORE-2129), since v14.8.0).

### Breaking changes
* None.
Expand Down
14 changes: 9 additions & 5 deletions src/realm/sync/noinst/client_impl_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2028,17 +2028,21 @@ void Session::send_upload_message()
target_upload_version = m_pending_flx_sub_set->snapshot_version;
}

bool server_version_to_ack =
m_upload_progress.last_integrated_server_version < m_download_progress.server_version;

std::vector<UploadChangeset> uploadable_changesets;
version_type locked_server_version = 0;
get_history().find_uploadable_changesets(m_upload_progress, target_upload_version, uploadable_changesets,
locked_server_version); // Throws

if (uploadable_changesets.empty()) {
// Nothing more to upload right now
// If we need to limit upload up to some version other than the last client version available and there are no
// changes to upload, then there is no need to send an empty message.
if (m_pending_flx_sub_set) {
logger.debug("Empty UPLOAD was skipped (progress_client_version=%1, progress_server_version=%2)",
// Nothing more to upload right now if:
// 1. We need to limit upload up to some version other than the last client version
// available and there are no changes to upload
// 2. There are no changes to upload and no server version(s) to acknowledge
if (m_pending_flx_sub_set || !server_version_to_ack) {
logger.trace("Empty UPLOAD was skipped (progress_client_version=%1, progress_server_version=%2)",
m_upload_progress.client_version, m_upload_progress.last_integrated_server_version);
// Other messages may be waiting to be sent
return enlist_to_send(); // Throws
Expand Down

0 comments on commit b71ce67

Please sign in to comment.