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

Reduce the memory footprint of an automatic reset #6567

Merged
merged 3 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
-----------

### Internals
* Reduce the memory footprint of an automatic (discard or recover) client reset when there are large incoming changes from the server. ([#6567](https://github.com/realm/realm-core/issues/6567))
* `get_committed_file_format_version()` safe access to mappings vector from multiple threads.

----------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions src/realm/sync/noinst/client_reset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ void transfer_group(const Transaction& group_src, Transaction& group_dst, util::
{
logger.debug("transfer_group, src size = %1, dst size = %2", group_src.size(), group_dst.size());

// Turn off the sync history tracking during state transfer since it will be thrown
// away immediately after anyways. This reduces the memory footprint of a client reset.
ClientReplication* client_repl = dynamic_cast<ClientReplication*>(group_dst.get_replication());
REALM_ASSERT_RELEASE(client_repl);
TempShortCircuitReplication sync_history_guard(*client_repl);

// Find all tables in dst that should be removed.
std::set<std::string> tables_to_remove;
for (auto table_key : group_dst.get_table_keys()) {
Expand Down