-
Notifications
You must be signed in to change notification settings - Fork 165
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
RCORE-2236 Add support for relaxed schema in bind message #7981
RCORE-2236 Add support for relaxed schema in bind message #7981
Conversation
Pull Request Test Coverage Report for Build michael.wilkersonbarker_1334Details
💛 - Coveralls |
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.
Nothing blocking, just had a few small comments
src/realm/sync/protocol.cpp
Outdated
return "Client attempted to change their relaxed schema mode for an existing client file - " | ||
"requires client reset"; | ||
case ProtocolError::relaxed_schema_not_suppored: | ||
return "Client using a relax schema attempted to connect to an app that does not support " |
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.
[nit]
return "Client using a relax schema attempted to connect to an app that does not support " | |
return "Client using relaxed schema mode attempted to connect to an app that does not support " |
src/realm/sync/protocol.hpp
Outdated
// 15 Support for relaxed (flexible) schemas | ||
// |
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 don't have a problem with doing this early, but worth noting that the server does not yet know about this protocol version (and shouldn't need to for this piece of relaxed schema)
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.
Should we delay the protocol bump until later? I believe the server will just negotiate to v14 and there is nothing in the sync client or relaxed schema implementation that cares whether it's 14 or 15.
(Also this is merging to a feature branch, so it will be a while before it hits master
)
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 think generally we wait until the project is more or less complete incase some other feature needs to take the earlier protocol version, but I don't feel strongly about waiting since this is a feature branch. Worst case you'll need to increment it by 1 at a later point
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.
Reverted protocol change
// Send 0 if sync client is not using a relaxed schema | ||
bind_json_data["relaxedSchema"] = get_db()->flexible_schema_allowed() ? 1 : 0; |
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.
Thoughts on adding a test that tries to get back one of the new error codes from the server to make sure the server is properly decoding this into a bool (rather than just always defaulting to false or something)?
I don't think this should be an issue, but seems like it would be valuable to at the very least do a manual check
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.
Added a test to validate the "app doesn't support relaxed schema" case - turns out the server doesn't support an int for this value, so it was changed to a bool value.
I recommend updating this to be an int value in case we want to expand the meaning of this value in the future.
… into mwb/add-relaxed-schema-bind-flag
What, How & Why?
Adds support for the two new relaxed schema protocol error codes (
ErrorClientFileRelaxedSchemaModeChanged
(240) andErrorAppDoesNotSupportRelaxedSchema
(241)) and adds therelaxedSchema
value to the BIND message JSON data with a value of 1 if the realm file is using a relaxed schema or 0 if it is not.This PR also bumps the sync protocol version to v15, since there is a protocol bump associated with enabling the relaxed schema feature.
Fixes #7974
☑️ ToDos
[ ] C-API, if public C++ API changed[ ]bindgen/spec.yml
, if public C++ API changed