diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a5b123906..e8c36f8c13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ ### Fixed * ([#????](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. diff --git a/src/realm/sync/noinst/client_impl_base.cpp b/src/realm/sync/noinst/client_impl_base.cpp index a69358153d..77101a1601 100644 --- a/src/realm/sync/noinst/client_impl_base.cpp +++ b/src/realm/sync/noinst/client_impl_base.cpp @@ -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 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