Skip to content

Commit

Permalink
fix snapshot_version_number when creating a mutable subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
ironage committed Oct 20, 2023
1 parent aed42b1 commit 95f10f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 8,7 @@
* <How do the end-user experience this issue? what was the impact?> ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?)
* Deleting an object in an asymmetric table would cause a crash. Likely to solve [#1537](https://github.com/realm/realm-kotlin/issues/1537), since v12.1.0.
* Fixed FLX subscriptions not being fullfilled if the session was interrupted during bootstrapping. ([PR 7042](https://github.com/realm/realm-core/pull/7042))
* Fixed FLX subscriptions not being picked up if an upload message was sent immediately after a subscription was committed but before the sync client checks for new subscriptions via `SubscriptionStore::get_next_pending_version()`. ([PR 7042](https://github.com/realm/realm-core/pull/7042))

### Breaking changes
* None.
Expand Down
6 changes: 5 additions & 1 deletion src/realm/sync/subscriptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 592,11 @@ SubscriptionSet MutableSubscriptionSet::commit()
if (m_state == State::Uncommitted) {
m_state = State::Pending;
}
m_obj.set(mgr->m_sub_set_snapshot_version, static_cast<int64_t>(m_tr->get_version()));

// m_tr->get_version() gives the read transaction number that this write is based on.
// What we want to commit as the snapshot_version is actually the version of this commit,
// so assuming sequential commits and we have the write lock, we use m_tr->get_version() 1.
m_obj.set(mgr->m_sub_set_snapshot_version, static_cast<int64_t>(m_tr->get_version() 1));

auto obj_sub_list = m_obj.get_linklist(mgr->m_sub_set_subscriptions);
obj_sub_list.clear();
Expand Down

0 comments on commit 95f10f2

Please sign in to comment.