Realm v7.0.0 Release Notes

Release Date: 2020-05-16 // almost 4 years ago
  • ๐Ÿš€ NOTE: This version bumps the Realm file format to version 10. Files created with previous versions of Realm will be automatically upgraded. It is not possible to downgrade to version 9 or earlier. Only Studio 3.11 or later will be able to open the new file format. ๐Ÿš€ NOTE: This version bumps the Realm file format to version 10. Files created with previous versions of Realm will be automatically upgraded. It is not possible to downgrade to version 9 or earlier. Only Realm Studio 4 or later will be able to open the new file format.

    ๐Ÿ’ฅ Breaking Changes

    • ๐Ÿ— [ObjectServer] Removed deprecated method SyncConfiguration.Builder.partialRealm(). Use SyncConfiguration.Builder.fullSynchronization() instead.
    • ๐Ÿ”€ [ObjectServer] Removed deprecated methods SyncConfiguration.automatic() and SyncConfiguration.automatic(User, Uri). Use SyncUser.getDefaultConfiguration() and SyncUser.createConfiguration(Url).
    • ๐Ÿšš [ObjectServer] Removed deprecated method ErrorCode.fromInt(int).
    • ๐Ÿ”€ [ObjectServer] Removed deprecated method SyncCredentials.nickname(name) and SyncCredentials.nickname(name, isAdmin). Use SyncCredentials.usernamePassword(username, password) instead.
    • ๐Ÿ— [ObjectServer] Deprecated state SyncSession.State.ERROR has been removed. Use SyncConfiguration.Builder.errorHandler(ErrorHandler) instead.
    • ๐Ÿšš [ObjectServer] IncompatibleSyncedFileException is removed as it is no longer used.
    • ๐Ÿ”€ [ObjectServer] New error codes thrown by the underlying sync layers now have proper enum mappings in ErrorCode.java. A few other errors have been renamed in order to have consistent naming. (Issue #6387)
    • ๐Ÿ”€ RxJava Flowables and Observables are now subscribed to and unsubscribed to asynchronously on the thread holding the live Realm, instead of previously where this was done synchronously.
    • ๐Ÿ— All RxJava Flowables and Observables now return frozen objects instead of live objects. This can be configured using RealmConfiguration.Builder.rxFactory(new RealmObservableFactory(true|false)). By using frozen objects, it is possible to send RealmObjects across threads, which means that all RxJava operators should now be supported without the need to copy Realm data into unmanaged objects.
    • ๐Ÿ‘ MIPS is not supported anymore.
    • Realm now requires minSdkVersion 16. Up from 9.
    • ๐Ÿšš [ObjectServer] IncompatibleSyncedFileException is removed and no longer thrown.

    โœจ Enhancements

    • โž• Added Realm.freeze(), RealmObject.freeze(), RealmResults.freeze() and RealmList.freeze(). These methods will return a frozen version of the current Realm data. This data can be read from any thread without throwing an IllegalStateException, but will never change. All frozen Realms and data can be closed by calling Realm.close() on the frozen Realm, but fully closing all live Realms will also close the frozen ones. Frozen data can be queried as normal, but trying to mutate it in any way will throw an IllegalStateException. This includes all methods that attempt to refresh or add change listeners. (Issue #6590)
    • โž• Added Realm.isFrozen(), RealmObject.isFrozen(), RealmObject.isFrozen(RealmModel), RealmResults.isFrozen() and RealmList.isFrozen(), which returns whether or not the data is frozen.
    • โž• Added RealmConfiguration.Builder.maxNumberOfActiveVersions(long number). Setting this will cause Realm to throw an IllegalStateException if too many versions of the Realm data are live at the same time. Having too many versions can dramatically increase the filesize of the Realm.
    • Storing large binary blobs in Realm files no longer forces the file to be at least 8x the size of the largest blob.
    • โฌ‡๏ธ Reduce the size of transaction logs stored inside the Realm file, reducing file size growth from large transactions.
    • RealmResults.asJSON() is no longer @Beta
    • 0๏ธโƒฃ The default toString() for proxy objects now print the length of binary fields. (Issue #6767)

    ๐Ÿ›  Fixes

    • ๐Ÿ›  If a DynamicRealm and Realm was opened for the same file they would share transaction state by accident. The implication was that writes to a Realm would immediately show up in the DynamicRealm. This has been fixed, so now it is required to call refresh() on the other Realm or wait for normal change listeners to detect the change.

    Compatibility

    • Realm Object Server: 3.23.1 or later.
    • Realm Studio: 4.0.0 or later.
    • โฌ†๏ธ File format: Generates Realms with format v10 (Reads and upgrades all previous formats from Realm Java 2.0 and later).
    • ๐Ÿš€ APIs are backwards compatible with all previous release of realm-java in the 7.x.y series.

    Internal

    • OsSharedRealm.VersionID.hashCode() was not implemented correctly and included the memory location in the hashcode.
    • โฌ†๏ธ OKHttp was upgraded to 3.10.0 from 3.9.0.
    • โฌ†๏ธ The NDK has been upgraded from r10e to r21.
    • The compiler used for C++ code has changed from GCC to Clang.
    • โฌ†๏ธ OpenSSL used by Realms encryption layer has been upgraded from 1.0.2k to 1.1.1b.
    • โšก๏ธ Updated to Object Store commit: 820b74e2378f111991877d43068a95d2b7a2e404.
    • โšก๏ธ Updated to Realm Sync 5.0.3.
    • โšก๏ธ Updated to Realm Core 6.0.4.

    Credits

    • ๐Ÿ‘ Thanks to @joxon for better support for binary fields in proxy objects.