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

No merge on resolve #353

Closed
wants to merge 2 commits into from
Closed

No merge on resolve #353

wants to merge 2 commits into from

Conversation

@AlexeyBarabash
Copy link
Contributor

AlexeyBarabash commented Oct 28, 2019

Fixes #261

With this PR resolve operation becomes much simpler. No merge is performed, always wins the latest record. From the other side, now the lib could not accept partial records, for example UPDATE record for bookmark with the only title field change, all fields should be specified even ones which remain the same.

@bridiver
Copy link
Contributor

bridiver commented Oct 28, 2019

To be clear, partial updates were never intended to be supported and unnecessarily complicated the implementation

Copy link
Member

darkdh left a comment

we should also remove this workaround
20d7fd7

package.json Outdated Show resolved Hide resolved
client/recordUtil.js Outdated Show resolved Hide resolved
client/recordUtil.js Outdated Show resolved Hide resolved
client/recordUtil.js Outdated Show resolved Hide resolved
if (record.action === proto.actions.DELETE ||
!object) {
return record
} else if (object.action === proto.actions.DELETE) {

This comment has been minimized.

Copy link
@darkdh

darkdh Oct 28, 2019

Member

why do we need to pull out these two DELETE cases?

This comment has been minimized.

Copy link
@AlexeyBarabash

AlexeyBarabash Oct 29, 2019

Author Contributor

I think, DELETE is a special case of the operation. When it happens, the object is destroyed and no more sense to perform any next operation on the object.

I chose DELETE wins way after considering this:

  1. deviceA and deviceB both has synced bookmark bookmarkA
  2. at almost the same time bookmarkA is renamed on deviceA and removed on deviceB
  3. what would I expect?

I would expect bookmarkA will be removed on both devices, so I put this into the code.

And what do you think?

This comment has been minimized.

Copy link
@darkdh

darkdh Oct 30, 2019

Member

we still need to consider timestamp because Android and brave-core now save object id even if the bookmark is deleted, which is the measure for preventing duplicate bookmarks when leaving and rejoining the sync chain. So DELETE still need to compete with CREATE or even UPDATE which is your case .

@AlexeyBarabash AlexeyBarabash force-pushed the no_merge_on_resolve branch from 28b819f to 6c168a8 Oct 29, 2019
@AlexeyBarabash AlexeyBarabash force-pushed the no_merge_on_resolve branch from 6c168a8 to 8ae375a Oct 30, 2019
@AlexeyBarabash AlexeyBarabash mentioned this pull request Nov 27, 2019
6 of 32 tasks complete
@AlexeyBarabash
Copy link
Contributor Author

AlexeyBarabash commented Mar 9, 2020

Closing as moving to sync v2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants
You can’t perform that action at this time.