Skip to content

Commit

Permalink
Merge tag 'v14.10.4' into next-major
Browse files Browse the repository at this point in the history
  • Loading branch information
jedelbo committed Jul 12, 2024
2 parents 0e533a7 + 44db2a2 commit 18e5d20
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 12 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,27 @@

----------------------------------------------

# 14.10.4 Release notes

### Enhancements
* None.

### Fixed
* When a public name is defined on a property, calling `realm::Results::sort()` or `realm::Results::distinct()` with the internal name could throw an error like `Cannot sort on key path 'NAME': property 'PersonObject.NAME' does not exist`. ([realm/realm-js#6779](https://github.com/realm/realm-js/issues/6779), since v12.12.0)

### Breaking changes
* None.

### Compatibility
* Fileformat: Generates files with format v24. Reads and automatically upgrade from fileformat v10. If you want to upgrade from an earlier file format version you will have to use RealmCore v13.x.y or earlier.

-----------

### Internals
* Fix a thread sanitizer failure in the "unregister connection change listener during callback" test ([PR #7871](https://github.com/realm/realm-core/pull/7871)).

----------------------------------------------

# 14.10.3 Release notes

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import PackageDescription
import Foundation

let versionStr = "14.10.3"
let versionStr = "14.10.4"
let versionPieces = versionStr.split(separator: "-")
let versionCompontents = versionPieces[0].split(separator: ".")
let versionExtra = versionPieces.count > 1 ? versionPieces[1] : ""
Expand Down
6 changes: 3 additions & 3 deletions dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PACKAGE_NAME: realm-core
VERSION: 14.10.3
VERSION: 14.10.4
OPENSSL_VERSION: 3.2.0
ZLIB_VERSION: 1.2.13
# https://github.com/10gen/baas/commits
# 9d1b4d6 is 2024 May 8
BAAS_VERSION: 9d1b4d628babadfb606ebcadb93b1e5cae3c9565
# 2f308db is 2024 July 10
BAAS_VERSION: 2f308db6f65333728a101d1fecbb792f9659a5ce
3 changes: 3 additions & 0 deletions src/realm/object-store/results.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,9 @@ static std::vector<ExtendedColumnKey> parse_keypath(StringData keypath, Schema c
begin = sep + (sep != end);

auto prop = object_schema->property_for_public_name(key);
if (!prop) {
prop = object_schema->property_for_name(key);
}
check(prop, "property '%1.%2' does not exist", object_schema->name, key);
if (is_dictionary(prop->type)) {
check(index.length(), "missing dictionary key");
Expand Down
27 changes: 25 additions & 2 deletions test/object-store/results.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4983,7 +4983,7 @@ TEST_CASE("results: public name declared", "[results]") {
realm->commit_transaction();
Results r(realm, table);

SECTION("sorted") {
SECTION("sorted by public_name") {
auto sorted = r.sort({{"public_value", true}});
REQUIRE(sorted.limit(0).size() == 0);
REQUIRE_ORDER(sorted.limit(1), 2);
Expand All @@ -4992,7 +4992,16 @@ TEST_CASE("results: public name declared", "[results]") {
REQUIRE_ORDER(sorted.limit(100), 2, 6, 3, 7, 0, 4, 1, 5);
}

SECTION("distinct") {
SECTION("sorted by name") {
auto sorted = r.sort({{"value", true}});
REQUIRE(sorted.limit(0).size() == 0);
REQUIRE_ORDER(sorted.limit(1), 2);
REQUIRE_ORDER(sorted.limit(2), 2, 6);
REQUIRE_ORDER(sorted.limit(8), 2, 6, 3, 7, 0, 4, 1, 5);
REQUIRE_ORDER(sorted.limit(100), 2, 6, 3, 7, 0, 4, 1, 5);
}

SECTION("distinct by public_name") {
auto sorted = r.distinct({"public_value"});
REQUIRE(sorted.limit(0).size() == 0);
REQUIRE_ORDER(sorted.limit(1), 0);
Expand All @@ -5005,6 +5014,20 @@ TEST_CASE("results: public name declared", "[results]") {
REQUIRE_ORDER(sorted.limit(2), 2, 3);
REQUIRE_ORDER(sorted.limit(8), 2, 3, 0, 1);
}

SECTION("distinct by name") {
auto sorted = r.distinct({"value"});
REQUIRE(sorted.limit(0).size() == 0);
REQUIRE_ORDER(sorted.limit(1), 0);
REQUIRE_ORDER(sorted.limit(2), 0, 1);
REQUIRE_ORDER(sorted.limit(8), 0, 1, 2, 3);

sorted = r.sort({{"value", true}}).distinct({"value"});
REQUIRE(sorted.limit(0).size() == 0);
REQUIRE_ORDER(sorted.limit(1), 2);
REQUIRE_ORDER(sorted.limit(2), 2, 3);
REQUIRE_ORDER(sorted.limit(8), 2, 3, 0, 1);
}
}

TEST_CASE("notifications: objects with PK recreated", "[results]") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ TEST_CASE("sync: Connection state changes", "[sync][session][connection change]"

auto token1 = session->register_connection_change_callback(
[&](SyncSession::ConnectionState, SyncSession::ConnectionState) {
listener1_call_cnt = listener1_call_cnt + 1;
++listener1_call_cnt;
});
session->unregister_connection_change_callback(token1);
// One call may have been in progress when unregistered
Expand All @@ -87,16 +87,18 @@ TEST_CASE("sync: Connection state changes", "[sync][session][connection change]"
}

SECTION("unregister connection change listener during callback") {
uint64_t token1;
std::atomic<int> listener1_call_cnt(0);
std::atomic<bool> listener2_called(false);
int listener1_call_cnt = 0;
auto session = sync_session(
user, "/connection-state-changes-3", [](auto, auto) {}, SyncSessionStopPolicy::AfterChangesUploaded);
token1 = session->register_connection_change_callback(
std::mutex mutex;
std::unique_lock lock(mutex);
uint64_t token1 = session->register_connection_change_callback(
[&](SyncSession::ConnectionState, SyncSession::ConnectionState) {
listener1_call_cnt = listener1_call_cnt + 1;
std::lock_guard lock(mutex);
++listener1_call_cnt;
session->unregister_connection_change_callback(token1);
});
lock.unlock();

EventLoop::main().run_until([&] {
return sessions_are_active(*session);
Expand All @@ -105,6 +107,7 @@ TEST_CASE("sync: Connection state changes", "[sync][session][connection change]"
return sessions_are_connected(*session);
});

bool listener2_called = false;
session->register_connection_change_callback([&](SyncSession::ConnectionState, SyncSession::ConnectionState) {
listener2_called = true;
});
Expand Down

0 comments on commit 18e5d20

Please sign in to comment.