1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 09:07:25 +08:00
Commit Graph

49 Commits

Author SHA1 Message Date
Dean Herbert
88a575462c Work around weird null inspection 2021-10-18 16:11:55 +09:00
Dean Herbert
2c5ba1d8e2 Change OnlineID to non-nullable to allow for indexing in Realm 2021-10-18 15:53:40 +09:00
Dean Herbert
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
Dean Herbert
f43badabf4 Add back update thread verification in RealmContextFactory 2021-10-11 15:20:12 +09:00
Dean Herbert
74841cf1a9 Merge branch 'update-realm-context-factory' into realm-context-factory-safer-blocking 2021-10-01 03:54:31 +09:00
Dean Herbert
b51fd00ba3 Guard against disposal in all context retrievals 2021-10-01 03:46:53 +09:00
Dean Herbert
8557530cd5 Add back main context locking 2021-10-01 03:45:00 +09:00
Dean Herbert
cfd3bdf888 Ensure realm blocks until all threaded usages are completed 2021-10-01 01:34:35 +09:00
Dean Herbert
9fa901f6aa Refine RealmContext implementation API 2021-09-30 23:56:38 +09:00
Dean Herbert
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
Bartłomiej Dach
3291f15dcc Mention GetForWrite() as another alternative to Context accesses 2021-07-04 12:08:15 +02:00
Dean Herbert
3ec7dc3bb9 Update tests in line with thread safety check 2021-07-04 17:59:39 +09:00
Dean Herbert
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
Dean Herbert
2f1203085b Also add logging of realm block/flush operations 2021-06-29 20:23:25 +09:00
Dean Herbert
d4ea73d727 Simplify disposal exceptions 2021-06-28 16:17:09 +09:00
Dean Herbert
f78cedd0e1 Reorder methods and add xmldoc for BlockAllOperations 2021-06-28 16:16:40 +09:00
Dean Herbert
90f0bc87f5 Add safety against double disposal 2021-06-28 16:12:21 +09:00
Dean Herbert
842f033522 Remove no longer necessary exception 2021-06-28 16:11:55 +09:00
Dean Herbert
c281e43cd8 Remove Dispose() special case and add explicit exception to make debugging issues non-deadlock 2021-06-28 15:04:14 +09:00
Dean Herbert
63ab40ec24 Fix potential deadlocking behaviour (and convert ResetEvent to Semaphore) 2021-06-24 14:37:26 +09:00
Dean Herbert
ecde6137e0 Add missing active usage counter increment 2021-03-31 15:16:01 +09:00
Dean Herbert
d69a4914e0 Add method to block all realm access during migration operation 2021-01-22 17:28:47 +09:00
Dean Herbert
47a9d2b1c2 Add missing licence header 2021-01-21 20:53:16 +09:00
Dean Herbert
34a7ce912e Correctly close context before attempting migration 2021-01-21 19:02:09 +09:00
Dean Herbert
f6c2009509 Remove unused using 2021-01-19 20:10:10 +09:00
Dean Herbert
68f2e7f61a Use realm support for Guid 2021-01-19 18:22:36 +09:00
Bartłomiej Dach
ddc63662ba Dispose realm in RealmWriteUsage cleanup 2021-01-16 16:39:04 +01:00
Dean Herbert
3e366b1f15 Ensure the main realm context is closed when the factory is disposed 2021-01-15 14:26:06 +09:00
Dean Herbert
8a08d3f4ef Fix transactions not actually being committed 2021-01-14 16:13:10 +09:00
Dean Herbert
af1509d892 Remove unused variable (but add back pending writes counter) 2021-01-14 15:51:19 +09:00
Dean Herbert
8442b34e84 Tidy up write usage class 2021-01-13 18:36:37 +09:00
Dean Herbert
542f535247 Pull out thread local contexts and have main realm refresh in update loop 2021-01-13 18:36:37 +09:00
Dean Herbert
192e58e0c6 Update all read queries to use direct realm subscriptions/queries 2021-01-13 18:36:37 +09:00
Dean Herbert
2e4c3c8e39 Avoid closing initial context after migrations (unnecessary) 2021-01-12 14:45:36 +09:00
Dean Herbert
0dca9c8c46 Tidy up RealmContextFactory; remove delete/dispose method which wouldn't work due to threading 2021-01-12 14:45:36 +09:00
Dean Herbert
8cbad1dc1c Add logging of opened and created contexts 2021-01-12 14:45:36 +09:00
Dean Herbert
ffb42c37df Move schema version to const 2021-01-12 14:45:36 +09:00
Dean Herbert
0789621b85 Elaborate on comment mentioning migrations 2021-01-12 14:45:36 +09:00
Dean Herbert
dd50b5870e Move extensions methods into own class 2021-01-12 14:45:36 +09:00
Dean Herbert
6736db327a Remove scheduler being passed in for now 2021-01-12 14:45:36 +09:00
Dean Herbert
9f64f6059f Rename RealmWrapper to Live 2021-01-11 16:31:36 +09:00
Dean Herbert
6c90f9ceed Move RealmWrapper to own file 2021-01-11 16:31:36 +09:00
Dean Herbert
86daf65630 Fix primary key not being populated for KeyBinding 2021-01-11 16:31:35 +09:00
Dean Herbert
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
Dean Herbert
382a40b243 Tidy up some missed inspections in RealmContextFactory 2021-01-11 15:52:49 +09:00
Dean Herbert
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
Dean Herbert
ae76eca564 Add basic realm migration support 2021-01-11 15:52:49 +09:00
Dean Herbert
5d7ab4a7f1 Rename global statistics to be specific to realm 2021-01-11 15:52:49 +09:00
Dean Herbert
9cfede2e7e Setup context, write usage, wrapper classes 2021-01-11 15:52:49 +09:00