Commit Graph

2152 Commits

Author SHA1 Message Date
Ari Lazier 78f74211b1 fix for android - create notifier after opening realm 2016-05-13 14:55:36 -07:00
Ari Lazier 80904e36e1 hopeful fix for android test 2016-05-13 14:15:34 -07:00
Ari Lazier 0ce3cdf81d hopeful fix for android test 2016-05-13 14:15:34 -07:00
Ari Lazier 9c1b923797 fixes for test app 2016-05-13 13:05:39 -07:00
Scott Kyle 323583ed67 Merge pull request #417 from realm/sk-node-6
Fix issues in Node 6
2016-05-12 12:39:31 -07:00
Ari Lazier 299c82b7d2 pr feedback 2016-05-12 11:42:22 -07:00
Ari Lazier 194f238c1c add missing realm file 2016-05-12 10:24:11 -07:00
Thomas Goyne db55770bfa Move the notifications fuzzer to the tests directory 2016-05-11 16:08:30 -07:00
Thomas Goyne e6d09b513e Fix an assertion failure in IndexSet::do_add() following a table clear
We don't track insertions and deletions for tables that are merely linked to by
tables actually being observed (for performance reasons, since we don't need
that information), but the check for that was missing in one place. This would
be merely a slowdown rather than a crash, but deletions.add_shifted() can
overflow size_t if the passed-in index represents a newly inserted row and the
check for that didn't work due to not tracking insertions for the table.

The only remotely realistic way to actually have size_t overflow is to have
previously cleared the table (the table clear instruction does not include the
old size of the table, so it just marks {0, SIZE_T_MAX} as deleted).

Fixes #3537.
2016-05-11 16:08:30 -07:00
Thomas Goyne 2bcf42904a Fix some typos in comments 2016-05-11 16:08:30 -07:00
Thomas Goyne b42bf25c99 Fix compilation with latest core 2016-05-11 16:08:30 -07:00
Thomas Goyne 8d9e5db092 Give a variable a less terrible name and add a comment 2016-05-11 16:08:30 -07:00
Mark Rowe ef1c6ddc63 Add support for fine-grained notifications from backlink TVs 2016-05-11 16:08:30 -07:00
Thomas Goyne 03108713ee Make PropertyType an enum class 2016-05-11 16:08:30 -07:00
Thomas Goyne 4cf5d5db4c Report modification paths as pre-delete/inserts as required for UITableView 2016-05-11 16:08:30 -07:00
Thomas Goyne d8a69b87dc Improve change calculation performance for nontrivial object graphs
Skip doing any checking at all if none of the tables reachable from the root
table have been modified (which can happen if the table version was bumped due
to insertions, unrelated backlinks, or unlinked-to rows being deleted in linked
tables).

Add cycle checking rather than relying on the max depth to handle it, as the
worst case was O(N^16) if the cycle involved a LinkList of size N.

Track which rows have been confirmed to have not been modified.

