Closed Bug 1262021 Opened 9 years ago Closed 9 years ago

Remote commands are applied on every Sync

Categories

(Firefox :: Sync, defect, P1)

defect

Tracking

()

RESOLVED FIXED
Firefox 48
Tracking Status
firefox48 --- fixed

People

(Reporter: markh, Assigned: lina)

References

Details

(Whiteboard: [sync-data-integrity])

Attachments

(1 file)

In bug 1250531, we failed to take into account that we don't immediately re-upload the local record after applying the commands, so when we do the next Sync we re-apply the commands on the server. The end result is that commands are applied each sync - which is bad :( Kit and I have a fix for this that should be ready tomorrow.
https://reviewboard.mozilla.org/r/44247/#review40911 ::: services/sync/tests/unit/test_clients_engine.js:847 (Diff revision 1) > server.stop(run_next_test); > } > } > }); > > +add_test(function test_send_uri_ack() { Unfortunately, the preceding test is now failing for me locally, with an `NS_ERROR_CONNECTION_REFUSED`. I'm wondering if there's a bit of state we're not cleaning up somewhere, or the runs are stomping on one another.
Comment on attachment 8738008 [details] MozReview Request: Bug 1262021 - Ensure remote commands are applied once per sync. r?markh Review request updated; see interdiff: https://reviewboard.mozilla.org/r/44247/diff/1-2/
The most recent revision, which clobbers the cache in `test_receive_display_uri`, fixed the failure locally. https://treeherder.mozilla.org/#/jobs?repo=try&revision=9e40e965425c
Status: NEW → ASSIGNED
Flags: firefox-backlog+
Priority: -- → P1
Comment on attachment 8738008 [details] MozReview Request: Bug 1262021 - Ensure remote commands are applied once per sync. r?markh https://reviewboard.mozilla.org/r/44247/#review41093
Attachment #8738008 - Flags: review?(markh) → review+
Comment on attachment 8738008 [details] MozReview Request: Bug 1262021 - Ensure remote commands are applied once per sync. r?markh Review request updated; see interdiff: https://reviewboard.mozilla.org/r/44247/diff/2-3/
Attachment #8738008 - Attachment description: MozReview Request: Bug 1262021 - Ensure remote commands are applied once per sync. r?markh → MozReview Request: Bug 1262021 - Ensure remote commands are applied once per sync. r=markh
Comment on attachment 8738008 [details] MozReview Request: Bug 1262021 - Ensure remote commands are applied once per sync. r?markh Review request updated; see interdiff: https://reviewboard.mozilla.org/r/44247/diff/3-4/
Attachment #8738008 - Attachment description: MozReview Request: Bug 1262021 - Ensure remote commands are applied once per sync. r=markh → MozReview Request: Bug 1262021 - Ensure remote commands are applied once per sync. r?markh
Attachment #8738008 - Flags: review+ → review?(markh)
https://reviewboard.mozilla.org/r/44247/#review41143 ::: services/sync/modules/engines/clients.js:29 (Diff revision 4) > const CLIENTS_TTL_REFRESH = 604800; // 7 days > > const SUPPORTED_PROTOCOL_VERSIONS = ["1.1", "1.5"]; > > function hasDupeCommand(commands, action) { > + if (!commands) { For the case where there aren't any local or remote commands, if the recipient removed them. ::: services/sync/modules/engines/clients.js:512 (Diff revision 4) > - this.engine.localCommands = record.commands; > - else { > + }, > + > + _updateRemoteRecord(record) { > - let currentRecord = this._remoteClients[record.id]; > + let currentRecord = this._remoteClients[record.id]; > - if (currentRecord && currentRecord.commands) { > - // Merge commands. > + if (!currentRecord || !currentRecord.commands || > + !this.engine.isLocallyModified(record.id)) { This is the relevant change to avoid reuploading commands that a remote client has received and deleted. If we haven't modified it, we just accept the server's data as canonical.
Comment on attachment 8738008 [details] MozReview Request: Bug 1262021 - Ensure remote commands are applied once per sync. r?markh https://reviewboard.mozilla.org/r/44247/#review41203 ::: services/sync/modules/engines.js:1259 (Diff revision 4) > this._delete.ids = [id]; > else > this._delete.ids.push(id); > }, > > + isLocallyModified(id) { as discussed, let's keep inlining this given it is only true during a sync (othertimes we'd need to check the tracker) ::: services/sync/tests/unit/test_clients_engine.js:886 (Diff revision 4) > + args: ["https://example.com", fakeSenderID, "Yak Herders Anonymous"], > + }]; > + server.insertWBO("foo", "clients", new ServerWBO(engine.localID, encryptPayload(ourPayload), now)); > + > + _("Sync again"); > + engine.lastSync = now - 10; I think we should remove this given it's no longer needed (and if it *is* still needed, we are probably missing something else and need to dig deeper)
Attachment #8738008 - Flags: review?(markh) → review+
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 48
Whiteboard: [sync-data-integrity]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: