From b1e34af7c216df360f898588f1a949d24c7b2534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Tue, 6 Aug 2024 08:21:37 +0200 Subject: [PATCH 1/5] Add test case to show bug --- packages/realm_dart/lib/realm.dart | 2 +- packages/realm_dart/test/results_test.dart | 14 ++++++++++++++ packages/realm_dart/test/test.dart | 3 +++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/realm_dart/lib/realm.dart b/packages/realm_dart/lib/realm.dart index b6935627e..319b3a140 100644 --- a/packages/realm_dart/lib/realm.dart +++ b/packages/realm_dart/lib/realm.dart @@ -3,4 +3,4 @@ // dart.library.cli is available only on dart desktop export 'src/realm_flutter.dart' if (dart.library.cli) 'src/realm_dart.dart'; -export 'package:ejson/ejson.dart'; +export 'package:ejson/ejson.dart'; \ No newline at end of file diff --git a/packages/realm_dart/test/results_test.dart b/packages/realm_dart/test/results_test.dart index add587f33..cd23180ee 100644 --- a/packages/realm_dart/test/results_test.dart +++ b/packages/realm_dart/test/results_test.dart @@ -1550,4 +1550,18 @@ void main() { expect(results.skip(2), results.toList().sublist(2)); expect(results.skip(2).take(3), [results[2], results[3], results[4]]); }); + + test('BETWEEN op', () { + final realm = getRealm(Configuration.local([Friend.schema, Party.schema])); + + final alice = Friend('alice', age: 36); + final bob = Friend('bob', age: 49, bestFriend: alice); + alice.bestFriend = bob; + + realm.write(() => realm.addAll([alice, bob])); + + expect(realm.query(r'age BETWEEN {$0, $1}', [20, 40]), [alice]); + // the following used to fail due to: https://github.com/realm/realm-core/issues/7935 + expect(realm.query(r'bestFriend.age BETWEEN {$0, $1}', [20, 40]), [bob]); + }); } diff --git a/packages/realm_dart/test/test.dart b/packages/realm_dart/test/test.dart index 624eac951..b2f13b2ae 100644 --- a/packages/realm_dart/test/test.dart +++ b/packages/realm_dart/test/test.dart @@ -258,6 +258,9 @@ class _Friend { var age = 42; _Friend? bestFriend; final friends = <_Friend>[]; + + @override + String toString() => '$name $age'; } @RealmModel() From 32af3f82fb434c7c0c7f8562aa8cf41fe4fd58c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Thu, 8 Aug 2024 18:52:02 +0200 Subject: [PATCH 2/5] Fix by updating core to include #7965 --- packages/realm_dart/src/realm-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/realm_dart/src/realm-core b/packages/realm_dart/src/realm-core index 60867846a..430a044fe 160000 --- a/packages/realm_dart/src/realm-core +++ b/packages/realm_dart/src/realm-core @@ -1 +1 @@ -Subproject commit 60867846a0aca0c7da5e482282b293236f730216 +Subproject commit 430a044fea5447546dd19efebdbd5a056272ac59 From a33968728d3c80135e4cf2ba0800ca89adfe9731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Fri, 9 Aug 2024 10:25:26 +0200 Subject: [PATCH 3/5] Update CHANGELOG --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75fbcd092..63154d4b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,19 @@ * Added a new parameter of type `SyncTimeoutOptions` to `AppConfiguration`. It allows users to control sync timings, such as ping/pong intervals as well various connection timeouts. (Issue [#1763](https://github.com/realm/realm-dart/issues/1763)) * Added a new parameter `cancelAsyncOperationsOnNonFatalErrors` on `Configuration.flexibleSync` that allows users to control whether non-fatal errors such as connection timeouts should be surfaced in the form of errors or if sync should try and reconnect in the background. (PR [#1764](https://github.com/realm/realm-dart/pull/1764)) * Allow nullable and other optional fields to be absent in EJson, when deserializing realm objects. (Issue [#1735](https://github.com/realm/realm-dart/issues/1735)) +* Sync log statements now include the app services connection id in their prefix (e.g `Connection[1:] Session[1]: log message`) to make correlating sync activity to server logs easier during troubleshooting (Core 14.11.2). +* Improve sync bootstrap performance by reducing the number of table selections in the replication logs for embedded objects. (Core v14.11.2-8-g430a044fe) +* Released a read lock which was pinned for the duration of a mutable subscription even after commit. This frees resources earlier, and may improve performance of sync bootstraps where the starting state is large. (Core v14.11.2-8-g430a044fe) +* Client reset cycle detection now checks if the previous recovery attempt was made by the same core version, and if not attempts recovery again (Core v14.11.2-8-g430a044fe). ### Fixed * Fixed an issue where creating a flexible sync configuration with an embedded object not referenced by any top-level object would throw a "No such table" exception with no meaningful information about the issue. Now a `RealmException` will be thrown that includes the offending object name, as well as more precise text for what the root cause of the error is. (PR [#1748](https://github.com/realm/realm-dart/pull/1748)) * `AppConfiguration.maxConnectionTimeout` never had any effect and has been deprecated in favor of `SyncTimeoutOptions.connectTimeout`. (PR [#1764](https://github.com/realm/realm-dart/pull/1764)) * Pure dart apps, when compiled to an exe and run from outside the project directory would fail to load the native shared library. (Issue [#1765](https://github.com/realm/realm-dart/issues/1765)) +* App subscription callback was getting fired before the user profile was retrieved on login, leading to an empty user profile when using the callback. (Core 14.11.1) +* Sync client may report duplicate compensating write errors (Core 14.11.2). +* String serialization of timestamps with a sufficiently large timestamp value could overflow an int causing undefined behavior, causing potentially bad values for the month/day/year values in stringified dates. (Core 14.11.2). +* Fixed an "invalid column key" exception when using a RQL "BETWEEN" query on an int or timestamp property across links. (Core v14.11.2-8-g430a044fe) ### Compatibility * Realm Studio: 15.0.0 or later. From 6a50f9f4a8d96083cec119a1c5a0bbb82e4b2815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Tue, 13 Aug 2024 15:17:00 +0200 Subject: [PATCH 4/5] Upgrade realm-core to v14.12.0 --- packages/realm_dart/src/realm-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/realm_dart/src/realm-core b/packages/realm_dart/src/realm-core index 430a044fe..c2552e1d3 160000 --- a/packages/realm_dart/src/realm-core +++ b/packages/realm_dart/src/realm-core @@ -1 +1 @@ -Subproject commit 430a044fea5447546dd19efebdbd5a056272ac59 +Subproject commit c2552e1d36867cb42b28130e894a81fc17081062 From 6a164295d3b6b6f4e1725f7afd8279fbb8828ead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Tue, 13 Aug 2024 15:52:05 +0200 Subject: [PATCH 5/5] Update CHANGELOG --- CHANGELOG.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63154d4b0..1d292628e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,24 +5,22 @@ * Added a new parameter `cancelAsyncOperationsOnNonFatalErrors` on `Configuration.flexibleSync` that allows users to control whether non-fatal errors such as connection timeouts should be surfaced in the form of errors or if sync should try and reconnect in the background. (PR [#1764](https://github.com/realm/realm-dart/pull/1764)) * Allow nullable and other optional fields to be absent in EJson, when deserializing realm objects. (Issue [#1735](https://github.com/realm/realm-dart/issues/1735)) * Sync log statements now include the app services connection id in their prefix (e.g `Connection[1:] Session[1]: log message`) to make correlating sync activity to server logs easier during troubleshooting (Core 14.11.2). -* Improve sync bootstrap performance by reducing the number of table selections in the replication logs for embedded objects. (Core v14.11.2-8-g430a044fe) -* Released a read lock which was pinned for the duration of a mutable subscription even after commit. This frees resources earlier, and may improve performance of sync bootstraps where the starting state is large. (Core v14.11.2-8-g430a044fe) -* Client reset cycle detection now checks if the previous recovery attempt was made by the same core version, and if not attempts recovery again (Core v14.11.2-8-g430a044fe). +* Improve sync bootstrap performance by reducing the number of table selections in the replication logs for embedded objects. (Core v14.12.0) +* Released a read lock which was pinned for the duration of a mutable subscription even after commit. This frees resources earlier, and may improve performance of sync bootstraps where the starting state is large. (Core v14.12.0) +* Client reset cycle detection now checks if the previous recovery attempt was made by the same core version, and if not attempts recovery again (Core v14.12.0). ### Fixed * Fixed an issue where creating a flexible sync configuration with an embedded object not referenced by any top-level object would throw a "No such table" exception with no meaningful information about the issue. Now a `RealmException` will be thrown that includes the offending object name, as well as more precise text for what the root cause of the error is. (PR [#1748](https://github.com/realm/realm-dart/pull/1748)) * `AppConfiguration.maxConnectionTimeout` never had any effect and has been deprecated in favor of `SyncTimeoutOptions.connectTimeout`. (PR [#1764](https://github.com/realm/realm-dart/pull/1764)) * Pure dart apps, when compiled to an exe and run from outside the project directory would fail to load the native shared library. (Issue [#1765](https://github.com/realm/realm-dart/issues/1765)) -* App subscription callback was getting fired before the user profile was retrieved on login, leading to an empty user profile when using the callback. (Core 14.11.1) * Sync client may report duplicate compensating write errors (Core 14.11.2). -* String serialization of timestamps with a sufficiently large timestamp value could overflow an int causing undefined behavior, causing potentially bad values for the month/day/year values in stringified dates. (Core 14.11.2). -* Fixed an "invalid column key" exception when using a RQL "BETWEEN" query on an int or timestamp property across links. (Core v14.11.2-8-g430a044fe) +* Fixed an "invalid column key" exception when using a RQL "BETWEEN" query on an int or timestamp property across links. (Core v14.12.0) ### Compatibility * Realm Studio: 15.0.0 or later. ### Internal -* Using Core x.y.z. +* Using Core 14.12.0 ## 3.3.0 (2024-07-20)