osu/osu.Game/Database
Bartłomiej Dach 0e52797f29
Prefer not deleted models when picking model instances for reuse when importing
This fell out while investigating why the issue with online IDs
mismatching in the `.osu` could be worked around by importing the map
three times in total when starting from it not being available locally.

Here follows an explanation of why that "helped".

Import 1:
- The beatmap set is imported normally.
- Online metadata population sees the online ID mismatch and resets it
  on the problematic beatmap.

Import 2:
- The existing beatmap set is found, but deemed not reusable
  because of the single beatmap having its ID reset to -1.
- The existing beatmap set is marked deleted, and all the IDs of
  its beatmaps are reset to -1.
- The beatmap set is reimported afresh.
- Online metadata population still sees the online ID mismatch
  and resets it on the problematic beatmap.

Note that at this point the first import *is still physically present
in the database* but marked deleted.

Import 3:
- When trying to find the existing beatmap set to see if it can be
  reused, *the one pending deletion and with its IDs reset -
  - the remnant from import 1 - is returned*.
- Because of this, `validateOnlineIds()` resets online IDs
  *on the model representing the current reimport*.
- The beatmap set is reimported yet again.
- With the online ID reset, the online metadata population check for
  online ID mismatch does not run because *the IDs were reset to -1*
  earlier.

Preferring undeleted models when picking the model instance for reuse
prevents this scenario.
2024-10-30 08:18:44 +01:00
..
BackgroundDataStoreProcessor.cs Rename enum to non-plural now that it won't conflict 2024-10-01 19:55:46 +09:00
BeatmapExporter.cs Change `.olz` to use UTF-8 encoding 2024-04-30 21:40:04 +08:00
BeatmapLookupCache.cs
DetachedBeatmapStore.cs Rename and xmldoc `RealmResetEmptySet` 2024-10-09 14:18:34 +09:00
ExternalEditOperation.cs More xmldoc across new methods and classes 2024-07-10 18:34:48 +09:00
ICanAcceptFiles.cs
IHasFiles.cs
IHasGuidPrimaryKey.cs
IHasNamedFiles.cs
IHasOnlineID.cs
IHasPrimaryKey.cs
IHasRealmFiles.cs
IModelDownloader.cs
IModelFileManager.cs
IModelImporter.cs Fix(?) xmldoc 2024-07-10 19:22:49 +09:00
IModelManager.cs
INamedFile.cs
INamedFileInfo.cs
INamedFileUsage.cs
IPostNotifications.cs
ISoftDelete.cs
ImportParameters.cs
ImportProgressNotification.cs
ImportTask.cs
LegacyArchiveExporter.cs Fix formatting 2024-04-30 21:47:03 +08:00
LegacyBeatmapExporter.cs Truncate break times for legacy beatmap export 2024-06-26 16:20:56 +09:00
LegacyBeatmapImporter.cs
LegacyCollectionImporter.cs
LegacyExporter.cs
LegacyImportManager.cs Update `HasFlag` usages 2024-07-03 00:19:04 +09:00
LegacyModelImporter.cs
LegacyScoreExporter.cs
LegacyScoreImporter.cs
LegacySkinExporter.cs
LegacySkinImporter.cs
Live.cs
MemoryCachingComponent.cs
MissingBeatmapNotification.cs
ModelDownloader.cs
ModelManager.cs
OnlineLookupCache.cs
RealmAccess.cs Don't delete scores when deleting beatmaps 2024-10-22 01:39:05 +09:00
RealmArchiveModelImporter.cs Prefer not deleted models when picking model instances for reuse when importing 2024-10-30 08:18:44 +01:00
RealmExtensions.cs
RealmFileStore.cs
RealmLive.cs
RealmLiveUnmanaged.cs
RealmObjectExtensions.cs Inhibit original callback from firing when sending initial changeset 2024-07-09 16:05:58 +09:00
RealmResetEmptySet.cs Rename and xmldoc `RealmResetEmptySet` 2024-10-09 14:18:34 +09:00
StandardisedScoreMigrationTools.cs Compute total score without mods during standardised score conversion 2024-05-21 13:11:08 +02:00
TooManyDownloadsNotification.cs
UserLookupCache.cs Use lookup request in user lookup cache 2024-10-08 14:05:27 +02:00