1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 09:27:34 +08:00
Commit Graph

33 Commits

Author SHA1 Message Date
Dean Herbert
114c9e8c1f Update all usages of CreateContext to use either Run or Write 2022-01-21 17:27:08 +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
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
Dean Herbert
d440197fb3 Merge branch 'master' into realm-integration/faster-migration 2022-01-19 12:56:42 +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
195534a1d2 Only output "successful" messages when copy actually occurred 2022-01-19 10:31:13 +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
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
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
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
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
2f2c498477 Fix importer not considering that some EF beatmaps have no local metadata 2022-01-14 23:31:42 +09:00
Dean Herbert
2840a71dda Uncomment EF deletion lines in migrations 2022-01-13 18:28:00 +09:00
Dean Herbert
b610d2db12 Add EF to realm beatmap migration 2022-01-13 18:23:18 +09:00
Dean Herbert
45a23e5a43 Add EF to realm score migration 2022-01-13 18:23:18 +09:00
Bartłomiej Dach
4278a320e4
Fix skin setting resetting every launch
The reason this was happening was an unfortunate oversight in the
migration logic. The code that was attempting to parse the skin settings
as `int` was firing regardless of whether a skin migration from EF to
realm had already occurred. If it had occurred, the skin setting would
contain a GUID rather than an integer, and therefore fail to parse, and
therefore implicitly fallback to a EF skin ID of 0 which would be the
default skin.

Fix by not running the setting migrating logic at all when there are no
EF skins to migrate.
2021-12-06 20:12:02 +01:00
Bartłomiej Dach
8bef50cbba
Revert "Refactor migration precondition to read better"
Realm cannot translate `.All()` LINQ queries.

This reverts commit 0e0e8c25e8.
2021-12-01 19:39:44 +01:00
Dean Herbert
0e0e8c25e8 Refactor migration precondition to read better 2021-12-01 12:48:49 +09:00
Dean Herbert
6f66ecd77b Move migrations to own file and add user skin choice config migration 2021-11-30 15:41:18 +09:00