-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump Sync to 3.10.1 #1772
Bump Sync to 3.10.1 #1772
Changes from 24 commits
763a225
8db80aa
4fa91fa
a77a0c0
a4705aa
63dd389
9ba5713
dbfea8f
113a939
002ab0e
bb5bd49
20a4c06
c7929ba
c9f2c05
a09aeb5
4476695
a969fa1
c8f6fda
9530fe1
8dcb2b9
5ad4264
971fd78
c26923e
fde27a6
a78dfac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,26 @@ | ||
vNext (TBD) | ||
------------------ | ||
|
||
The sync protocol version has been bumped to version 25. The server is backwards-compatible with clients using protocol version 24 or below, but clients at version 25 are not backwards-compatible with a server at protocol version 24. The server must be upgraded before any clients are upgraded. | ||
nirinchev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Enhancements | ||
* Download progress is now reported to the server, even when there are no local changes. This allows the server to do history compaction much more aggressively, especially when there are many clients that rarely or never make local changes. ([#1772](https://github.com/realm/realm-dotnet/pull/1772)) | ||
|
||
### Fixed | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm sure the sync upgrade fixes many issues - it might be a bit of work to enumerate those. But at least it should be mentioned that very critical bugs have been fixed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe it's all server-side fixes, do we expect any of these to affect clients? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah there was definitely some fixes that meant that old clients could introduce bugs (was that no-merge invariant)? |
||
* None. | ||
|
||
### Compatibility | ||
* Realm Object Server: 3.11.0 or later. | ||
* APIs are backwards compatible with all previous releases in the 3.x.y series. | ||
* File format: Generates Realms with format v9 (Reads and upgrades all previous formats) | ||
|
||
### Breaking Changes | ||
* The deprecated method `realm.SubscribeToObjectsAsync` has been removed in this version. ([#1772](https://github.com/realm/realm-dotnet/pull/1772)) | ||
|
||
### Internal | ||
* None. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mention the upgrade of sync from X to Y |
||
|
||
|
||
3.3.0 (2018-11-08) | ||
------------------ | ||
|
||
|
@@ -13,9 +36,6 @@ | |
* APIs are backwards compatible with all previous releases in the 3.x.y series. | ||
* File format: Generates Realms with format v9 (Reads and upgrades all previous formats) | ||
|
||
### Internal | ||
* None. | ||
|
||
|
||
3.2.1 (2018-09-27) | ||
------------------ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,21 +58,16 @@ public static extern IntPtr open_with_sync(Configuration configuration, Native.S | |
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
public unsafe delegate void SessionWaitCallback(IntPtr task_completion_source, int error_code, byte* message_buf, IntPtr message_len); | ||
|
||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
public delegate void SubscribeForObjectsCallback(IntPtr results, IntPtr task_completion_source, NativeException ex); | ||
|
||
[DllImport(InteropConfig.DLL_NAME, EntryPoint = "realm_syncmanager_configure_file_system", CallingConvention = CallingConvention.Cdecl)] | ||
public static extern unsafe void configure_file_system([MarshalAs(UnmanagedType.LPWStr)] string base_path, IntPtr base_path_leth, | ||
UserPersistenceMode* userPersistence, byte[] encryptionKey, | ||
[MarshalAs(UnmanagedType.I1)] bool resetMetadataOnError, | ||
out NativeException exception); | ||
[DllImport(InteropConfig.DLL_NAME, EntryPoint = "realm_syncmanager_configure", CallingConvention = CallingConvention.Cdecl)] | ||
public static extern unsafe void configure([MarshalAs(UnmanagedType.LPWStr)] string base_path, IntPtr base_path_length, | ||
[MarshalAs(UnmanagedType.LPWStr)] string user_agent, IntPtr user_agent_length, | ||
UserPersistenceMode* userPersistence, byte[] encryptionKey, | ||
[MarshalAs(UnmanagedType.I1)] bool resetMetadataOnError, | ||
out NativeException exception); | ||
|
||
[DllImport(InteropConfig.DLL_NAME, EntryPoint = "realm_install_syncsession_callbacks", CallingConvention = CallingConvention.Cdecl)] | ||
public static extern unsafe void install_syncsession_callbacks(RefreshAccessTokenCallbackDelegate refresh_callback, SessionErrorCallback error_callback, SessionProgressCallback progress_callback, SessionWaitCallback wait_callback); | ||
|
||
[DllImport(InteropConfig.DLL_NAME, EntryPoint = "realm_syncmanager_install_callbacks", CallingConvention = CallingConvention.Cdecl)] | ||
public static extern void install_callbacks(SubscribeForObjectsCallback subscribe_callback); | ||
|
||
[DllImport(InteropConfig.DLL_NAME, EntryPoint = "realm_syncmanager_get_path_for_realm", CallingConvention = CallingConvention.Cdecl)] | ||
public static extern IntPtr get_path_for_realm(SyncUserHandle user, [MarshalAs(UnmanagedType.LPWStr)] string url, IntPtr url_len, IntPtr buffer, IntPtr bufsize, out NativeException ex); | ||
|
||
|
@@ -90,12 +85,6 @@ public static extern unsafe void configure_file_system([MarshalAs(UnmanagedType. | |
[DllImport(InteropConfig.DLL_NAME, EntryPoint = "realm_syncmanager_get_session", CallingConvention = CallingConvention.Cdecl)] | ||
public static extern IntPtr get_session([MarshalAs(UnmanagedType.LPWStr)] string path, IntPtr path_len, Native.SyncConfiguration configuration, byte[] encryptionKey, out NativeException ex); | ||
|
||
[DllImport(InteropConfig.DLL_NAME, EntryPoint = "realm_syncmanager_subscribe_for_objects", CallingConvention = CallingConvention.Cdecl)] | ||
public static extern IntPtr subscribe_for_objects(SharedRealmHandle handle, | ||
[MarshalAs(UnmanagedType.LPWStr)] string class_name, IntPtr class_name_len, | ||
[MarshalAs(UnmanagedType.LPWStr)] string query, IntPtr query_len, | ||
IntPtr task_completion_source, out NativeException ex); | ||
|
||
[DllImport(InteropConfig.DLL_NAME, EntryPoint = "realm_syncmanager_set_log_level", CallingConvention = CallingConvention.Cdecl)] | ||
public static extern unsafe void set_log_level(LogLevel* level, out NativeException exception); | ||
|
||
|
@@ -132,12 +121,6 @@ static unsafe SharedRealmHandleExtensions() | |
GCHandle.Alloc(wait); | ||
|
||
NativeMethods.install_syncsession_callbacks(refresh, error, progress, wait); | ||
|
||
NativeMethods.SubscribeForObjectsCallback subscribe = HandleSubscribeForObjectsCallback; | ||
|
||
GCHandle.Alloc(subscribe); | ||
|
||
NativeMethods.install_callbacks(subscribe); | ||
} | ||
|
||
public static SharedRealmHandle OpenWithSync(Configuration configuration, Native.SyncConfiguration syncConfiguration, RealmSchema schema, byte[] encryptionKey) | ||
|
@@ -192,7 +175,12 @@ public static unsafe void ConfigureFileSystem(UserPersistenceMode? userPersisten | |
modePtr = &mode; | ||
} | ||
|
||
NativeMethods.configure_file_system(basePath, (IntPtr)basePath.Length, modePtr, encryptionKey, resetMetadataOnError, out var ex); | ||
// TODO: provide proper user agent. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to point to an actual issue here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have a follow up PR that fixes it. |
||
var userAgent = ".NET"; | ||
NativeMethods.configure( | ||
basePath, (IntPtr)basePath.Length, | ||
userAgent, (IntPtr)userAgent.Length, | ||
modePtr, encryptionKey, resetMetadataOnError, out var ex); | ||
ex.ThrowIfNecessary(); | ||
} | ||
|
||
|
@@ -246,14 +234,6 @@ public static SessionHandle GetSession(string path, Native.SyncConfiguration con | |
return new SessionHandle(result); | ||
} | ||
|
||
public static void SubscribeForObjects(SharedRealmHandle handle, Type objectType, string query, TaskCompletionSource<ResultsHandle> tcs) | ||
{ | ||
var tcsPtr = GCHandle.ToIntPtr(GCHandle.Alloc(tcs)); | ||
var objectName = objectType.GetTypeInfo().GetMappedOrOriginalName(); | ||
NativeMethods.subscribe_for_objects(handle, objectName, (IntPtr)objectName.Length, query, (IntPtr)query.Length, tcsPtr, out var ex); | ||
ex.ThrowIfNecessary(); | ||
} | ||
|
||
public static RealmPrivileges GetPrivileges(this SharedRealmHandle handle) | ||
{ | ||
var result = NativeMethods.get_realm_privileges(handle, out var ex); | ||
|
@@ -348,29 +328,5 @@ private static unsafe void HandleSessionWaitCallback(IntPtr taskCompletionSource | |
handle.Free(); | ||
} | ||
} | ||
|
||
[NativeCallback(typeof(NativeMethods.SubscribeForObjectsCallback))] | ||
private static void HandleSubscribeForObjectsCallback(IntPtr results, IntPtr taskCompletionSource, NativeException ex) | ||
{ | ||
var handle = GCHandle.FromIntPtr(taskCompletionSource); | ||
var tcs = (TaskCompletionSource<ResultsHandle>)handle.Target; | ||
|
||
try | ||
{ | ||
if (ex.type == RealmExceptionCodes.NoError) | ||
{ | ||
var resultsHandle = new ResultsHandle(null, results); | ||
tcs.TrySetResult(resultsHandle); | ||
} | ||
else | ||
{ | ||
tcs.TrySetException(ex.Convert()); | ||
} | ||
} | ||
finally | ||
{ | ||
handle.Free(); | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
REALM_CORE_VERSION=5.8.0 | ||
REALM_SYNC_VERSION=3.9.2 | ||
REALM_CORE_VERSION=5.12.7 | ||
REALM_SYNC_VERSION=3.14.11 | ||
ANDROID_OPENSSL_VERSION=1.0.2k |
+1 −0 | CMake/CompilerFlags.cmake | |
+5 −0 | README.md | |
+2 −2 | dependencies.list | |
+1 −0 | src/collection_notifications.hpp | |
+17 −13 | src/impl/object_accessor_impl.hpp | |
+71 −8 | src/list.hpp | |
+4 −0 | src/object.cpp | |
+15 −4 | src/object.hpp | |
+54 −33 | src/object_accessor.hpp | |
+4 −11 | src/object_store.cpp | |
+8 −4 | src/results.cpp | |
+40 −0 | src/results.hpp | |
+10 −0 | src/shared_realm.cpp | |
+2 −0 | src/shared_realm.hpp | |
+4 −3 | src/sync/impl/sync_client.hpp | |
+89 −140 | src/sync/partial_sync.cpp | |
+30 −8 | src/sync/partial_sync.hpp | |
+9 −1 | src/sync/sync_config.cpp | |
+13 −2 | src/sync/sync_manager.cpp | |
+16 −1 | src/sync/sync_manager.hpp | |
+217 −5 | tests/object.cpp | |
+238 −4 | tests/results.cpp | |
+1 −1 | tests/sync/file.cpp | |
+72 −2 | tests/sync/partial_sync.cpp | |
+2 −1 | tests/sync/permission.cpp | |
+1 −1 | tests/sync/session/connection_change_notifications.cpp | |
+8 −8 | tests/sync/session/session.cpp | |
+2 −2 | tests/sync/session/wait_for_completion.cpp | |
+22 −20 | tests/sync/sync_manager.cpp | |
+5 −5 | tests/sync/user.cpp | |
+2 −1 | tests/util/test_file.cpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't refer to the sync protocol version - it's not a known number. What users know is the ROS version.
You could take inspiration for the text for e.g. realm-js:
You will need to upgrade your Realm Object Server to at least version 3.11.0 or use Realm Cloud. If you try to connect to a ROS v3.10.x or previous, you will see an error like
Wrong protocol version in Sync HTTP request, client protocol version = 25, server protocol version = 24
.