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

Issue 10210009: sync: Loop committing items without downloading updates (v2) (Closed)

Created:
8 years, 8 months ago by rlarocque
Modified:
8 years, 7 months ago
CC:
chromium-reviews, ncarter (slow), akalin, Raghu Simha, cbentzel+watch_chromium.org, darin-cc_chromium.org
Visibility:
Public.

Description

sync: Loop committing items without downloading updates Since its inception sync has required all commits to be preceded by a GetUpdates request. This was done to try to ensure we detect and resolve conflicts on the client, rather than having two conflicting commits collide at the server. It could never work perfectly, but it was likely to work in most cases and the server would bounce the commit if it didn't. Now we have a new server that doesn't always give us the latest version of a node when we ask for it, especially when the request was not solicited by the server (ie. not triggered by notification). The update before commit is now much less likely to detect conflicts. Even worse, the useless update requests can be surprisingly expensive in certain scenarios. This change allows us to avoid fetching updates between 'batches' of commits. This should improve performance in the case where we have lots of items to commit (ie. first time sync) and reduce load on the server. This CL has some far-reaching effects. This is in part because I decided to refactor the commit code, but major changes would have been required with or without the refactor. Highlights include: - The commit-related SyncerCommands are now paramaterized with local variables, allowing us to remove many members from the SyncSession classes. - Several syncer states have been collapsed into one COMMIT state which redirects to the new BuildAndPostCommits() function. - The PostCommitMessageCommand had been reduced to one line, which has now been inlined into the BuildAndPostCommits() function. - The unsynced_handles counter has been removed for now. Following this change, it would have always been zero unless an error was encountered during the commit. The functions that reference it expect different behaviour and would have been broken by this change. - The code to put extensions activity data back into the ExtensionsActivityMonitor in case of failure has been moved around to avoid double-counting if we have to post many commit messages. - A CONFLICT response from the server is now treated as a transient error. If we had continued to treat it as a success we might risk going into an infinite loop. See comment in code for details. - The "purposeless anachronism" conflicting_new_folder_ids_ has been removed. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=139159

Patch Set 1 #

Patch Set 2 : Inline PostCommitMessageCommand #

Total comments: 10

Patch Set 3 : Add 'Committer' class + small refactorings #

Patch Set 4 : Rebase, remove class, modify loop exit #

Total comments: 37

Patch Set 5 : Refactor loop again, add comments + more #

Total comments: 6

Patch Set 6 : More tests #

Patch Set 7 : Update comments #

Total comments: 2

