Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1150)

Issue 10389103: Sync: Clear IS_UNSYNCED for deleted local items (Closed)

Created:
8 years, 7 months ago by rlarocque
Modified:
8 years, 7 months ago
Reviewers:
Nicolas Zea
CC:
chromium-reviews, tim (not reviewing)
Visibility:
Public.

Description

Sync: Clear IS_UNSYNCED for deleted local items Prior to this change, if we were to delete a newly-created item before informing the sync server of its existence, it would end up in an unusual state. We do not commit deleted items unless they were known to sync server. However, these items were still considered to be 'unsynced' (ie. waiting to be committed to the server) and therefore impossible to entirely remove from the sync directory. They remain forever both IS_DEL and IS_UNSYNCED. This had a few side-effects. The most serious is that this behaviour could cause directory corruption. If we created a folder and a bookmark within it, then deleted that bookmark before it had a chance to sync, the bookmark would remain in a zombie state. When we finally got around to committing its parent folder, the folder's ID will change. The zombie bookmark's PARENT_ID will not be updated, leaving us with a dangling reference that will be detected as directory corruption the next time sync is loaded. See crbug.com/125381 for details. Another effect is that locally deleted, never synced UNIQUE_CLIENT_TAG could have strange effects later on. If a foreign client were to create an item with the same UNIQUE_CLIENT_TAG and sync it, this client would conflict-resolve the update against the zombie entry. The zombie entry would win, the newly created item would be deleted, and the deletion synced back to the server. This may not be an entirely bad thing, but it is a behaviour that's changed following this patch. From now on, the deleted item will be overwritten (if it still exists, which it probably won't). Finally, we now have a mechanism for permanently deleting these items. With this patch applied, these items will no longer have the unsynced bit set, so they will be deleted on restart by DropDeletedEntries(). This patch changes PutIsDel() to clear the IS_UNSYNCED bit of entries which were never committed to the sync server. The remainder of the changes either add or update existing tests. BUG=125381 TEST=SyncerTest.ClientTagUncommittedTagMatchesUpdate, SyncableDirectoryTest.ChangeEntryIDAndUpdateChildren_DeletedAndUnsyncedChildren Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=137476

Patch Set 1 #

Total comments: 17

Patch Set 2 : Address comments #

Patch Set 3 : Fix check_deps issue by moving ChangeEntryIDAndUpdateChildren #

Total comments: 4

Patch Set 4 : Remove unnecessary wrapper function #

Unified diffs Side-by-side diffs Delta from patch set Stats (+209 lines, -83 lines) Patch
M sync/engine/get_commit_ids_command.cc View 1 chunk +0 lines, -8 lines 0 comments Download
M sync/engine/process_commit_response_command.cc View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M sync/engine/process_updates_command.cc View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M sync/engine/syncer_unittest.cc View 3 chunks +12 lines, -7 lines 0 comments Download
M sync/engine/syncer_util.h View 1 2 1 chunk +0 lines, -10 lines 0 comments Download
M sync/engine/syncer_util.cc View 1 2 1 chunk +0 lines, -53 lines 0 comments Download
M sync/syncable/dir_open_result.h View 1 chunk +1 line, -0 lines 0 comments Download
M sync/syncable/in_memory_directory_backing_store.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M sync/syncable/syncable.h View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
M sync/syncable/syncable.cc View 1 2 3 2 chunks +55 lines, -0 lines 0 comments Download
M sync/syncable/syncable_unittest.cc View 1 2 4 chunks +133 lines, -1 line 0 comments Download

Messages

Total messages: 11 (0 generated)
rlarocque
zea: Please review. http://codereview.chromium.org/10389103/diff/1/sync/engine/syncer_unittest.cc File sync/engine/syncer_unittest.cc (right): http://codereview.chromium.org/10389103/diff/1/sync/engine/syncer_unittest.cc#newcode1453 sync/engine/syncer_unittest.cc:1453: parent.Put(syncable::ID, ids_.FromNumber(103)); Because of my change, ...
8 years, 7 months ago (2012-05-11 22:41:26 UTC) #1
Nicolas Zea
Couple nits. Also, this actually looks like it's going back to the expectations from before ...
8 years, 7 months ago (2012-05-11 23:21:24 UTC) #2
rlarocque
Updated the diff to address your comments. PTAL. I think I know why the tests ...
8 years, 7 months ago (2012-05-15 00:41:55 UTC) #3
Nicolas Zea
On 2012/05/15 00:41:55, rlarocque wrote: > Updated the diff to address your comments. PTAL. > ...
8 years, 7 months ago (2012-05-15 18:07:02 UTC) #4
rlarocque
On 2012/05/15 18:07:02, nzea wrote: > On 2012/05/15 00:41:55, rlarocque wrote: > > Updated the ...
8 years, 7 months ago (2012-05-15 18:44:44 UTC) #5
rlarocque
I had to move some code around to fix check_deps. That's a big enough change ...
8 years, 7 months ago (2012-05-15 23:12:38 UTC) #6
Nicolas Zea
https://chromiumcodereview.appspot.com/10389103/diff/8001/sync/engine/syncer_util.cc File sync/engine/syncer_util.cc (right): https://chromiumcodereview.appspot.com/10389103/diff/8001/sync/engine/syncer_util.cc#newcode83 sync/engine/syncer_util.cc:83: // static remove comment https://chromiumcodereview.appspot.com/10389103/diff/8001/sync/syncable/syncable.cc File sync/syncable/syncable.cc (right): https://chromiumcodereview.appspot.com/10389103/diff/8001/sync/syncable/syncable.cc#newcode2391 ...
8 years, 7 months ago (2012-05-15 23:25:04 UTC) #7
rlarocque
Uploaded new version that removes the wrapper function. Let's see if the trybots like it. ...
8 years, 7 months ago (2012-05-16 00:32:36 UTC) #8
Nicolas Zea
LGTM
8 years, 7 months ago (2012-05-16 00:36:38 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rlarocque@chromium.org/10389103/11002
8 years, 7 months ago (2012-05-16 17:49:36 UTC) #10
commit-bot: I haz the power
8 years, 7 months ago (2012-05-16 19:09:52 UTC) #11
Change committed as 137476

Powered by Google App Engine
This is Rietveld 408576698