Commit Graph

47 Commits

Author SHA1 Message Date
818fac6ac8 Make realm a non-drawable component to better order disposal
Until now, the `RealmContextFactory` would be disposed as part of the
drawable hierarchy. This is too early, as it may be being used by higher
level components (like `ConfigManager`s, see #15115) that perform final
operations after the drawables have been disposed.

Seems to make sense moving this out of the drawable hierarchy and in
line with how we were doing things with EF.
2021-10-15 13:58:16 +09:00
f43badabf4 Add back update thread verification in RealmContextFactory 2021-10-11 15:20:12 +09:00
74841cf1a9 Merge branch 'update-realm-context-factory' into realm-context-factory-safer-blocking 2021-10-01 03:54:31 +09:00
b51fd00ba3 Guard against disposal in all context retrievals 2021-10-01 03:46:53 +09:00
8557530cd5 Add back main context locking 2021-10-01 03:45:00 +09:00
cfd3bdf888 Ensure realm blocks until all threaded usages are completed 2021-10-01 01:34:35 +09:00
9fa901f6aa Refine RealmContext implementation API 2021-09-30 23:56:38 +09:00
f510ef9153 Move previousContext assign within lock to make things look safer
Not an actual requirement, but no harm.
2021-07-05 10:49:56 +09:00
3291f15dcc Mention GetForWrite() as another alternative to Context accesses 2021-07-04 12:08:15 +02:00
3ec7dc3bb9 Update tests in line with thread safety check 2021-07-04 17:59:39 +09:00
567e9f33a9 Fix thread safety of realm Refresh operation
Due to the lack of locking, there was a chance the the update thread
`context` was retrieved just before the `flushContexts` call, followed
by `.Refresh()` being run while the blocking behaviour was invoked.

This can be seen in test failures such as
https://ci.appveyor.com/project/peppy/osu/builds/39859786/tests.

As an aside, I tried multiple different methods to avoid `lock()` on the
update thread but they felt flaky. The overhead of lock when there's no
contention is reportedly around 30-50ns, so likely not of concern. We
can address it at a later point if it becomes one.
2021-07-04 16:24:43 +09:00
2f1203085b Also add logging of realm block/flush operations 2021-06-29 20:23:25 +09:00
d4ea73d727 Simplify disposal exceptions 2021-06-28 16:17:09 +09:00
f78cedd0e1 Reorder methods and add xmldoc for BlockAllOperations 2021-06-28 16:16:40 +09:00
90f0bc87f5 Add safety against double disposal 2021-06-28 16:12:21 +09:00
842f033522 Remove no longer necessary exception 2021-06-28 16:11:55 +09:00
c281e43cd8 Remove Dispose() special case and add explicit exception to make debugging issues non-deadlock 2021-06-28 15:04:14 +09:00
63ab40ec24 Fix potential deadlocking behaviour (and convert ResetEvent to Semaphore) 2021-06-24 14:37:26 +09:00
ecde6137e0 Add missing active usage counter increment 2021-03-31 15:16:01 +09:00
d69a4914e0 Add method to block all realm access during migration operation 2021-01-22 17:28:47 +09:00
47a9d2b1c2 Add missing licence header 2021-01-21 20:53:16 +09:00
34a7ce912e Correctly close context before attempting migration 2021-01-21 19:02:09 +09:00
f6c2009509 Remove unused using 2021-01-19 20:10:10 +09:00
68f2e7f61a Use realm support for Guid 2021-01-19 18:22:36 +09:00
ddc63662ba Dispose realm in RealmWriteUsage cleanup 2021-01-16 16:39:04 +01:00
3e366b1f15 Ensure the main realm context is closed when the factory is disposed 2021-01-15 14:26:06 +09:00
8a08d3f4ef Fix transactions not actually being committed 2021-01-14 16:13:10 +09:00
af1509d892 Remove unused variable (but add back pending writes counter) 2021-01-14 15:51:19 +09:00
8442b34e84 Tidy up write usage class 2021-01-13 18:36:37 +09:00
542f535247 Pull out thread local contexts and have main realm refresh in update loop 2021-01-13 18:36:37 +09:00
192e58e0c6 Update all read queries to use direct realm subscriptions/queries 2021-01-13 18:36:37 +09:00
2e4c3c8e39 Avoid closing initial context after migrations (unnecessary) 2021-01-12 14:45:36 +09:00
0dca9c8c46 Tidy up RealmContextFactory; remove delete/dispose method which wouldn't work due to threading 2021-01-12 14:45:36 +09:00
8cbad1dc1c Add logging of opened and created contexts 2021-01-12 14:45:36 +09:00
ffb42c37df Move schema version to const 2021-01-12 14:45:36 +09:00
0789621b85 Elaborate on comment mentioning migrations 2021-01-12 14:45:36 +09:00
dd50b5870e Move extensions methods into own class 2021-01-12 14:45:36 +09:00
6736db327a Remove scheduler being passed in for now 2021-01-12 14:45:36 +09:00
9f64f6059f Rename RealmWrapper to Live 2021-01-11 16:31:36 +09:00
6c90f9ceed Move RealmWrapper to own file 2021-01-11 16:31:36 +09:00
86daf65630 Fix primary key not being populated for KeyBinding 2021-01-11 16:31:35 +09:00
a77519c6bd Store KeyBinding action to its own field in realm
Also improve the Query method for action types by using generic field
2021-01-11 15:52:49 +09:00
382a40b243 Tidy up some missed inspections in RealmContextFactory 2021-01-11 15:52:49 +09:00
845d5cdea2 Switch guid to store as string until fody issues are resolved
See
https://github.com/realm/realm-dotnet/issues/740#issuecomment-755898968
2021-01-11 15:52:49 +09:00
ae76eca564 Add basic realm migration support 2021-01-11 15:52:49 +09:00
5d7ab4a7f1 Rename global statistics to be specific to realm 2021-01-11 15:52:49 +09:00
9cfede2e7e Setup context, write usage, wrapper classes 2021-01-11 15:52:49 +09:00