Patch Set 8 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+634 lines, -566 lines) Patch
M chrome/browser/sync/profile_sync_service_harness.cc View 1 2 3 4 5 2 chunks +5 lines, -6 lines 0 comments Download
M chrome/browser/sync/sync_ui_util.cc View 1 2 3 4 5 6 7 1 chunk +0 lines, -3 lines 0 comments Download
M chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc View 1 2 3 4 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc View 1 2 3 4 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/sync/test_profile_sync_service.cc View 2 chunks +4 lines, -4 lines 0 comments Download
M sync/engine/build_commit_command.h View 1 2 3 4 5 6 2 chunks +24 lines, -1 line 0 comments Download
M sync/engine/build_commit_command.cc View 6 chunks +37 lines, -27 lines 0 comments Download
M sync/engine/build_commit_command_unittest.cc View 1 chunk +10 lines, -1 line 0 comments Download
A sync/engine/commit.h View 1 2 3 4 1 chunk +37 lines, -0 lines 0 comments Download
A sync/engine/commit.cc View 1 2 3 4 5 6 1 chunk +100 lines, -0 lines 0 comments Download
M sync/engine/get_commit_ids_command.h View 1 2 3 4 5 6 4 chunks +19 lines, -6 lines 0 comments Download
M sync/engine/get_commit_ids_command.cc View 1 2 3 4 5 6 7 13 chunks +19 lines, -21 lines 0 comments Download
M sync/engine/net/server_connection_manager.h View 1 chunk +0 lines, -2 lines 0 comments Download
M sync/engine/post_commit_message_command.h View 1 1 chunk +0 lines, -28 lines 0 comments Download
M sync/engine/post_commit_message_command.cc View 1 1 chunk +0 lines, -49 lines 0 comments Download
M sync/engine/process_commit_response_command.h View 1 2 3 4 5 6 3 chunks +39 lines, -2 lines 0 comments Download
M sync/engine/process_commit_response_command.cc View 1 2 3 4 5 6 7 9 chunks +86 lines, -46 lines 0 comments Download
M sync/engine/process_commit_response_command_unittest.cc View 12 chunks +58 lines, -44 lines 0 comments Download
M sync/engine/syncer.h View 1 2 3 4 5 6 7 1 chunk +1 line, -3 lines 0 comments Download
M sync/engine/syncer.cc View 1 2 3 4 3 chunks +5 lines, -55 lines 0 comments Download
M sync/engine/syncer_unittest.cc View 1 2 3 4 5 6 7 22 chunks +113 lines, -72 lines 0 comments Download
M sync/internal_api/all_status.cc View 1 2 3 4 5 6 7 2 chunks +0 lines, -2 lines 0 comments Download
M sync/internal_api/js_sync_manager_observer_unittest.cc View 1 chunk +0 lines, -2 lines 0 comments Download
M sync/internal_api/sync_manager.h View 1 2 3 4 1 chunk +0 lines, -3 lines 0 comments Download
M sync/internal_api/sync_manager.cc View 1 2 3 4 1 chunk +0 lines, -1 line 0 comments Download
M sync/sessions/ordered_commit_set.h View 1 2 3 4 3 chunks +11 lines, -5 lines 0 comments Download
M sync/sessions/ordered_commit_set.cc View 1 2 3 4 2 chunks +20 lines, -2 lines 0 comments Download
M sync/sessions/ordered_commit_set_unittest.cc View 1 2 3 4 1 chunk +12 lines, -0 lines 0 comments Download
M sync/sessions/session_state.h View 1 2 3 4 5 chunks +0 lines, -11 lines 0 comments Download
M sync/sessions/session_state.cc View 8 chunks +2 lines, -21 lines 0 comments Download
M sync/sessions/session_state_unittest.cc View 4 chunks +1 line, -8 lines 0 comments Download
M sync/sessions/status_controller.h View 1 2 3 4 5 6 7 7 chunks +18 lines, -61 lines 0 comments Download
M sync/sessions/status_controller.cc View 1 2 3 4 5 6 7 4 chunks +6 lines, -19 lines 0 comments Download
M sync/sessions/status_controller_unittest.cc View 3 chunks +0 lines, -29 lines 0 comments Download
M sync/sessions/sync_session.cc View 2 chunks +1 line, -7 lines 0 comments Download
M sync/sessions/sync_session_unittest.cc View 1 chunk +0 lines, -20 lines 0 comments Download
M sync/sessions/test_util.cc View 1 chunk +0 lines, -1 line 0 comments Download
M sync/sync.gyp View 1 2 3 4 5 6 7 2 chunks +2 lines, -2 lines 0 comments Download
M sync/syncable/syncable.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M sync/test/engine/mock_connection_manager.h View 1 chunk +1 line, -0 lines 0 comments Download
M sync/test/engine/mock_connection_manager.cc View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 20 (0 generated)
rlarocque
Carried over from http://codereview.chromium.org/10038041/. The rebase included a lot of noise, so I decided to ...
8 years, 8 months ago (2012-04-25 00:38:54 UTC) #1
tim (not reviewing)
Hey Richard, I Had a few prelim questions, before looking too deep. http://codereview.chromium.org/10210009/diff/2001/sync/engine/commit.cc File sync/engine/commit.cc ...
8 years, 8 months ago (2012-04-25 06:48:13 UTC) #2
rlarocque
We might need to continue this discussion in person. http://codereview.chromium.org/10210009/diff/2001/sync/engine/commit.cc File sync/engine/commit.cc (right): http://codereview.chromium.org/10210009/diff/2001/sync/engine/commit.cc#newcode5 sync/engine/commit.cc:5: ...
8 years, 8 months ago (2012-04-25 18:13:22 UTC) #3
tim (not reviewing)
(Still preliminary, I'll try to give this a full look tomorrow!) http://codereview.chromium.org/10210009/diff/2001/sync/engine/commit.cc File sync/engine/commit.cc (right): ...
8 years, 8 months ago (2012-04-26 06:47:54 UTC) #4
rlarocque
Updated. Note: I should have renamed commit.* to committer.* when I defined the class. I ...
8 years, 7 months ago (2012-05-08 00:48:32 UTC) #5
rlarocque
I've uploaded a new patch. Changes include: - Remove some unused variables. - Remove the ...
8 years, 7 months ago (2012-05-11 00:28:14 UTC) #6
rlarocque
http://codereview.chromium.org/10210009/diff/26002/sync/engine/commit.cc File sync/engine/commit.cc (right): http://codereview.chromium.org/10210009/diff/26002/sync/engine/commit.cc#newcode77 sync/engine/commit.cc:77: } while (items_to_commit_count > batch_size); I realized after posting ...
8 years, 7 months ago (2012-05-11 00:52:16 UTC) #7
tim (not reviewing)
http://codereview.chromium.org/10210009/diff/26002/sync/engine/build_commit_command.h File sync/engine/build_commit_command.h (right): http://codereview.chromium.org/10210009/diff/26002/sync/engine/build_commit_command.h#newcode23 sync/engine/build_commit_command.h:23: BuildCommitCommand(const sessions::OrderedCommitSet& batch_commit_set, Comments for parameters. http://codereview.chromium.org/10210009/diff/26002/sync/engine/build_commit_command.h#newcode54 sync/engine/build_commit_command.h:54: ClientToServerMessage* ...
8 years, 7 months ago (2012-05-11 18:42:15 UTC) #8
rlarocque
I'm still investigating what the current test coverage looks like. I'll address those comments later. ...
8 years, 7 months ago (2012-05-14 23:10:43 UTC) #9
rlarocque
You were right about the tests. There were no unit tests remaining that tested the ...
8 years, 7 months ago (2012-05-15 21:54:31 UTC) #10
tim (not reviewing)
Although I spent a lot of time reviewing on this second pass, apparently all I ...
8 years, 7 months ago (2012-05-15 22:25:00 UTC) #11
tim (not reviewing)
Oh, just saw the comment re: tests. Cool, will take a look!
8 years, 7 months ago (2012-05-15 22:26:16 UTC) #12
rlarocque
Replying here because codereview won't show me the diffs. :( > > > > The ...
8 years, 7 months ago (2012-05-16 21:13:35 UTC) #13
rlarocque
Comments updated. PTAL.
8 years, 7 months ago (2012-05-16 21:48:17 UTC) #14
tim (not reviewing)
This looks ready to go, lets focus on working the kinks out when using against ...
8 years, 7 months ago (2012-05-23 16:41:18 UTC) #15
rlarocque
http://codereview.chromium.org/10210009/diff/23007/chrome/browser/sync/profile_sync_service_harness.cc File chrome/browser/sync/profile_sync_service_harness.cc (right): http://codereview.chromium.org/10210009/diff/23007/chrome/browser/sync/profile_sync_service_harness.cc#newcode796 chrome/browser/sync/profile_sync_service_harness.cc:796: // good chance that we're now fully up to ...
8 years, 7 months ago (2012-05-25 20:03:31 UTC) #16
rlarocque
We've confirmed that the issues I saw when testing with this patch were due to ...
8 years, 7 months ago (2012-05-25 20:13:57 UTC) #17
tim (not reviewing)
On 2012/05/25 20:13:57, rlarocque wrote: > We've confirmed that the issues I saw when testing ...
8 years, 7 months ago (2012-05-25 21:01:22 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rlarocque@chromium.org/10210009/38002
8 years, 7 months ago (2012-05-25 21:27:54 UTC) #19
commit-bot: I haz the power
8 years, 7 months ago (2012-05-26 00:06:50 UTC) #20
Change committed as 139159

Powered by Google App Engine
This is Rietveld 408576698