Dean Herbert
7aad2780b1
Add retry logic for realm backup creation
2022-01-21 00:46:53 +09:00
Dean Herbert
079b2dfc42
Create backup of databases before opening contexts
...
Attempt to avoid file IO issues.
Closes #16531 .
2022-01-21 00:46:53 +09:00
Dean Herbert
5df46d0a54
Remove all calls to Realm.Refresh
to fix blocking overhead from subscriptions
...
Turns out this is not required if realm is aware of a
`SynchronizationContext`. See
https://github.com/realm/realm-dotnet/discussions/2775#discussioncomment-2005412
for further reading.
2022-01-20 20:23:18 +09:00
Dean Herbert
ccddf9b47d
Avoid constructor overhead for realm BeatmapSetInfo
parameterless constructor
2022-01-20 17:03:44 +09:00
Dan Balasescu
64fe7d8dd3
Merge pull request #16520 from peppy/refresh-after-migrate
...
Improve realm migration performance further
2022-01-20 14:38:23 +09:00
Dean Herbert
a27a3b308c
Remove duplicate setters
2022-01-20 04:34:00 +09:00
Dean Herbert
fad66d7682
Backup collections alongside main databases when migrating to realm
2022-01-19 16:31:36 +09:00
Dean Herbert
aa93042aa3
Centralise backup code and also run on skin/settings migrations
2022-01-19 16:31:36 +09:00
Dean Herbert
fd5198d667
Avoid using parameterless constructors in migration code
...
Minor performance improvement (less garbage).
2022-01-19 16:22:18 +09:00
Dean Herbert
42736c9995
Add transactional committing of scores/beatmaps
...
This helps slightly with performance, allows better monitoring via realm
studio, but most importantly greatly reduces filesize.
fully compacted: 109M
transaction size 100: 115M
transaction size 1000: 123M
transaction size 10000: 164M
single transaction: 183M
With a transaction size of 100 there is a performance reduction, so 1000
seems to be the best middle-ground.
2022-01-19 16:08:48 +09:00
Dean Herbert
973836484c
Avoid using a write context for EF migration
...
This reduces a stall delay as EF tries to process changes over tracked
objects during disposal of the context.
2022-01-19 15:56:58 +09:00
Dean Herbert
faec62be51
Force a realm refresh after migration
...
This really shouldn't have much effect as it will be run in the first
`Update` method and is probably a noop (we are already pointing to the
newest version due to just performing writes), but seems like a safe addition.
In general `Realm.Refresh()` only really does anything when there's multithreaded
usage and notifications to be sent.
2022-01-19 15:56:58 +09:00
Dan Balasescu
fdf65aa2ff
Merge pull request #16502 from peppy/realm/remove-ef-migrations
...
Remove all EF migrations and helper methods
2022-01-19 14:43:45 +09:00
Dan Balasescu
3407b34b11
Merge branch 'master' into realm/remove-ef-migrations
2022-01-19 14:01:34 +09:00
Dan Balasescu
0b1736def6
Merge branch 'master' into realm-integration/faster-migration
2022-01-19 13:54:14 +09:00
Dan Balasescu
9c8f7795b7
Merge pull request #16510 from peppy/optimise-set-detach-part-2
...
Avoid file retrieval overhead when detaching `BeatmapSetInfo`
2022-01-19 13:53:34 +09:00
Dan Balasescu
a0336c6fc2
Merge pull request #16495 from peppy/realm-integration/reinit-on-corrupt
...
Add support for starting with a fresh realm database if the existing one is not usable
2022-01-19 13:30:14 +09:00
Dan Balasescu
2556f1cb87
Merge branch 'master' into optimise-set-detach-part-2
2022-01-19 13:20:38 +09:00
Dan Balasescu
d663fcd045
Merge pull request #16508 from peppy/optimise-set-detach
...
Create separate automapper configurations to reduce cyclic detach overhead
2022-01-19 13:20:25 +09:00
Dean Herbert
d440197fb3
Merge branch 'master' into realm-integration/faster-migration
2022-01-19 12:56:42 +09:00
Dean Herbert
ad4d9789ad
Merge branch 'master' into realm-integration/reinit-on-corrupt
2022-01-19 12:31:56 +09:00
Dan Balasescu
f6f44029e8
Merge pull request #16507 from peppy/more-ingore-rules
...
Add some missing `IgnoredAttributes` to reduce automapper overhead
2022-01-19 12:26:37 +09:00
Dean Herbert
fb558a3189
Merge branch 'master' into realm-integration/reinit-on-corrupt
2022-01-19 12:26:24 +09:00
Dan Balasescu
c52899b1fb
Rename property
2022-01-19 11:56:44 +09:00
Dean Herbert
261b4988f9
Only catch RealmExceptions
to avoid blocking the nested TimeoutException
2022-01-19 10:58:59 +09:00
Dean Herbert
195534a1d2
Only output "successful" messages when copy actually occurred
2022-01-19 10:31:13 +09:00
Dean Herbert
e1a35714be
Add notification for debug builds when database migration occurs
2022-01-19 10:31:10 +09:00
Dean Herbert
04e9ffa966
Freshen some comments
2022-01-19 10:20:56 +09:00
Dean Herbert
64a023665e
Avoid taking more than one backup per migration run
2022-01-19 10:20:56 +09:00
Dean Herbert
761e161eec
Add comment explaining ignore rule
2022-01-19 09:44:21 +09:00
Dean Herbert
60b80c88b6
Avoid file retrieval overhead when detaching BeatmapSetInfo
...
It seems that no usages of `BeatmapSetInfo` detaches require files - a
`WorkingBeatmap` is always obtained before doing further lookups.
Therefore we can omit this include unless the detaching object is a
`BeatmapInfo`. A refetch is performed when retrieving a
`WorkingBeatmap` to complete the equation.
2022-01-19 00:49:18 +09:00
Dean Herbert
f2b151023e
Create separate automapper configurations to reduce cyclic detach overhead
...
This optimises the `BeatmapSetInfo` detach operation by avoiding
detaching `BeatmapSetInfo.Beatmaps[].BeatmapSetInfo` a second time over.
2022-01-19 00:03:24 +09:00
Dean Herbert
67bf95bc91
Remove all usage of AuthorString
2022-01-18 23:30:40 +09:00
Dean Herbert
6b0bf38c93
Use a single EF context to avoid scores getting cascade deleted along the way
2022-01-18 20:47:53 +09:00
Dean Herbert
6ddd2d59d3
Remove EF helper methods
2022-01-18 20:44:26 +09:00
Dean Herbert
519f7e6ad2
Don't bother with removing from EF as the file is going to be deleted anyway
2022-01-18 19:17:47 +09:00
Dean Herbert
3b0977903b
Use IQueryable
directly to avoid insane overheads
2022-01-18 19:17:47 +09:00
Dean Herbert
49fcff190a
Merge branch 'master' into realm-integration/reinit-on-corrupt
2022-01-18 18:02:23 +09:00
Dean Herbert
7baada2fa6
Merge branch 'master' into realm-integration/safer-migration
2022-01-18 18:01:46 +09:00
Dean Herbert
246a4a4bfe
Add support for starting with a fresh realm database if the existing one is not usable
...
The most common scenario is switching between schema versions when
testing. This should alleviate the manual overhead of that for the
majority of cases.
For users, this will show a notification on startup if their database
was purged, similar to what we had with EF.
2022-01-18 16:05:13 +09:00
Dean Herbert
9a43ed742b
Update automapper spec in line with v11
...
See https://docs.automapper.org/en/latest/11.0-Upgrade-Guide.html for
more details.
2022-01-18 15:23:28 +09:00
Dean Herbert
1b62a685f3
Merge branch 'master' into realm-integration/score-and-beatmaps
2022-01-18 15:07:59 +09:00
Dean Herbert
3429fd8768
Fix transaction scope and add even more logging
2022-01-18 14:47:00 +09:00
Dean Herbert
bf50a9b8f8
Also backup the realm database before migration
2022-01-18 14:30:41 +09:00
Dean Herbert
2b1c15b6cc
Allow BlockAllOperations
to be called from a non-update thread if update has never run
2022-01-18 14:30:32 +09:00
Dean Herbert
cf30d48721
Add more logging during migration process
2022-01-18 14:21:33 +09:00
Dean Herbert
798482c941
Create backups before deleting scores and beatmaps from EF database
2022-01-18 14:21:33 +09:00
Dean Herbert
b1a75ce480
Permanently delete client.db
after migration completes
2022-01-18 14:17:43 +09:00
Dean Herbert
a714941f93
Rename EF variable to make reading code easier
2022-01-18 14:06:22 +09:00
Dean Herbert
a7db793d8c
Specify realm pipe path location
...
I can't confirm this works yet, since I'm not sure what the
preconditions are for the `.note` file to be created. What I can confirm
is that a `.note` file hasn't appeared in my game data directory yet.
2022-01-18 11:43:23 +09:00