Skip to content

Commit

Permalink
Upgrade to Core 13.23.4 (#1427)
Browse files Browse the repository at this point in the history
  • Loading branch information
nirinchev authored Nov 15, 2023
1 parent b6eb23b commit b5f5415
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
* Receiving a `write_not_allowed` error from the server would have led to a crash. (Core 13.22.0)
* Fix interprocess locking for concurrent realm file access resulting in a interprocess deadlock on FAT32/exFAT filesystems. (Core 13.23.0)
* Fixed RealmObject not overriding `hashCode`, which would lead to sets of RealmObjects potentially containing duplicates. ([#1418](https://github.com/realm/realm-dart/issues/1418))
* `realm.subscriptions.waitForSynchronization` will now correctly receive an error if a fatal session error occurs that would prevent it from ever completing. Previously the future would never resolve. (Core 13.23.3)
* Fixed FLX subscriptions not being sent to the server if the session was interrupted during bootstrapping. (Core 13.23.3)
* Fixed application crash with 'KeyNotFound' exception when subscriptions are marked complete after a client reset. (Core 13.23.3)
* A crash at a very specific time during a DiscardLocal client reset on a FLX Realm could leave subscriptions in an invalid state. (Core 13.23.4)

### Compatibility
* Realm Studio: 13.0.0 or later.
Expand Down
14 changes: 10 additions & 4 deletions lib/src/native/realm_bindings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8044,7 +8044,7 @@ class RealmLibrary {
/// be called each time the notify callback passed to the scheduler
/// is invoked.
void realm_scheduler_perform_work(
ffi.Pointer<realm_scheduler_t> arg0,
ffi.Pointer<realm_work_queue_t> arg0,
) {
return _realm_scheduler_perform_work(
arg0,
Expand All @@ -8053,10 +8053,10 @@ class RealmLibrary {

late final _realm_scheduler_perform_workPtr = _lookup<
ffi
.NativeFunction<ffi.Void Function(ffi.Pointer<realm_scheduler_t>)>>(
.NativeFunction<ffi.Void Function(ffi.Pointer<realm_work_queue_t>)>>(
'realm_scheduler_perform_work');
late final _realm_scheduler_perform_work = _realm_scheduler_perform_workPtr
.asFunction<void Function(ffi.Pointer<realm_scheduler_t>)>();
.asFunction<void Function(ffi.Pointer<realm_work_queue_t>)>();

/// For platforms with no default scheduler implementation, register a factory
/// function which can produce custom schedulers. If there is a platform-specific
Expand Down Expand Up @@ -11943,7 +11943,9 @@ typedef realm_scheduler_is_same_as_func_t = ffi.Pointer<
ffi.Bool Function(ffi.Pointer<ffi.Void> scheduler_userdata_1,
ffi.Pointer<ffi.Void> scheduler_userdata_2)>>;
typedef realm_scheduler_notify_func_t = ffi.Pointer<
ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void> userdata)>>;
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<ffi.Void> userdata,
ffi.Pointer<realm_work_queue_t> work_queue)>>;
typedef realm_scheduler_t = realm_scheduler;

final class realm_schema extends ffi.Opaque {}
Expand Down Expand Up @@ -12373,4 +12375,8 @@ final class realm_websocket_observer extends ffi.Opaque {}

typedef realm_websocket_observer_t = realm_websocket_observer;

final class realm_work_queue extends ffi.Opaque {}

typedef realm_work_queue_t = realm_work_queue;

final class shared_realm extends ffi.Opaque {}
5 changes: 3 additions & 2 deletions lib/src/native/realm_core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,9 @@ class _RealmCore {
return SchedulerHandle._(schedulerPtr);
}

void invokeScheduler(SchedulerHandle schedulerHandle) {
_realmLib.realm_scheduler_perform_work(schedulerHandle._pointer);
void invokeScheduler(int workQueue) {
final queuePointer = Pointer<realm_work_queue>.fromAddress(workQueue);
_realmLib.realm_scheduler_perform_work(queuePointer);
}

RealmHandle openRealm(Configuration config) {
Expand Down
4 changes: 3 additions & 1 deletion lib/src/scheduler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ class Scheduler {
final level = message[0] as int;
final text = message[1] as String;
Realm.logger.log(LevelExt.fromInt(level), text);
} else if (message is int) {
realmCore.invokeScheduler(message);
} else {
realmCore.invokeScheduler(handle);
Realm.logger.log(RealmLogLevel.error, 'Unexpected Scheduler message type: ${message.runtimeType} - $message');
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/realm-core
Submodule realm-core updated 96 files
+2 −1 .github/pull_request_template.md
+4 −0 .gitignore
+35 −4 CHANGELOG.md
+34 −1 CMakeLists.txt
+54 −0 Jenkinsfile
+1 −1 Package.swift
+2 −0 alpine.Dockerfile
+1 −0 bindgen/spec.yml
+2 −2 dependencies.list
+295 −0 doc/development/how-to-use-remote-baas-host.md
+181 −23 evergreen/config.yml
+0 −16 evergreen/config_overrides.json
+237 −0 evergreen/configure_baas_proxy.sh
+304 −214 evergreen/install_baas.sh
+4 −0 evergreen/proxy-network-faults.toxics
+5 −0 evergreen/proxy-nonideal-transfer.toxics
+160 −30 evergreen/setup_baas_host.sh
+149 −55 evergreen/setup_baas_host_local.sh
+263 −0 evergreen/setup_baas_proxy.sh
+21 −11 evergreen/wait_for_baas.sh
+3 −2 src/realm.h
+4 −0 src/realm/CMakeLists.txt
+33 −1 src/realm/array.cpp
+2 −0 src/realm/array.hpp
+1 −1 src/realm/array_integer.cpp
+7 −9 src/realm/array_integer.hpp
+18 −23 src/realm/array_integer_tpl.hpp
+7 −7 src/realm/array_with_find.cpp
+121 −211 src/realm/array_with_find.hpp
+1 −0 src/realm/cluster.cpp
+21 −1 src/realm/collection.hpp
+1 −3 src/realm/list.hpp
+6 −6 src/realm/object-store/c_api/scheduler.cpp
+10 −30 src/realm/object-store/set.cpp
+19 −14 src/realm/object-store/sync/sync_session.cpp
+3 −4 src/realm/object-store/sync/sync_session.hpp
+35 −1 src/realm/query_conditions_tpl.hpp
+3 −11 src/realm/query_engine.cpp
+1 −22 src/realm/query_engine.hpp
+17 −1 src/realm/query_state.hpp
+297 −93 src/realm/set.cpp
+100 −384 src/realm/set.hpp
+34 −18 src/realm/sync/client.cpp
+19 −7 src/realm/sync/noinst/client_history_impl.cpp
+3 −13 src/realm/sync/noinst/client_history_impl.hpp
+93 −116 src/realm/sync/noinst/client_impl_base.cpp
+31 −48 src/realm/sync/noinst/client_impl_base.hpp
+95 −91 src/realm/sync/noinst/client_reset.cpp
+5 −5 src/realm/sync/noinst/client_reset.hpp
+41 −83 src/realm/sync/noinst/client_reset_operation.cpp
+12 −50 src/realm/sync/noinst/client_reset_operation.hpp
+1 −1 src/realm/sync/noinst/pending_bootstrap_store.cpp
+2 −2 src/realm/sync/noinst/pending_bootstrap_store.hpp
+2 −2 src/realm/sync/noinst/protocol_codec.hpp
+0 −34 src/realm/sync/noinst/server/server.cpp
+2 −15 src/realm/sync/noinst/server/server_history.cpp
+1 −11 src/realm/sync/noinst/server/server_history.hpp
+96 −89 src/realm/sync/subscriptions.cpp
+37 −28 src/realm/sync/subscriptions.hpp
+2 −2 src/realm/sync/tools/apply_to_state_command.cpp
+118 −237 src/realm/sync/transform.cpp
+20 −65 src/realm/sync/transform.hpp
+2 −3 src/realm/table.cpp
+12 −2 src/realm/util/backtrace.cpp
+7 −2 src/realm/util/config.h.in
+4 −4 src/realm/util/file.cpp
+16 −6 src/realm/util/thread.cpp
+106 −0 test/benchmark-common-tasks/main.cpp
+5 −5 test/large_tests/test_column_large.cpp
+16 −0 test/object-store/CMakeLists.txt
+2 −2 test/object-store/audit.cpp
+975 −825 test/object-store/c_api/c_api.cpp
+12 −0 test/object-store/main.cpp
+4 −0 test/object-store/set.cpp
+22 −28 test/object-store/sync/app.cpp
+18 −20 test/object-store/sync/client_reset.cpp
+24 −31 test/object-store/sync/flx_migration.cpp
+191 −59 test/object-store/sync/flx_sync.cpp
+1 −1 test/object-store/sync/session/wait_for_completion.cpp
+98 −68 test/object-store/util/sync/baas_admin_api.cpp
+21 −12 test/object-store/util/sync/baas_admin_api.hpp
+1 −1 test/object-store/util/sync/flx_sync_harness.hpp
+59 −17 test/object-store/util/sync/sync_test_utils.cpp
+10 −5 test/object-store/util/sync/sync_test_utils.hpp
+4 −3 test/object-store/util/test_file.cpp
+3 −0 test/object-store/util/test_file.hpp
+45 −54 test/peer.hpp
+387 −6 test/test_client_reset.cpp
+7 −2 test/test_file.cpp
+4 −1 test/test_set.cpp
+5 −20 test/test_sync.cpp
+2 −2 test/test_sync_pending_bootstraps.cpp
+3 −3 test/test_sync_subscriptions.cpp
+5 −0 test/test_util_error.cpp
+3 −0 test/test_util_file.cpp
+9 −0 test/util/test_path.hpp
11 changes: 5 additions & 6 deletions src/realm_dart_scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ struct SchedulerData {
void* callback_userData = nullptr;
realm_free_userdata_func_t free_userData_func = nullptr;

SchedulerData(uint64_t isolate, Dart_Port dartPort) : port(dartPort), threadId(std::this_thread::get_id()), isolateId(isolate)
SchedulerData(uint64_t isolate, Dart_Port dartPort)
: port(dartPort), threadId(std::this_thread::get_id()), isolateId(isolate)
{}
};

Expand All @@ -46,9 +47,9 @@ void realm_dart_scheduler_free_userData(void* userData) {
}

//This can be invoked on any thread.
void realm_dart_scheduler_notify(void* userData) {
void realm_dart_scheduler_notify(void* userData, realm_work_queue_t* work_queue) {
auto& schedulerData = *static_cast<SchedulerData*>(userData);
std::uintptr_t pointer = reinterpret_cast<std::uintptr_t>(userData);
std::uintptr_t pointer = reinterpret_cast<std::uintptr_t>(work_queue);
Dart_PostInteger_DL(schedulerData.port, pointer);
}

Expand Down Expand Up @@ -84,14 +85,12 @@ bool realm_dart_scheduler_can_deliver_notifications(void* userData) {
RLM_API realm_scheduler_t* realm_dart_create_scheduler(uint64_t isolateId, Dart_Port port) {
SchedulerData* schedulerData = new SchedulerData(isolateId, port);

realm_scheduler_t* realm_scheduler = realm_scheduler_new(schedulerData,
return realm_scheduler_new(schedulerData,
realm_dart_scheduler_free_userData,
realm_dart_scheduler_notify,
realm_dart_scheduler_is_on_thread,
realm_dart_scheduler_is_same_as,
realm_dart_scheduler_can_deliver_notifications);

return realm_scheduler;
}

//Used for debugging
Expand Down

0 comments on commit b5f5415

Please sign in to comment.