Skip to content

Commit

Permalink
Merge branch 'master' of github.com:realm/realm-core into next-major
Browse files Browse the repository at this point in the history
  • Loading branch information
nicola-cab committed Aug 1, 2024
2 parents b1c3664 + b10122e commit 6c1d0d7
Show file tree
Hide file tree
Showing 58 changed files with 1,595 additions and 1,752 deletions.
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,49 @@

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

# 14.11.2 Release notes

### Enhancements
* 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]).

### Fixed
* Sync client may report duplicate compensating write errors ([#7708](https://github.com/realm/realm-core/issues/7708), since v14.8.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 emscripten build and add emscripten debug/release compile tasks to evergreen. ([PR #7916](https://github.com/realm/realm-core/pull/7916))
* Subscription set state change notifications now work in a multiprocess-compatible manner ([PR #7862](https://github.com/realm/realm-core/pull/7862)).

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

# 14.11.1 Release notes

### Enhancements
* None.

### Fixed
* 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)

### Breaking changes
* 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)

### 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
* None.

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

# 14.11.0 Release notes

### Enhancements
Expand Down
3 changes: 1 addition & 2 deletions 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.11.0"
let versionStr = "14.11.2"
let versionPieces = versionStr.split(separator: "-")
let versionCompontents = versionPieces[0].split(separator: ".")
let versionExtra = versionPieces.count > 1 ? versionPieces[1] : ""
Expand Down Expand Up @@ -122,7 +122,6 @@ let notSyncServerSources: [String] = [
"realm/sync/noinst/client_reset.cpp",
"realm/sync/noinst/client_reset_operation.cpp",
"realm/sync/noinst/client_reset_recovery.cpp",
"realm/sync/noinst/compact_changesets.cpp",
"realm/sync/noinst/migration_store.cpp",
"realm/sync/noinst/pending_bootstrap_store.cpp",
"realm/sync/noinst/pending_reset_store.cpp",
Expand Down
2 changes: 1 addition & 1 deletion dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PACKAGE_NAME: realm-core
VERSION: 14.11.0
VERSION: 14.11.2
OPENSSL_VERSION: 3.2.0
ZLIB_VERSION: 1.2.13
# https://github.com/10gen/baas/commits
Expand Down
124 changes: 124 additions & 0 deletions evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,48 @@ functions:
-j ${max_jobs|$(grep -c proc /proc/cpuinfo)} \
$target
"compile emscripten":
- command: shell.exec
params:
working_dir: realm-core
shell: bash
script: |-
set -o errexit
set -o pipefail
set -o verbose
if [ -n "${cmake_bindir|}" ]; then
export CMAKE="$(./evergreen/abspath.sh "${cmake_bindir}/cmake")"
else
export CMAKE="cmake"
fi
# Check out the Emscripten SDK and activate the specified version
echo "Activating emscripten SDK version: ${emsdk_version|latest}"
git clone https://github.com/emscripten-core/emsdk.git
pushd emsdk/ > /dev/null # realm-core/emsdk
./emsdk install ${emsdk_version|latest}
./emsdk activate ${emsdk_version|latest}
source ./emsdk_env.sh
popd > /dev/null # realm-core
if [[ "$(uname -s)" =~ Darwin* ]]; then
NPROC="$(sysctl -n hw.ncpu)"
else
NPROC="$(nproc)"
fi
mkdir -p build-emscripten
pushd build-emscripten > /dev/null # realm-core/build-emscripten
# shellcheck disable=SC2086,SC2090
emcmake $CMAKE -D CMAKE_BUILD_TYPE="${cmake_build_type|Debug}" \
..
make "-j$NPROC" 2>&1
popd > /dev/null # realm-core
"run benchmark":
- command: shell.exec
params:
Expand Down Expand Up @@ -328,6 +370,10 @@ functions:
export TSAN_OPTIONS="suppressions=$(pwd)/test/tsan.suppress history_size=4 $TSAN_OPTIONS"
export UBSAN_OPTIONS="print_stacktrace=1"
if [[ -n "${enable_baas_redirector}" ]]; then
export ENABLE_BAAS_REDIRECTOR=On
fi
cd build
if ! "$CTEST" -C ${cmake_build_type|Debug} $TEST_FLAGS; then
BAAS_PID=$(pgrep baas_server)
Expand Down Expand Up @@ -753,6 +799,12 @@ tasks:
commands:
- func: "compile"

- name: compile-emscripten
exec_timeout_secs: 1800
tags: [ "for_pull_requests" ]
commands:
- func: "compile emscripten"

- name: package
exec_timeout_secs: 1800
commands:
Expand Down Expand Up @@ -1271,6 +1323,20 @@ task_groups:
- compile
- ".test_suite !.requires_baas"

# Runs only the baas integration tests
- name: only_baas_integration_tests
max_hosts: 1
setup_group_can_fail_task: true
setup_group:
- func: "fetch source"
- func: "fetch binaries"
teardown_task:
- func: "upload test results"
timeout:
- func: "run hang analyzer"
tasks:
- ".requires_baas"

# Runs object-store-tests against baas running on remote host
- name: compile_test
max_hosts: 1
Expand All @@ -1287,6 +1353,15 @@ task_groups:
- compile
- .test_suite

- name: compile_emscripten
max_hosts: 1
setup_group_can_fail_task: true
setup_group:
- func: "fetch source"
- func: "fetch binaries"
tasks:
- compile-emscripten

# Runs object-store-tests against baas running on remote host and runs
# the network simulation tests as a separate task for nightly builds
- name: network_tests
Expand Down Expand Up @@ -1426,6 +1501,17 @@ buildvariants:
tasks:
- name: compile_test

- name: ubuntu-with-redirects
display_name: "Ubuntu (Baas Redirector Enabled)"
run_on: ubuntu2204-arm64-large
expansions:
fetch_missing_dependencies: On
c_compiler: "/opt/clang+llvm/bin/clang"
cxx_compiler: "/opt/clang+llvm/bin/clang++"
enable_baas_redirector: On
tasks:
- name: only_baas_integration_tests

- name: ubuntu-no-geospatial
display_name: "Ubuntu (Geospatial Disabled)"
run_on: ubuntu2204-arm64-large
Expand Down Expand Up @@ -1627,6 +1713,27 @@ buildvariants:
tasks:
- name: fuzzer-tests

- name: ubuntu-emscripten
display_name: "Ubuntu (Emscripten x86_64)"
run_on: ubuntu2204-large
expansions:
cmake_url: "https://s3.amazonaws.com/static.realm.io/evergreen-assets/cmake-3.26.3-linux-x86_64.tar.gz"
cmake_bindir: "./cmake_binaries/bin"
emsdk_version: "3.1.37"
tasks:
- name: compile_emscripten

- name: ubuntu-emscripten-release
display_name: "Ubuntu (Emscripten x86_64 Release build)"
run_on: ubuntu2204-large
expansions:
cmake_url: "https://s3.amazonaws.com/static.realm.io/evergreen-assets/cmake-3.26.3-linux-x86_64.tar.gz"
cmake_bindir: "./cmake_binaries/bin"
cmake_build_type: RelWithDebInfo
emsdk_version: "3.1.37"
tasks:
- name: compile_emscripten

# disable these builders since there are constantly failing and not yet ready for nightly builds
# - name: ubuntu2004-network-nonideal
# display_name: "Ubuntu 20.04 x86_64 (Utunbu2004 - nonideal transfer)"
Expand Down Expand Up @@ -1858,6 +1965,7 @@ buildvariants:
cxx_compiler: "./clang_binaries/bin/clang++"
enable_llvm_coverage: On
coveralls_flag_name: "ubuntu-x86_64"
enable_baas_redirector: On
grcov_url: "https://s3.amazonaws.com/static.realm.io/evergreen-assets/grcov-x86_64-unknown-linux-gnu.tar.bz2"
tasks:
- name: compile_test_coverage
Expand Down Expand Up @@ -1976,6 +2084,22 @@ buildvariants:
cmake_bindir: "/cygdrive/c/Program Files/CMake/bin/"
cmake_generator: "Visual Studio 16 2019"
cmake_generator_platform: "Win32"
cmake_build_type: "Release"
extra_flags: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0
max_jobs: $(($(grep -c proc /proc/cpuinfo) / 2))
fetch_missing_dependencies: On
python3: "/cygdrive/c/python/python37/python.exe"
no_tests: On
tasks:
- name: compile_only

- name: windows-x64-uwp
display_name: "Windows X64 (UWP)"
run_on: windows-vsCurrent-large
expansions:
cmake_bindir: "/cygdrive/c/Program Files/CMake/bin/"
cmake_generator: "Visual Studio 16 2019"
extra_flags: "-A x64"
cmake_build_type: "Debug"
extra_flags: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0
max_jobs: $(($(grep -c proc /proc/cpuinfo) / 2))
Expand Down
6 changes: 3 additions & 3 deletions src/realm/alloc_slab.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ class SlabAlloc : public Allocator {
/// This can happen if the conflicting thread (or process) terminates or
/// crashes before the next retry.
///
/// \throw FileAccessError
/// \throw SlabAlloc::Retry
/// \throw FileAccessError if unable to access the file
/// \throw SlabAlloc::Retry if the request cannot be completed right now
ref_type attach_file(const std::string& file_path, Config& cfg, util::WriteObserver* write_observer = nullptr);

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

void init_in_memory_buffer();
Expand Down
3 changes: 0 additions & 3 deletions src/realm/error_codes.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,6 @@ typedef enum realm_web_socket_errno {
RLM_ERR_WEBSOCKET_UNAUTHORIZED = 4001,
RLM_ERR_WEBSOCKET_FORBIDDEN = 4002,
RLM_ERR_WEBSOCKET_MOVEDPERMANENTLY = 4003,
RLM_ERR_WEBSOCKET_CLIENT_TOO_OLD = 4004,
RLM_ERR_WEBSOCKET_CLIENT_TOO_NEW = 4005,
RLM_ERR_WEBSOCKET_PROTOCOL_MISMATCH = 4006,

RLM_ERR_WEBSOCKET_RESOLVE_FAILED = 4400,
RLM_ERR_WEBSOCKET_CONNECTION_FAILED = 4401,
Expand Down
32 changes: 24 additions & 8 deletions src/realm/object-store/sync/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,27 @@ SharedApp App::get_app(CacheMode mode, const AppConfig& config) NO_THREAD_SAFETY
std::lock_guard lock(s_apps_mutex);
auto& app = s_apps_cache[config.app_id][base_url_from_app_config(config)];
if (!app) {
app = std::make_shared<App>(Private(), config);
app = App::make_app(config);
}
return app;
}
REALM_ASSERT(mode == CacheMode::Disabled);
return App::make_app(config);
}

SharedApp App::make_app(const AppConfig& config)
{
#ifdef __EMSCRIPTEN__
if (!config.transport) {
// Make a copy and provide a default transport if not provided
AppConfig config_copy = config;
config_copy.transport = std::make_shared<_impl::EmscriptenNetworkTransport>();
return std::make_shared<App>(Private(), config_copy);
}
return std::make_shared<App>(Private(), config);
#else
return std::make_shared<App>(Private(), config);
#endif
}

SharedApp App::get_cached_app(const std::string& app_id, const std::optional<std::string>& base_url)
Expand Down Expand Up @@ -257,11 +272,6 @@ App::App(Private, const AppConfig& config)
, m_metadata_store(create_metadata_store(config, *m_file_manager))
, m_sync_manager(SyncManager::create(config.sync_client_config))
{
#ifdef __EMSCRIPTEN__
if (!m_config.transport) {
m_config.transport = std::make_shared<_impl::EmscriptenNetworkTransport>();
}
#endif
REALM_ASSERT(m_config.transport);

// if a base url is provided, then verify the value
Expand Down Expand Up @@ -835,8 +845,14 @@ void App::log_in_with_credentials(const AppCredentials& credentials, const std::
return completion(nullptr,
AppError(ErrorCodes::BadToken, "Could not log in user: received malformed JWT"));
}
switch_user(user);
get_profile(user, std::move(completion));

get_profile(user, [this, completion = std::move(completion)](const std::shared_ptr<User>& user,
Optional<AppError> error) {
if (!error) {
switch_user(user);
}
completion(user, error);
});
},
false);
}
Expand Down
2 changes: 2 additions & 0 deletions src/realm/object-store/sync/app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,8 @@ class App : public std::enable_shared_from_this<App>,
private:
const AppConfig m_config;

static SharedApp make_app(const AppConfig& config);

util::CheckedMutex m_route_mutex;
// The following variables hold the different paths to Atlas, depending on the
// request being performed
Expand Down
2 changes: 0 additions & 2 deletions src/realm/sync/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ set(SYNC_SOURCES
noinst/client_reset.cpp
noinst/client_reset_operation.cpp
noinst/client_reset_recovery.cpp
noinst/compact_changesets.cpp
noinst/migration_store.cpp
noinst/pending_bootstrap_store.cpp
noinst/pending_reset_store.cpp
Expand Down Expand Up @@ -74,7 +73,6 @@ set(NOINST_HEADERS
noinst/client_reset.hpp
noinst/client_reset_operation.hpp
noinst/client_reset_recovery.hpp
noinst/compact_changesets.hpp
noinst/integer_codec.hpp
noinst/migration_store.hpp
noinst/pending_bootstrap_store.hpp
Expand Down
Loading

0 comments on commit 6c1d0d7

Please sign in to comment.