Closed
Bug 493256
Opened 16 years ago
Closed 16 years ago
Reconcile doesn't handle removed items correctly
Categories
(Cloud Services :: General, defect)
Cloud Services
General
Tracking
(Not tracked)
RESOLVED
FIXED
0.4
People
(Reporter: jwkbugzilla, Assigned: Mardak)
References
Details
Attachments
(1 file)
1004 bytes,
patch
|
hello
:
review+
|
Details | Diff | Splinter Review |
I am writing a sync engine for Adblock Plus. When an item is removed on one computer, the other only gets the notification about the removal if it *doesn't* have this item. I checked and the problem seems to be reconciliation, more precisely the second step. There Weave checks whether the incoming item is identical to the existing item. It calls SyncEngine._isEqual() which returns true - because it ignores the payload property and all the other properties are equal. I added the following override to my engine class: _isEqual: function(item) { if (!item.payload) return false; return this.__proto__.__proto__._isEqual.apply(this, arguments); } Note that checking the payload property of the local item is not necessary - it is already known to exist so it should be non-null. This seems to fix the issue (there are still some glitches so I am not 100% sure). I tested with Weave 0.3 but the code seems unchanged in version 0.3.2.
Assignee | ||
Comment 1•16 years ago
|
||
SyncEngine__isEqual should be checking the payload indirectly through cleartext: Utils.deepEquals(item.cleartext, local.cleartext) payload is the encrypted version except in the case of a deleted record, it's "". What does your adblock plus record look like? Are you directly setting the payload or the cleartext? (Data records should have __proto__ set to CryptoWrapper.prototype and set values in cleartext so that CryptoWrapper will encrypt the cleartext data into the payload.) But I suppose if you didn't want things encrypted, you could inherit from WBORecord (like clients engine). Either way, this is still a bug because the sync engine incorrectly assumes Crypto records in various places.
Assignee | ||
Comment 2•16 years ago
|
||
(In reply to comment #0) > _isEqual: function(item) > if (!item.payload) > return false; It's possible for two machines to delete the same record, so they should be considered equal.
Updated•16 years ago
|
Attachment #377712 -
Flags: review?(thunder) → review+
Comment 3•16 years ago
|
||
Comment on attachment 377712 [details] [diff] [review] v1 Won't this catch the deleted case also? Utils.deepEquals(item.cleartext, local.cleartext)) { But either way, r+
Comment 4•16 years ago
|
||
(In reply to comment #1) > But I suppose if you didn't want things encrypted, you could inherit from > WBORecord (like clients engine). > > Either way, this is still a bug because the sync engine incorrectly assumes > Crypto records in various places. Maybe we should bake the crypto stuff into the base class and use other methods for specifying non-encrypted data? (e.g., set a cryptoAlgorithm property to 'none')
Assignee | ||
Comment 5•16 years ago
|
||
What would be use cases of engines not wanting to encrypt their data -- especially if in the UI we show that we always encrypt data put on the server? Should clients use cryptowrapper as well?
Assignee | ||
Comment 6•16 years ago
|
||
http://hg.mozilla.org/labs/weave/rev/befd9af4df5d Have engines check if the deleted flag is the same for _isEqual.
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: -- → 0.4
Comment 7•16 years ago
|
||
It would make some testing a little easier (currently you can't turn it off, and that means you can only check state during a sync when stuff gets logged). It would also make sense to not encrypt data if I'm using my own server, for example.
Reporter | ||
Comment 8•16 years ago
|
||
(In reply to comment #1) > SyncEngine__isEqual should be checking the payload indirectly through > cleartext: > Utils.deepEquals(item.cleartext, local.cleartext) Yes, I guessed that - but it doesn't work for some reason. local.cleartext is {disabled: false} in this case, maybe Utils.deepEqual() cannot distinguish it from {} (either way, there are other records that don't have any data at all).
Reporter | ||
Comment 9•16 years ago
|
||
My guess was correct, filed bug 493363 on Utils.deepEqual() issues.
Updated•16 years ago
|
Component: Weave → General
Product: Mozilla Labs → Weave
Version: 0.3 → unspecified
Updated•15 years ago
|
QA Contact: weave → general
You need to log in
before you can comment on or make changes to this bug.
Description
•