-
Notifications
You must be signed in to change notification settings - Fork 168
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
Workaround issue when initiating sync on a copied realm file #4878
Conversation
d5fc377
to
32963a5
Compare
The problem is that the server does not know that the client has already integrated some server versions, and therefore it sends down 0 as progress/upload/last_integrated_server_version. On the client this number may be bigger and in this case that number will not be overwritten with 0. There may still be issues on the server, however.
32963a5
to
1ca0865
Compare
If the IDENT message indicates that the newly created client has already integraded some server changesets, adjust the upload threshold accordingly- If the threshold is ahead of the upload cursor stored in the history, use the threshold values.
@@ -829,8 +831,10 @@ void ClientHistoryImpl::update_sync_progress(const SyncProgress& progress, | |||
RefOrTagged::make_tagged(progress.latest_server_version.salt)); // Throws | |||
root.set(s_progress_upload_client_version_iip, | |||
RefOrTagged::make_tagged(progress.upload.client_version)); // Throws | |||
root.set(s_progress_upload_server_version_iip, | |||
RefOrTagged::make_tagged(progress.upload.last_integrated_server_version)); // Throws | |||
if (progress.upload.last_integrated_server_version > 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.
If the current version of s_progres_upload_server_version_iip is zero, would this be a noop without this conditional?
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 am not sure I understand the question. If current value is zero and progress value is zero then it is obviously a noop. The test just makes sure that we will not overwrite a non-zero value with a zero.
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 you are answering my question without understanding it 😄 . We were changing this from unconditionally setting a value to conditionally setting a value, and I wanted to verify the preconditions. Can you add a comment about why we're conditionally setting this here?
test/object-store/sync/app.cpp
Outdated
@@ -1776,6 +1777,126 @@ TEST_CASE("app: set new embedded object", "[sync][app]") { | |||
} | |||
} | |||
|
|||
TEST_CASE("app: make distributable client file", "[sync][app]") { | |||
std::unique_ptr<GenericNetworkTransport> (*factory)() = [] { |
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.
You can replace lines 1781-1798 with a call to get_integration_config()
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.
👍
test/object-store/sync/app.cpp
Outdated
realm_config.sync_config = std::make_shared<realm::SyncConfig>(app->current_user(), bson::Bson("foo")); | ||
realm_config.sync_config->client_resync_mode = ClientResyncMode::Manual; | ||
realm_config.sync_config->error_handler = [](std::shared_ptr<SyncSession>, SyncError error) { | ||
std::cerr << error.message << std::endl; |
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.
Do we need to override the sync handler here? Should we assert that there is no error?
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.
Removed
test/object-store/sync/app.cpp
Outdated
|
||
realm::Realm::Config realm_config; | ||
realm_config.sync_config = std::make_shared<realm::SyncConfig>(app->current_user(), bson::Bson("foo")); | ||
realm_config.sync_config->client_resync_mode = ClientResyncMode::Manual; |
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 the default value works fine here
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.
Removed
test/object-store/sync/app.cpp
Outdated
realm_config.sync_config = std::make_shared<realm::SyncConfig>(app->current_user(), bson::Bson("foo")); | ||
realm_config.sync_config->client_resync_mode = ClientResyncMode::Manual; | ||
realm_config.sync_config->error_handler = [](std::shared_ptr<SyncSession>, SyncError error) { | ||
std::cerr << error.message << std::endl; |
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 we want to abort if we get here because that's how we'll know if the server sent us an error message, or am I missing something?
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.
Removed
tools/run_baas.sh
Outdated
|
||
PROJECT_DIR=$(git rev-parse --show-toplevel) | ||
MDBREALM_TEST_SERVER_TAG=$(grep MDBREALM_TEST_SERVER_TAG ${PROJECT_DIR}/dependencies.list |cut -f 2 -d=) | ||
docker run --rm -p 9090:9090 -v ~/.aws/credentials:/root/.aws/credentials -it docker.pkg.github.com/realm/ci/mongodb-realm-test-server:${MDBREALM_TEST_SERVER_TAG} |
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.
If you want, you can also just run ./evergreen/install_baas.sh -w baas-work-dir
with your AWS credentials in the correct environment variables and it will the latest version of baas deployed to prod.
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.
ok, but I just wanted a script that starts the version we refer to in the dependencies. I think that is the one that is run in Jenkins CI.
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.
TBH, I think we should get rid of the dependencies.list for deciding what version of baas to run. It's chronically out of date, sometimes by months or quarters. Can you change the name of this file to be something like run_baas_docker_image.sh to clarify what it's actually doing? Otherwise I don't have an objection to small utility scripts like this, just wanted you to know that there's already something in the codebase that will accomplish the same task.
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.
If I run ./evergreen/install_baas.sh -w baas-work-dir
, I get Unsupported platform linuxmint 19.3
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 will rename the script.
@@ -24,14 +24,14 @@ target_link_libraries(RealmTrawler Storage) | |||
|
|||
add_executable(RealmBrowser EXCLUDE_FROM_ALL realm_browser.cpp ) | |||
set_target_properties(RealmBrowser PROPERTIES | |||
OUTPUT_NAME "realm-browser-6" | |||
OUTPUT_NAME "realm-browser-10" |
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.
Can we just remove these suffixes? What value are they adding?
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.
They are adding the value that It is build into the name which version it can handle. I have to have multiple versions around so that I can open whatever realm file I get from a customer.
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.
Ah, if it's part of your workflow then okay. I wish this were configurable. We use these tools outside of your debugging processes - e.g. the cloud team depends on them. @tkaye407 , will you need to update anything if we rename realm2json like this?
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.
We currently just pin to a specific version (though we probably should be able to pick up the latest merge), but once this goes in I can update the version / name of the executable that we link to in our evergreen config. Thanks for pointing out
85b0c5b
to
adb9155
Compare
The problem is that the server does not know that the client has already integrated some server versions, and therefore it sends down 0 as progress/upload/last_integrated_server_version. On the client this number may be bigger and in this case that number will not be overwritten with 0. On the server side, the following behavior is expected: If the IDENT message indicates that the newly created client has already integraded some server changesets, adjust the upload threshold accordingly- If the threshold is ahead of the upload cursor stored in the history, use the threshold values.
The problem is that the server does not know that the client has already
integrated some server versions, and therefore it sends down 0 as
progress/upload/last_integrated_server_version. On the client this number
may be bigger and in this case that number will not be overwritten with 0.
On the server we have to change the handling of the upload cursor in case
a newly created client indicates that is has already integrated some server
changesets.
What, How & Why?
☑️ ToDos