Cache the information about the links for each of the relevant tables as
checking the table schema can get somewhat expensive.
2016-05-11 16:08:30 -07:00
Thomas Goyne f9364b50a4 Return the correct iterator from ChunkedVector::erase()
When a chunk is removed entirely it should return an iterator to the first
element in the next chunk, not the last.
2016-05-11 16:08:30 -07:00
Thomas Goyne 4df552ba2d Clean up old move info even when the row being deleted is the last one 2016-05-11 16:08:30 -07:00
Thomas Goyne 3218740fd9 Fix the check for a deleted LV in ListNotifier::add_required_change_info() 2016-05-11 16:08:30 -07:00
Thomas Goyne 632d757014 Always deliver results to the correct SharedGroup
If there are multiple Realm instances for a single file on a single thread due
to disabling caching we need to actually deliver the results to the appropriate
SharedGroup for each notifier rather than delivering them all to the first one.
2016-05-11 16:08:30 -07:00
Thomas Goyne 8879212111 Fix assertion failure when a notifier is removed before it runs 2016-05-11 16:08:30 -07:00
Thomas Goyne eee6e55eb0 Refactor SortedMoveCalculator and add more of an explanation 2016-05-11 16:08:30 -07:00
Thomas Goyne 95900f5e17 Make more member functions in CollectionNotifier pure virtual 2016-05-11 16:08:30 -07:00
Thomas Goyne 9883944df4 Pull CollectionChangeBuilder into its own file 2016-05-11 16:08:30 -07:00
Thomas Goyne 66666a75b0 Iterate backwards to pick the last valid list in select_link_list 2016-05-11 16:08:30 -07:00
Thomas Goyne 23c16f8e67 Use aggregate initialization for the base class in CollectionChangeBuilder 2016-05-11 16:08:30 -07:00
Thomas Goyne c0350b9001 Rename CollectionChangeIndices to CollectionChangeSet 2016-05-11 16:08:30 -07:00
Thomas Goyne 953e1b15a8 Rename BackgroundCollection to CollectionNotifier 2016-05-11 16:08:30 -07:00
Thomas Goyne fe5564f40e Change all of the mentions of 'query' in NotificationToken to 'notifier' 2016-05-11 16:08:30 -07:00
Thomas Goyne 31c3982bff Fix some typos 2016-05-11 16:08:30 -07:00
Thomas Goyne e75ff49421 Fix check for the target results being invalid in ResultsNotifier::deliver()
m_target_results is no longer actually set to null when the notifier is
unregistered, so check the thing which is (i.e. m_realm).
2016-05-11 16:08:30 -07:00
Thomas Goyne 238e9e3b6b Fix tracking of which tables need change info with multiple source notifier versions 2016-05-11 16:08:30 -07:00
Thomas Goyne ea3a2f4711 Refactor the incremental change tracking for mixed source versions 2016-05-11 16:08:30 -07:00
Thomas Goyne 69cefd052e Deliver the new TableView even if it did not change
Even if the new TV has the same rows as the old one, we need to hand it over to
the destination thread to bump the outside version of the destination thread's
TV to avoid rerunning the query there.
2016-05-11 16:08:30 -07:00
Thomas Goyne 83b4d8ded2 Make RealmCoordinator::run_async_notifiers a bit less gross 2016-05-11 16:08:30 -07:00
Thomas Goyne 32b05314f5 Remove extraneous semicolons 2016-05-11 16:08:30 -07:00
Thomas Goyne 2ce0e2e37f Remove transaction log handlers for old pk functions 2016-05-11 16:08:30 -07:00
Thomas Goyne c12d87427a Clean up includes and forward declarations a bit 2016-05-11 16:08:30 -07:00
Thomas Goyne 155d949793 Only track inserts and deletes for tables being queried directly
# Conflicts:
#	src/collection_notifications.cpp
#	src/collection_notifications.hpp
2016-05-11 16:08:30 -07:00
Thomas Goyne a86265f4dc Move CollectionChangeBuilder to background_collection.hpp 2016-05-11 16:08:30 -07:00
Thomas Goyne bc78c02e9d Fix quadratic runtime of move_last_over() parsing 2016-05-11 16:08:30 -07:00
Thomas Goyne 2e80716629 Improve performance of move mapping when there are a lot of deletions 2016-05-11 16:08:30 -07:00
Thomas Goyne ae9516dbb7 Improve performance for large numbers of deletions 2016-05-11 16:08:30 -07:00
Thomas Goyne 8623aa6c6b Actually unregister List notifiers when the List is destroyed 2016-05-11 16:08:30 -07:00
Thomas Goyne 45705b18d2 Build all of the fuzzer variants 2016-05-11 16:08:30 -07:00
Thomas Goyne 510c049855 Don't run the LV commands at all if fuzzing non-linkview 2016-05-11 16:08:30 -07:00
Thomas Goyne 5eb18ed487 Allow non-empty no-op changesets when there should be no notification in the fuzzer 2016-05-11 16:08:30 -07:00
Thomas Goyne 7a75e2bae2 Use a better data structure for IndexSet
Switch to a chunked vector-of-vectors which makes mid-insertions on large sets
much faster, and cache the begin/end/count for each chunk to make lookups much
more cache-friendly.
2016-05-11 16:08:30 -07:00
Thomas Goyne f600487769 Speed up CollectionChangeBuilder::move_over() 2016-05-11 16:08:30 -07:00
Thomas Goyne f051337cd3 Rename erase_and_unshift() to erase_or_unshift() 2016-05-11 16:08:30 -07:00