Skip to content

Commit 4883653

Browse files
author
Michael Wilkerson-Barker
authored
Merge pull request #7639 from realm/release/14.6.0-again
merge release 14.6.0
2 parents e91161d + 3434b20 commit 4883653

File tree

11 files changed

+381
-41
lines changed

11 files changed

+381
-41
lines changed

CHANGELOG.md

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,46 @@
22

33
### Enhancements
44
* <New feature description> (PR [#????](https://github.com/realm/realm-core/pull/????))
5-
* Add `SyncClientConfig::security_access_group` which allows specifying the access group to use for the sync metadata Realm's encryption key. Setting this is required when sharing the metadata Realm between apps on Apple platforms ([#7552](https://github.com/realm/realm-core/pull/7552)).
5+
* None.
6+
7+
### Fixed
8+
* <How do the end-user experience this issue? what was the impact?> ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?)
9+
* None.
10+
11+
### Breaking changes
12+
* None.
13+
14+
### Compatibility
15+
* 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.
16+
17+
-----------
18+
19+
### Internals
20+
* Follow on to ([PR #7300](https://github.com/realm/realm-core/pull/7300)) to allow SDKs to construct a fake user for testing SyncManager::get_user -> App::create_fake_user_for_testing ([PR #7632](https://github.com/realm/realm-core/pull/7632))
21+
22+
----------------------------------------------
23+
24+
# 14.6.0 Release notes
25+
26+
### Enhancements
27+
* Add `SyncClientConfig::security_access_group` which allows specifying the access group to use for the sync metadata Realm's encryption key. Setting this is required when sharing the metadata Realm between apps on Apple platforms ([PR #7552](https://github.com/realm/realm-core/pull/7552)).
628
* When connecting to multiple server apps, a unique encryption key is used for each of the metadata Realms rather than sharing one between them ([#7552](https://github.com/realm/realm-core/pull/7552)).
729
* Introduce the new `SyncUser` interface which can be implemented by SDKs to use sync without the core App Services implementation (or just for greater control over user behavior in tests). ([PR #7300](https://github.com/realm/realm-core/pull/7300)).
830
* Improve perfomance of "chained OR equality" queries for UUID/ObjectId types and RQL parsed "IN" queries on string/int/uuid/objectid types. ([.Net #3566](https://github.com/realm/realm-dotnet/issues/3566), since the introduction of these types)
9-
* Introducing `Query::in()` which allows SDKs to take advantage of improved performance when building equality conditions against many constants. ([#7582](https://github.com/realm/realm-core/pull/7582))
31+
* Introducing `Query::in()` which allows SDKs to take advantage of improved performance when building equality conditions against many constants. ([PR #7582](https://github.com/realm/realm-core/pull/7582))
1032

1133
### Fixed
12-
* <How do the end-user experience this issue? what was the impact?> ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?)
1334
* SyncUser::all_sessions() included sessions in every state *except* for waiting for access token, which was weirdly inconsistent. It now includes all sessions. ([PR #7300](https://github.com/realm/realm-core/pull/7300)).
1435
* App::all_users() included logged out users only if they were logged out while the App instance existed. It now always includes all logged out users. ([PR #7300](https://github.com/realm/realm-core/pull/7300)).
1536
* Deleting the active user left the active user unset rather than selecting another logged-in user as the active user like logging out and removing users did. ([PR #7300](https://github.com/realm/realm-core/pull/7300)).
1637
* Fixed several issues around encrypted file portability (copying a "bundled" encrypted Realm from one device to another):
1738
* Fixed `Assertion failed: new_size % (1ULL << m_page_shift) == 0` when opening an encrypted Realm less than 64Mb that was generated on a platform with a different page size than the current platform. ([#7322](https://github.com/realm/realm-core/issues/7322), since v13.17.1)
1839
* Fixed a `DecryptionFailed` exception thrown when opening a small (<4k of data) Realm generated on a device with a page size of 4k if it was bundled and opened on a device with a larger page size (since the beginning).
1940
* Fixed an issue during a subsequent open of an encrypted Realm for some rare allocation patterns when the top ref was within ~50 bytes of the end of a page. This could manifest as a DecryptionFailed exception or as an assertion: `encrypted_file_mapping.hpp:183: Assertion failed: local_ndx < m_page_state.size()`. ([#7319](https://github.com/realm/realm-core/issues/7319))
20-
* Non-streaming download sync progress notification is fixed for flexible sync Realms where before it was sometimes stopping to emit values right after the registration of the callback (PR [#7561](https://github.com/realm/realm-core/issues/7561)).
41+
* Non-streaming download sync progress notification is fixed for flexible sync Realms where before it was sometimes stopping to emit values right after the registration of the callback ([#7561](https://github.com/realm/realm-core/issues/7561)).
2142
* Schema initialization could hit an assertion failure if the sync client applied a downloaded changeset while the Realm file was in the process of being opened ([#7041](https://github.com/realm/realm-core/issues/7041), since v11.4.0).
2243
* Queries using query paths on Mixed values returns inconsistent results ([#7587](https://github.com/realm/realm-core/issues/7587), since v14.0.0)
44+
* Enabling 'cancel_waits_on_nonfatal_error' does not cancel waits during location update while offline ([#7527](https://github.com/realm/realm-core/issues/7527), since v13.26.0)
2345

2446
### Breaking changes
2547
* The following things have been renamed or moved as part of moving all of the App Services functionality to the app namespace:
@@ -33,9 +55,7 @@
3355
- SyncUser::session_for_on_disk_path() -> SyncManager::get_existing_session()
3456
- SyncUser::all_sessions() -> SyncManager::get_all_sessions_for(User&)
3557
- SyncManager::immediately_run_file_actions() -> App::immediately_run_file_actions()
36-
- realm_sync_user_subscription_token -> realm_app_user_subscription_token
37-
- SyncManager::get_user -> App::create_fake_user_for_testing
38-
([PR #7300](https://github.com/realm/realm-core/pull/7300)).
58+
- realm_sync_user_subscription_token -> realm_app_user_subscription_token ([PR #7300](https://github.com/realm/realm-core/pull/7300)).
3959
* The `ClientAppDeallocated` error code no longer exists as this error code can no longer occur. ([PR #7300](https://github.com/realm/realm-core/pull/7300)).
4060
* Some fields have moved from SyncClientConfig to AppConfig. AppConfig now has a SyncClientConfig field rather than it being passed separately to App::get_app(). ([PR #7300](https://github.com/realm/realm-core/pull/7300)).
4161
* Sync user management has been removed from SyncManager. This functionality was already additionally available on App. ([PR #7300](https://github.com/realm/realm-core/pull/7300)).
@@ -49,8 +69,8 @@
4969
-----------
5070

5171
### Internals
52-
* App metadata storage has been entirely rewritten in preparation for supporting sharing metadata realms between processes. ([PR #7300](https://github.com/realm/realm-core/pull/7300).
53-
* The metadata disabled mode has been replaced with an in-memory metadata mode which performs similarly and doesn't work weirdly differently from the normal mode. The new mode is intended for testing purposes, but should be suitable for production usage if there is a scenario where metadata persistence is not needed. ([PR #7300](https://github.com/realm/realm-core/pull/7300).
72+
* App metadata storage has been entirely rewritten in preparation for supporting sharing metadata realms between processes. ([PR #7300](https://github.com/realm/realm-core/pull/7300)).
73+
* The metadata disabled mode has been replaced with an in-memory metadata mode which performs similarly and doesn't work weirdly differently from the normal mode. The new mode is intended for testing purposes, but should be suitable for production usage if there is a scenario where metadata persistence is not needed. ([PR #7300](https://github.com/realm/realm-core/pull/7300)).
5474
* The ownership relationship between App and User has changed. User now strongly retains App and App has a weak cache of Users. This means that creating a SyncConfig or opening a Realm will keep the parent App alive, rather than things being in a broken state if the App is deallocated. ([PR #7300](https://github.com/realm/realm-core/pull/7300).
5575
* A new CMake define `REALM_APP_SERVICES` can be used to compile out core's default implmentation of the application services. ([#7268](https://github.com/realm/realm-core/issues/7268))
5676
* Fix a race condition in Promise which could result in an assertion failure if it was destroyed immediately after a `get()` on the Future returned. The problematic scenario only occurred in test code and not in library code ([PR #7602](https://github.com/realm/realm-core/pull/7602)).

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import PackageDescription
44
import Foundation
55

6-
let versionStr = "14.5.2"
6+
let versionStr = "14.6.0"
77
let versionPieces = versionStr.split(separator: "-")
88
let versionCompontents = versionPieces[0].split(separator: ".")
99
let versionExtra = versionPieces.count > 1 ? versionPieces[1] : ""

bindgen/spec.yml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ headers:
1919
- "realm/object-store/sync/app.hpp"
2020
- "realm/object-store/sync/sync_manager.hpp"
2121
- "realm/object-store/sync/sync_session.hpp"
22-
- "realm/object-store/sync/app_user.hpp"
2322
- "realm/object-store/sync/sync_user.hpp"
23+
- "realm/object-store/sync/app_user.hpp"
2424
- "realm/object-store/sync/mongo_collection.hpp"
2525
- "realm/util/bson/bson.hpp"
2626

@@ -739,6 +739,7 @@ classes:
739739
# TODO: Consider making preverify_ok a bool.
740740
make_ssl_verify_callback: '(callback: (server_address: const std::string&, server_port: int, pem_data: std::string_view, preverify_ok: int, depth: int) off_thread -> bool) -> SSLVerifyCallback'
741741
needs_file_format_upgrade: '(config: const RealmConfig&) -> bool'
742+
sync_user_as_app_user: '(sync_user: Nullable<std::shared_ptr<SyncUser>>) -> Nullable<std::shared_ptr<User>>'
742743

743744
LogCategoryRef:
744745
cppName: util::LogCategoryRef
@@ -1205,7 +1206,13 @@ classes:
12051206
cppName: app::User::Token
12061207

12071208
SyncUser:
1209+
cppName: SyncUser
12081210
sharedPtrWrapped: SharedSyncUser
1211+
1212+
User:
1213+
base: SyncUser
1214+
cppName: app::User
1215+
sharedPtrWrapped: SharedUser
12091216
properties:
12101217
is_logged_in: bool
12111218
user_id: std::string
@@ -1214,21 +1221,6 @@ classes:
12141221
access_token: std::string
12151222
refresh_token: std::string
12161223
state: SyncUserState
1217-
sync_manager: SharedSyncManager
1218-
methods:
1219-
access_token_refresh_required: '() -> bool'
1220-
# request_log_out: '(cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
1221-
request_refresh_user: '(cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
1222-
request_refresh_location: '(cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
1223-
request_access_token: '(cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
1224-
track_realm: '(path: std::string_view)'
1225-
create_file_action: '(action: SyncFileAction, original_path: std::string_view, requested_recovery_dir: std::optional<std::string>, partition_value: std::string_view) -> std::string'
1226-
1227-
User:
1228-
base: SyncUser
1229-
cppName: app::User
1230-
sharedPtrWrapped: SharedUser
1231-
properties:
12321224
is_anonymous: bool
12331225
device_id: std::string
12341226
has_device_id: bool
@@ -1242,6 +1234,13 @@ classes:
12421234
subscribe: '(observer: (user: IgnoreArgument<const User&>)) -> UserSubscriptionToken'
12431235
unsubscribe: '(token: UserSubscriptionToken)'
12441236
path_for_realm: '(config: SyncConfig&, custom_file_name: std::optional<std::string>&) -> std::string'
1237+
access_token_refresh_required: '() -> bool'
1238+
# # request_log_out: '(cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
1239+
request_refresh_user: '(cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
1240+
request_refresh_location: '(cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
1241+
request_access_token: '(cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
1242+
track_realm: '(path: std::string_view)'
1243+
create_file_action: '(action: SyncFileAction, original_path: std::string_view, requested_recovery_dir: std::optional<std::string>, partition_value: std::string_view) -> std::string'
12451244

12461245
UserProfile:
12471246
cppName: app::UserProfile
@@ -1361,7 +1360,7 @@ classes:
13611360
reconnect: ()
13621361
wait_for_sessions_to_terminate: ()
13631362
get_existing_active_session: '(path: const std::string&) -> Nullable<SharedSyncSession>'
1364-
get_all_sessions_for: '(user: const SyncUser&) -> std::vector<SharedSyncSession>'
1363+
get_all_sessions_for: '(user: const User&) -> std::vector<SharedSyncSession>'
13651364

13661365
ThreadSafeReference: {}
13671366
AsyncOpenTask:

bindgen/src/realm_helpers.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include <realm/object-store/shared_realm.hpp>
3131
#include <realm/object-store/sync/generic_network_transport.hpp>
3232
#include <realm/object-store/util/event_loop_dispatcher.hpp>
33+
#include <realm/object-store/sync/app_user.hpp>
34+
#include <realm/object-store/sync/sync_user.hpp>
3335
#include <realm/util/functional.hpp>
3436
#include <string_view>
3537
#include <system_error>
@@ -283,6 +285,11 @@ struct Helpers {
283285
{
284286
return config.needs_file_format_upgrade();
285287
}
288+
289+
static std::shared_ptr<app::User> sync_user_as_app_user(std::shared_ptr<SyncUser> sync_user)
290+
{
291+
return std::dynamic_pointer_cast<app::User>(sync_user);
292+
}
286293
};
287294

288295
struct ObjectChangeSet {

dependencies.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PACKAGE_NAME: realm-core
2-
VERSION: 14.5.2
2+
VERSION: 14.6.0
33
OPENSSL_VERSION: 3.2.0
44
ZLIB_VERSION: 1.2.13
55
# https://github.com/10gen/baas/commits

src/realm/object-store/sync/app.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,7 @@ void App::log_out(const std::shared_ptr<User>& user, SyncUser::State new_state,
842842
return;
843843
}
844844

845+
log_debug("App: log_out(%1)", user->user_id());
845846
auto request =
846847
make_request(HttpMethod::del, url_for_path("/auth/session"), user, RequestTokenType::RefreshToken, "");
847848

@@ -1300,14 +1301,17 @@ void App::refresh_access_token(const std::shared_ptr<User>& user, bool update_lo
13001301
return;
13011302
}
13021303

1303-
log_debug("App: refresh_access_token: email: %1 %2", user->user_profile().email(),
1304-
update_location ? "(updating location)" : "");
1304+
log_debug("App: refresh_access_token: user_id: %1%2", user->user_id(),
1305+
update_location ? " (updating location)" : "");
13051306

13061307
// If update_location is set, force the location info to be updated before sending the request
13071308
do_request(
13081309
make_request(HttpMethod::post, url_for_path("/auth/session"), user, RequestTokenType::RefreshToken, ""),
13091310
[completion = std::move(completion), self = shared_from_this(), user](auto&&, const Response& response) {
13101311
if (auto error = AppUtils::check_for_errors(response)) {
1312+
self->log_error("App: refresh_access_token: %1 -> %2 ERROR: %3", user->user_id(),
1313+
response.http_status_code, error->what());
1314+
13111315
return completion(std::move(error));
13121316
}
13131317

src/realm/object-store/sync/sync_session.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,15 @@ SyncSession::handle_refresh(const std::shared_ptr<SyncSession>& session, bool re
340340
// internal backoff timer which will happen automatically so nothing needs to
341341
// happen here.
342342
util::CheckedUniqueLock lock(session->m_state_mutex);
343+
// If updating access token while opening realm, just become active at this point
344+
// and try to use the current access token.
343345
if (session->m_state == State::WaitingForAccessToken) {
344346
session->become_active();
345347
}
348+
// If `cancel_waits_on_nonfatal_error` is true, then cancel the waiters and pass along the error
349+
else if (session->config(&SyncConfig::cancel_waits_on_nonfatal_error)) {
350+
session->cancel_pending_waits(std::move(lock), error->to_status()); // unlocks the mutex
351+
}
346352
}
347353
}
348354
else {

0 commit comments

Comments
 (0)