Skip to content

Commit 6c1d0d7

Browse files
committed
Merge branch 'master' of github.com:realm/realm-core into next-major
2 parents b1c3664 + b10122e commit 6c1d0d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1595
-1752
lines changed

CHANGELOG.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,49 @@
2121

2222
----------------------------------------------
2323

24+
# 14.11.2 Release notes
25+
26+
### Enhancements
27+
* Sync log statements now include the app services connection id in their prefix (e.g `Connection[1:<connection id>] Session[1]: log message`) to make correlating sync activity to server logs easier during troubleshooting ((PR #7849)[https://github.com/realm/realm-core/pull/7849]).
28+
29+
### Fixed
30+
* Sync client may report duplicate compensating write errors ([#7708](https://github.com/realm/realm-core/issues/7708), since v14.8.0).
31+
32+
### Breaking changes
33+
* None.
34+
35+
### Compatibility
36+
* 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.
37+
38+
-----------
39+
40+
### Internals
41+
* Fix emscripten build and add emscripten debug/release compile tasks to evergreen. ([PR #7916](https://github.com/realm/realm-core/pull/7916))
42+
* Subscription set state change notifications now work in a multiprocess-compatible manner ([PR #7862](https://github.com/realm/realm-core/pull/7862)).
43+
44+
----------------------------------------------
45+
46+
# 14.11.1 Release notes
47+
48+
### Enhancements
49+
* None.
50+
51+
### Fixed
52+
* App subscription callback was getting fired before the user profile was retrieved on login, leading to an empty user profile when using the callback. ([#7889](https://github.com/realm/realm-core/issues/7889), since v14.7.0)
53+
54+
### Breaking changes
55+
* The websocket error codes `websocket_client_too_old`, `websocket_client_too_new`, and `websocket_protocol_mismatch` along with their C API constants were removed. These corresponded to errors the legacy C++ server could have sent, but the baas sync server never did. Any platform networking implementations that surfaced these errors can report a `websocket_fatal_error` instead if an unknown error occurs during the websocket handshake. If a client connects that is too old or too new, it will finish the websocket handshake and then receive an in-band sync `ERROR` message that will be handled by the sync error handler. [PR #7917](https://github.com/realm/realm-core/pull/7917)
56+
57+
### Compatibility
58+
* 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.
59+
60+
-----------
61+
62+
### Internals
63+
* None.
64+
65+
----------------------------------------------
66+
2467
# 14.11.0 Release notes
2568

2669
### Enhancements

Package.swift

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

6-
let versionStr = "14.11.0"
6+
let versionStr = "14.11.2"
77
let versionPieces = versionStr.split(separator: "-")
88
let versionCompontents = versionPieces[0].split(separator: ".")
99
let versionExtra = versionPieces.count > 1 ? versionPieces[1] : ""
@@ -122,7 +122,6 @@ let notSyncServerSources: [String] = [
122122
"realm/sync/noinst/client_reset.cpp",
123123
"realm/sync/noinst/client_reset_operation.cpp",
124124
"realm/sync/noinst/client_reset_recovery.cpp",
125-
"realm/sync/noinst/compact_changesets.cpp",
126125
"realm/sync/noinst/migration_store.cpp",
127126
"realm/sync/noinst/pending_bootstrap_store.cpp",
128127
"realm/sync/noinst/pending_reset_store.cpp",

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.11.0
2+
VERSION: 14.11.2
33
OPENSSL_VERSION: 3.2.0
44
ZLIB_VERSION: 1.2.13
55
# https://github.com/10gen/baas/commits

evergreen/config.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,48 @@ functions:
205205
-j ${max_jobs|$(grep -c proc /proc/cpuinfo)} \
206206
$target
207207
208+
"compile emscripten":
209+
- command: shell.exec
210+
params:
211+
working_dir: realm-core
212+
shell: bash
213+
script: |-
214+
set -o errexit
215+
set -o pipefail
216+
set -o verbose
217+
218+
if [ -n "${cmake_bindir|}" ]; then
219+
export CMAKE="$(./evergreen/abspath.sh "${cmake_bindir}/cmake")"
220+
else
221+
export CMAKE="cmake"
222+
fi
223+
224+
# Check out the Emscripten SDK and activate the specified version
225+
echo "Activating emscripten SDK version: ${emsdk_version|latest}"
226+
git clone https://github.com/emscripten-core/emsdk.git
227+
228+
pushd emsdk/ > /dev/null # realm-core/emsdk
229+
./emsdk install ${emsdk_version|latest}
230+
./emsdk activate ${emsdk_version|latest}
231+
source ./emsdk_env.sh
232+
popd > /dev/null # realm-core
233+
234+
if [[ "$(uname -s)" =~ Darwin* ]]; then
235+
NPROC="$(sysctl -n hw.ncpu)"
236+
else
237+
NPROC="$(nproc)"
238+
fi
239+
240+
mkdir -p build-emscripten
241+
pushd build-emscripten > /dev/null # realm-core/build-emscripten
242+
243+
# shellcheck disable=SC2086,SC2090
244+
emcmake $CMAKE -D CMAKE_BUILD_TYPE="${cmake_build_type|Debug}" \
245+
..
246+
247+
make "-j$NPROC" 2>&1
248+
popd > /dev/null # realm-core
249+
208250
"run benchmark":
209251
- command: shell.exec
210252
params:
@@ -328,6 +370,10 @@ functions:
328370
export TSAN_OPTIONS="suppressions=$(pwd)/test/tsan.suppress history_size=4 $TSAN_OPTIONS"
329371
export UBSAN_OPTIONS="print_stacktrace=1"
330372
373+
if [[ -n "${enable_baas_redirector}" ]]; then
374+
export ENABLE_BAAS_REDIRECTOR=On
375+
fi
376+
331377
cd build
332378
if ! "$CTEST" -C ${cmake_build_type|Debug} $TEST_FLAGS; then
333379
BAAS_PID=$(pgrep baas_server)
@@ -753,6 +799,12 @@ tasks:
753799
commands:
754800
- func: "compile"
755801

802+
- name: compile-emscripten
803+
exec_timeout_secs: 1800
804+
tags: [ "for_pull_requests" ]
805+
commands:
806+
- func: "compile emscripten"
807+
756808
- name: package
757809
exec_timeout_secs: 1800
758810
commands:
@@ -1271,6 +1323,20 @@ task_groups:
12711323
- compile
12721324
- ".test_suite !.requires_baas"
12731325

1326+
# Runs only the baas integration tests
1327+
- name: only_baas_integration_tests
1328+
max_hosts: 1
1329+
setup_group_can_fail_task: true
1330+
setup_group:
1331+
- func: "fetch source"
1332+
- func: "fetch binaries"
1333+
teardown_task:
1334+
- func: "upload test results"
1335+
timeout:
1336+
- func: "run hang analyzer"
1337+
tasks:
1338+
- ".requires_baas"
1339+
12741340
# Runs object-store-tests against baas running on remote host
12751341
- name: compile_test
12761342
max_hosts: 1
@@ -1287,6 +1353,15 @@ task_groups:
12871353
- compile
12881354
- .test_suite
12891355

1356+
- name: compile_emscripten
1357+
max_hosts: 1
1358+
setup_group_can_fail_task: true
1359+
setup_group:
1360+
- func: "fetch source"
1361+
- func: "fetch binaries"
1362+
tasks:
1363+
- compile-emscripten
1364+
12901365
# Runs object-store-tests against baas running on remote host and runs
12911366
# the network simulation tests as a separate task for nightly builds
12921367
- name: network_tests
@@ -1426,6 +1501,17 @@ buildvariants:
14261501
tasks:
14271502
- name: compile_test
14281503

1504+
- name: ubuntu-with-redirects
1505+
display_name: "Ubuntu (Baas Redirector Enabled)"
1506+
run_on: ubuntu2204-arm64-large
1507+
expansions:
1508+
fetch_missing_dependencies: On
1509+
c_compiler: "/opt/clang+llvm/bin/clang"
1510+
cxx_compiler: "/opt/clang+llvm/bin/clang++"
1511+
enable_baas_redirector: On
1512+
tasks:
1513+
- name: only_baas_integration_tests
1514+
14291515
- name: ubuntu-no-geospatial
14301516
display_name: "Ubuntu (Geospatial Disabled)"
14311517
run_on: ubuntu2204-arm64-large
@@ -1627,6 +1713,27 @@ buildvariants:
16271713
tasks:
16281714
- name: fuzzer-tests
16291715

1716+
- name: ubuntu-emscripten
1717+
display_name: "Ubuntu (Emscripten x86_64)"
1718+
run_on: ubuntu2204-large
1719+
expansions:
1720+
cmake_url: "https://s3.amazonaws.com/static.realm.io/evergreen-assets/cmake-3.26.3-linux-x86_64.tar.gz"
1721+
cmake_bindir: "./cmake_binaries/bin"
1722+
emsdk_version: "3.1.37"
1723+
tasks:
1724+
- name: compile_emscripten
1725+
1726+
- name: ubuntu-emscripten-release
1727+
display_name: "Ubuntu (Emscripten x86_64 Release build)"
1728+
run_on: ubuntu2204-large
1729+
expansions:
1730+
cmake_url: "https://s3.amazonaws.com/static.realm.io/evergreen-assets/cmake-3.26.3-linux-x86_64.tar.gz"
1731+
cmake_bindir: "./cmake_binaries/bin"
1732+
cmake_build_type: RelWithDebInfo
1733+
emsdk_version: "3.1.37"
1734+
tasks:
1735+
- name: compile_emscripten
1736+
16301737
# disable these builders since there are constantly failing and not yet ready for nightly builds
16311738
# - name: ubuntu2004-network-nonideal
16321739
# display_name: "Ubuntu 20.04 x86_64 (Utunbu2004 - nonideal transfer)"
@@ -1858,6 +1965,7 @@ buildvariants:
18581965
cxx_compiler: "./clang_binaries/bin/clang++"
18591966
enable_llvm_coverage: On
18601967
coveralls_flag_name: "ubuntu-x86_64"
1968+
enable_baas_redirector: On
18611969
grcov_url: "https://s3.amazonaws.com/static.realm.io/evergreen-assets/grcov-x86_64-unknown-linux-gnu.tar.bz2"
18621970
tasks:
18631971
- name: compile_test_coverage
@@ -1976,6 +2084,22 @@ buildvariants:
19762084
cmake_bindir: "/cygdrive/c/Program Files/CMake/bin/"
19772085
cmake_generator: "Visual Studio 16 2019"
19782086
cmake_generator_platform: "Win32"
2087+
cmake_build_type: "Release"
2088+
extra_flags: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0
2089+
max_jobs: $(($(grep -c proc /proc/cpuinfo) / 2))
2090+
fetch_missing_dependencies: On
2091+
python3: "/cygdrive/c/python/python37/python.exe"
2092+
no_tests: On
2093+
tasks:
2094+
- name: compile_only
2095+
2096+
- name: windows-x64-uwp
2097+
display_name: "Windows X64 (UWP)"
2098+
run_on: windows-vsCurrent-large
2099+
expansions:
2100+
cmake_bindir: "/cygdrive/c/Program Files/CMake/bin/"
2101+
cmake_generator: "Visual Studio 16 2019"
2102+
extra_flags: "-A x64"
19792103
cmake_build_type: "Debug"
19802104
extra_flags: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0
19812105
max_jobs: $(($(grep -c proc /proc/cpuinfo) / 2))

src/realm/alloc_slab.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ class SlabAlloc : public Allocator {
147147
/// This can happen if the conflicting thread (or process) terminates or
148148
/// crashes before the next retry.
149149
///
150-
/// \throw FileAccessError
151-
/// \throw SlabAlloc::Retry
150+
/// \throw FileAccessError if unable to access the file
151+
/// \throw SlabAlloc::Retry if the request cannot be completed right now
152152
ref_type attach_file(const std::string& file_path, Config& cfg, util::WriteObserver* write_observer = nullptr);
153153

154154
/// @brief Expand or contract file
@@ -179,7 +179,7 @@ class SlabAlloc : public Allocator {
179179
///
180180
/// \sa own_buffer()
181181
///
182-
/// \throw InvalidDatabase
182+
/// \throw InvalidDatabase if an error occurs while attaching the allocator
183183
ref_type attach_buffer(const char* data, size_t size);
184184

185185
void init_in_memory_buffer();

src/realm/error_codes.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,6 @@ typedef enum realm_web_socket_errno {
287287
RLM_ERR_WEBSOCKET_UNAUTHORIZED = 4001,
288288
RLM_ERR_WEBSOCKET_FORBIDDEN = 4002,
289289
RLM_ERR_WEBSOCKET_MOVEDPERMANENTLY = 4003,
290-
RLM_ERR_WEBSOCKET_CLIENT_TOO_OLD = 4004,
291-
RLM_ERR_WEBSOCKET_CLIENT_TOO_NEW = 4005,
292-
RLM_ERR_WEBSOCKET_PROTOCOL_MISMATCH = 4006,
293290

294291
RLM_ERR_WEBSOCKET_RESOLVE_FAILED = 4400,
295292
RLM_ERR_WEBSOCKET_CONNECTION_FAILED = 4401,

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

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,27 @@ SharedApp App::get_app(CacheMode mode, const AppConfig& config) NO_THREAD_SAFETY
210210
std::lock_guard lock(s_apps_mutex);
211211
auto& app = s_apps_cache[config.app_id][base_url_from_app_config(config)];
212212
if (!app) {
213-
app = std::make_shared<App>(Private(), config);
213+
app = App::make_app(config);
214214
}
215215
return app;
216216
}
217217
REALM_ASSERT(mode == CacheMode::Disabled);
218+
return App::make_app(config);
219+
}
220+
221+
SharedApp App::make_app(const AppConfig& config)
222+
{
223+
#ifdef __EMSCRIPTEN__
224+
if (!config.transport) {
225+
// Make a copy and provide a default transport if not provided
226+
AppConfig config_copy = config;
227+
config_copy.transport = std::make_shared<_impl::EmscriptenNetworkTransport>();
228+
return std::make_shared<App>(Private(), config_copy);
229+
}
230+
return std::make_shared<App>(Private(), config);
231+
#else
218232
return std::make_shared<App>(Private(), config);
233+
#endif
219234
}
220235

221236
SharedApp App::get_cached_app(const std::string& app_id, const std::optional<std::string>& base_url)
@@ -257,11 +272,6 @@ App::App(Private, const AppConfig& config)
257272
, m_metadata_store(create_metadata_store(config, *m_file_manager))
258273
, m_sync_manager(SyncManager::create(config.sync_client_config))
259274
{
260-
#ifdef __EMSCRIPTEN__
261-
if (!m_config.transport) {
262-
m_config.transport = std::make_shared<_impl::EmscriptenNetworkTransport>();
263-
}
264-
#endif
265275
REALM_ASSERT(m_config.transport);
266276

267277
// if a base url is provided, then verify the value
@@ -835,8 +845,14 @@ void App::log_in_with_credentials(const AppCredentials& credentials, const std::
835845
return completion(nullptr,
836846
AppError(ErrorCodes::BadToken, "Could not log in user: received malformed JWT"));
837847
}
838-
switch_user(user);
839-
get_profile(user, std::move(completion));
848+
849+
get_profile(user, [this, completion = std::move(completion)](const std::shared_ptr<User>& user,
850+
Optional<AppError> error) {
851+
if (!error) {
852+
switch_user(user);
853+
}
854+
completion(user, error);
855+
});
840856
},
841857
false);
842858
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,8 @@ class App : public std::enable_shared_from_this<App>,
449449
private:
450450
const AppConfig m_config;
451451

452+
static SharedApp make_app(const AppConfig& config);
453+
452454
util::CheckedMutex m_route_mutex;
453455
// The following variables hold the different paths to Atlas, depending on the
454456
// request being performed

src/realm/sync/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ set(SYNC_SOURCES
66
noinst/client_reset.cpp
77
noinst/client_reset_operation.cpp
88
noinst/client_reset_recovery.cpp
9-
noinst/compact_changesets.cpp
109
noinst/migration_store.cpp
1110
noinst/pending_bootstrap_store.cpp
1211
noinst/pending_reset_store.cpp
@@ -74,7 +73,6 @@ set(NOINST_HEADERS
7473
noinst/client_reset.hpp
7574
noinst/client_reset_operation.hpp
7675
noinst/client_reset_recovery.hpp
77-
noinst/compact_changesets.hpp
7876
noinst/integer_codec.hpp
7977
noinst/migration_store.hpp
8078
noinst/pending_bootstrap_store.hpp

0 commit comments

Comments
 (0)