-
Hello! I have a database from one of our users (ppy/osu#29413) that seems to be totally unrecoverable from our end, and I'm asking for help. The database in question: client.realm.zip It loads fine in Realm Studio and our application, however when a no-op migration to schema 42 is applied, realm crashes with:
Since the migration is a no-op, it's impossible for it to have added a duplicate value. I've tried manually searching for the duplicate during migration via: HashSet<string> ids = new HashSet<string>();
testPrimaryKey<Guid>("Skin", "ID");
testPrimaryKey<Guid>("Score", "ID");
testPrimaryKey<string>("Ruleset", "ShortName");
testPrimaryKey<Guid>("ModPreset", "ID");
testPrimaryKey<Guid>("KeyBinding", "ID");
testPrimaryKey<string>("File", "Hash");
testPrimaryKey<Guid>("BeatmapSet", "ID");
testPrimaryKey<Guid>("BeatmapCollection", "ID");
testPrimaryKey<Guid>("Beatmap", "ID");
void testPrimaryKey<T>(string objectName, string pkColumn)
{
ids.Clear();
foreach (var item in migration.OldRealm.DynamicApi.All(objectName))
{
if (!ids.Add(item.DynamicApi.Get<T>(pkColumn)!.ToString()!))
{
Trace.Fail("This should not be reached.");
}
}
} To no avail - the assertion never gets tripped, so we can't even see any duplicates. I've also tried to run a compact on the existing schema, prior to running the migration, and that does not solve the issue. There are two questions I have:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I found the object that causes this: Deleting this file makes Realm crash with:
And querying the |
Beta Was this translation helpful? Give feedback.
-
The problem was not a duplicate primary key, but rather that the index on the "class_File" table was corrupted. Unfortunately a cannot say how we could get into this state. As the damage was not too severe, I was able to recover the file. |
Beta Was this translation helpful? Give feedback.
The problem was not a duplicate primary key, but rather that the index on the "class_File" table was corrupted. Unfortunately a cannot say how we could get into this state. As the damage was not too severe, I was able to recover the file.
client1.realm..zip