Skip to content
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

Recreating bookmarks with duplicated sync object id #4816

Merged
merged 2 commits into from
Mar 10, 2020

Conversation

AlexeyBarabash
Copy link
Contributor

@AlexeyBarabash AlexeyBarabash commented Mar 3, 2020

Resolves brave/brave-browser#8358

Submitter Checklist:

Test Plan:

  1. Install version 1.7.20 Nightly, or any other based on C80 which does not contain Sync fix bookmarks object id duplication #4710
  2. Enable sync through flags
  3. Create sync chain, no need to connect 2nd device
  4. Create bookmark
  5. Copy and paste bookmark
  6. See crash
  7. Install the version containing this fix
  8. Launch - should not be crash
  9. Connect 2nd device to chain - bookmarks changes should be reflected, may take 11 minutes

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

@AlexeyBarabash AlexeyBarabash force-pushed the sync_recover_after_dup_id branch 4 times, most recently from 06d4985 to dce5767 Compare March 5, 2020 23:23
@AlexeyBarabash AlexeyBarabash marked this pull request as ready for review March 5, 2020 23:31
common/pref_names.h Outdated Show resolved Hide resolved
chromium_src/components/sync/engine_impl/commit.cc Outdated Show resolved Hide resolved
@AlexeyBarabash AlexeyBarabash added the CI/skip Do not run CI builds (except noplatform) label Mar 6, 2020
Copy link
Member

@BrendanEich BrendanEich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note duplicated_bookmarks_recorvered typo ("recovered" as "recorvered").

@AlexeyBarabash AlexeyBarabash removed the CI/skip Do not run CI builds (except noplatform) label Mar 9, 2020
@AlexeyBarabash
Copy link
Contributor Author

Here what happens step-by-step.

  1. BookmarkModel is loaded BookmarkModel::DoneLoading;
  2. Also sync_metadata_str() is passed eventually into BookmarkModelTypeProcessor::ModelReadyToSync
    bookmark meta info is decoded and there are such info about bookmarks:
sync_pb::BookmarkMetadata
	is_deleted
	server_id
	sequence_number
	acked_sequence_number
  1. Recovery procedure BraveProfileSyncServiceImpl::MigrateDuplicatedBookmarksObjectIds runs

  2. In this point sync_bookmarks::BookmarkModelObserverImpl already is set as bookmark model observer
    and it processes BookmarkNodeAdded and BookmarkNodeRemoved caused by MigrateDuplicatedBookmarksObjectIds operations

  3. records DELETE and CREATE comes into ConvertCommitsToBraveRecords
    Here for the entity we want to delete, brave sync object_id is empty. For such record I set objectId to a new generated. This allows the record to travel through cyns cycle and do not appear as unsynced in the future.

  4. Previos steps happens early on browser start so BraveProfileSyncServiceImpl::SendSyncRecords will be executed before extension is initialized, so actual records will be resent after 10 minutes actually. This what had happened in issue Some bookmarks with duplicate ids are not synced brave-browser#8498.

  5. In 10 minutes resend will happened and all other devices in chain will have that info.

@AlexeyBarabash
Copy link
Contributor Author

CI failed because of audit failures and internal error of lynt.py.

@AlexeyBarabash
Copy link
Contributor Author

removed b-b branch and rebased

@AlexeyBarabash
Copy link
Contributor Author

AlexeyBarabash commented Mar 10, 2020

on linux failed browser-test

1 test timed out:
15:18:11      BraveRewardsBrowserTest.TipConnectedPublisherAnonAndConnected (../../brave/components/brave_rewards/browser/rewards_service_browsertest.cc:2762)

macos failed completely
windows was skipped
android succeeded
ios succeeded

restarting all except android and ios

@AlexeyBarabash AlexeyBarabash added the CI/skip-android Do not run CI builds for Android label Mar 10, 2020
@AlexeyBarabash AlexeyBarabash added the CI/skip-ios Do not run CI builds for iOS label Mar 10, 2020
Copy link
Collaborator

@bridiver bridiver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chromium_src changes are ok

@AlexeyBarabash AlexeyBarabash merged commit 7bff18b into master Mar 10, 2020
@AlexeyBarabash AlexeyBarabash deleted the sync_recover_after_dup_id branch March 10, 2020 18:22
@bsclifton bsclifton added this to the 1.7.x - Beta milestone Mar 11, 2020
AlexeyBarabash added a commit that referenced this pull request Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/skip-android Do not run CI builds for Android CI/skip-ios Do not run CI builds for iOS feature/sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix desktop profiles which are crashing because of sync object id duplication
5 participants