New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RealmSwift 5.5.0 Unable to open 4.4.1 Realm file - ERROR: Key Already Used #6884
Comments
Hi @duncangroenewald , could you provide us with a bit of sample code? Or at least a stack trace? Curious where this is occurring. |
@jsflax - sure I will take a look at it again and get back to you. I don't think there is a stack trace or I would have provided one. |
@jsflax - is there any chance you guys can do a RealmSwift 4.4.1 build with XCode 12 ? We're still not confident enough to go to 5.5.0 in production yet. I might raise a new issue for this. |
@jsflax - if I try and open the realm file with Realm Studio v3.11.0 I get the same error while upgrading the format - no crash. I can send you a dropbox link to the file via email if you provide an email address - it is around 40MB. |
Just downgraded back to 4.1.1. Still way more stable than 5+. Running xCode 12 with carthage |
@trr-amsiq are you using this with Realm Cloud ? If so how did you get the sync component included ? |
@duncangroenewald sorry missed that part! |
Can you send to eric.mossman@mongodb.com? |
@duncangroenewald |
@ericjordanmossman - as far as I am aware the issue still exists. However we are just working around this since it appears to be specific to a particular scenario, see the explanation from @ianpward below: OK - so the issue here is: In a core-5 file (RealmSwift 4.4.1), a table with a string primary key contains a column "!OID" that contains the "stable id" generated by object-store. This value is used as ObjKey when creating the objects in the core-6 file. For some reason, for the last two objects in the "LoginSession" table this value is 0. So when migrating the second object we get the "Key already used" exception. This is clearly an error in the input file as zero should never occur as !OID value. For this particular file you can just generate new keys for those objects, but it is hard to derive a general rule that would fix this problem. I can try and reproduce this creation of records with OID = 0 with SDK 5.x and 10.x if someone can explain how we can check the value of OID on the records. |
@duncangroenewald I know it's been a while, but– is this ticket still valid for you? I know you've been working on updated to 10.x. |
That bug was never fixed but we found a workaround so are currently using 5.x in production and testing 10.x on MongoDB Realm (cloud). I did see some others have posted what looked like the same bug. I didn't close this because I presume that same bug is still lurking in core somewhere waiting for the right set of circumstances. I will close this and if need be raise another if we ever see a reoccurrence on 10.x |
Goals
Open RealmSwift 4.4.1 local file with RealmSwift 5.5.0.
Expected Results
When opening RealmSwift 4.4.1 files with RealmSwift 5.5.0 we expect the file to be upgraded and opened without any errors.
Actual Results
RealmSwift 5.5.0 reports a fatal error "Key Already Used" when trying to open a Realm 4.4.1 file.
Steps for others to Reproduce
Open the Realm 4.4.1 file with an app using the Swift 5.5.0 RealmSwift library.
Code Sample
Can provide the Realm 4.4.1 file to debug via private channel
Version of Realm and Tooling
Realm framework version: Original realm file is RealmSwift 4.4.1.
Upgrading to RealmSwift 5.5.0
Realm Object Server version: Realm Cloud (not sure of what version)
Xcode version: 12.1
iOS/OSX version: macOS 10.15.7
Dependency manager + version: N/A
The text was updated successfully, but these errors were encountered: