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

Issue 9036003: Avoid useless SYNC_CYCLE_CONTINUATION sync cycle (Closed)

Created:
9 years ago by rlarocque
Modified:
8 years, 10 months ago
CC:
chromium-reviews, Raghu Simha, ncarter (slow), akalin, Paweł Hajdan Jr.
Visibility:
Public.

Description

Avoid useless SYNC_CYCLE_CONTINUATION sync cycle When exiting from a sync cycle, the SyncScheduler will look at the results of the previous cycle and use them to determine when the next sync job should run. Part of this is detecting whether or not the job failed. Right now, we assume that num_unsynced_handles > 0 implies that we failed to commit everything we should have. That's wrong, because that information was calculated at the beginning of the job and doesn't get updated following the commit. So num_unsynced_handles > 0 actually implies that we probably tried to commit something, but it doesn't necessarily mean the commit failed. Because of that faulty logic, we assume that every sync cycle that commits something has in fact failed. We schedule another job soon after to clean up the failure. This commit attempts to fix that issue. It moves the logic for detecting the failure into SyncSession::Succeeded() which will act as an interpreter for the session's state. It also adds plumbing so that SyncerCommands can return values indicating an error, and a some member variables in SyncSession to store them. This allows us to implement SyncSession::Succeeded() so it returns false only when we know of an actual error, rather than trying to infer this from unsynced_handles. This commit also adds a similar function, SyncSession::ExperiencedTransientError(), that will report based on the returned error codes whether or not we should schedule another sync cycle or give up. There's not much point in retrying if the server is sending us AuthErrors, and the return codes will allow us to see that information. However, due to the risk of such a change, the ExperiencedTransientError() function is not yet a part of the SyncScheduler's decision making. Finally, this commit fixes issue 105994 because a recent change made it so that I get -Werror compile errors locally because of that issue. BUG=94670, 105994 TEST=

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+448 lines, -197 lines) Patch
M chrome/browser/sync/engine/apply_updates_command.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/engine/apply_updates_command.cc View 2 chunks +5 lines, -2 lines 0 comments Download
M chrome/browser/sync/engine/build_and_process_conflict_sets_command.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/engine/build_and_process_conflict_sets_command.cc View 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/sync/engine/build_commit_command.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/engine/build_commit_command.cc View 2 chunks +3 lines, -1 line 0 comments Download
M chrome/browser/sync/engine/cleanup_disabled_types_command.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/engine/cleanup_disabled_types_command.cc View 2 chunks +5 lines, -4 lines 0 comments Download
M chrome/browser/sync/engine/clear_data_command.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/engine/clear_data_command.cc View 5 chunks +10 lines, -5 lines 0 comments Download
M chrome/browser/sync/engine/download_updates_command.h View 1 chunk +4 lines, -1 line 0 comments Download
M chrome/browser/sync/engine/download_updates_command.cc View 5 chunks +6 lines, -5 lines 0 comments Download
M chrome/browser/sync/engine/get_commit_ids_command.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/engine/get_commit_ids_command.cc View 2 chunks +2 lines, -1 line 0 comments Download
M chrome/browser/sync/engine/model_changing_syncer_command.h View 3 chunks +7 lines, -9 lines 0 comments Download
M chrome/browser/sync/engine/model_changing_syncer_command.cc View 2 chunks +15 lines, -9 lines 0 comments Download
M chrome/browser/sync/engine/model_changing_syncer_command_unittest.cc View 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/sync/engine/model_safe_worker.h View 3 chunks +3 lines, -4 lines 0 comments Download
M chrome/browser/sync/engine/model_safe_worker.cc View 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/sync/engine/passive_model_worker.h View 2 chunks +2 lines, -1 line 0 comments Download
M chrome/browser/sync/engine/passive_model_worker.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/engine/post_commit_message_command.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/engine/post_commit_message_command.cc View 2 chunks +11 lines, -8 lines 0 comments Download
M chrome/browser/sync/engine/process_commit_response_command.h View 2 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/sync/engine/process_commit_response_command.cc View 7 chunks +25 lines, -17 lines 0 comments Download
M chrome/browser/sync/engine/process_updates_command.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/engine/process_updates_command.cc View 2 chunks +5 lines, -3 lines 0 comments Download
M chrome/browser/sync/engine/resolve_conflicts_command.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/engine/resolve_conflicts_command.cc View 1 chunk +6 lines, -6 lines 0 comments Download
M chrome/browser/sync/engine/store_timestamps_command.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/engine/store_timestamps_command.cc View 2 chunks +5 lines, -2 lines 0 comments Download
M chrome/browser/sync/engine/sync_scheduler.cc View 2 chunks +8 lines, -18 lines 0 comments Download
M chrome/browser/sync/engine/syncer.cc View 2 chunks +7 lines, -3 lines 0 comments Download
M chrome/browser/sync/engine/syncer_command.h View 3 chunks +5 lines, -3 lines 0 comments Download
M chrome/browser/sync/engine/syncer_command.cc View 1 chunk +3 lines, -2 lines 0 comments Download
A chrome/browser/sync/engine/syncer_error.h View 1 chunk +37 lines, -0 lines 0 comments Download
A chrome/browser/sync/engine/syncer_error.cc View 1 chunk +35 lines, -0 lines 0 comments Download
M chrome/browser/sync/engine/syncer_proto_util.h View 2 chunks +2 lines, -1 line 0 comments Download
M chrome/browser/sync/engine/syncer_proto_util.cc View 4 chunks +45 lines, -11 lines 0 comments Download
M chrome/browser/sync/engine/verify_updates_command.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/engine/verify_updates_command.cc View 2 chunks +4 lines, -2 lines 0 comments Download
M chrome/browser/sync/glue/browser_thread_model_worker.h View 5 chunks +5 lines, -5 lines 0 comments Download
M chrome/browser/sync/glue/browser_thread_model_worker.cc View 4 chunks +11 lines, -11 lines 0 comments Download
M chrome/browser/sync/glue/browser_thread_model_worker_unittest.cc View 2 chunks +2 lines, -3 lines 0 comments Download
M chrome/browser/sync/glue/history_model_worker.h View 2 chunks +1 line, -2 lines 0 comments Download
M chrome/browser/sync/glue/history_model_worker.cc View 3 chunks +8 lines, -8 lines 0 comments Download
M chrome/browser/sync/glue/password_model_worker.h View 3 chunks +2 lines, -3 lines 0 comments Download
M chrome/browser/sync/glue/password_model_worker.cc View 1 chunk +6 lines, -6 lines 0 comments Download
M chrome/browser/sync/glue/ui_model_worker.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/glue/ui_model_worker.cc View 4 chunks +3 lines, -4 lines 0 comments Download
M chrome/browser/sync/glue/ui_model_worker_unittest.cc View 2 chunks +3 lines, -4 lines 0 comments Download
M chrome/browser/sync/sessions/session_state.h View 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/browser/sync/sessions/session_state.cc View 1 chunk +4 lines, -1 line 0 comments Download
M chrome/browser/sync/sessions/status_controller.h View 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/browser/sync/sessions/status_controller.cc View 1 chunk +13 lines, -0 lines 0 comments Download
M chrome/browser/sync/sessions/sync_session.h View 1 chunk +16 lines, -0 lines 0 comments Download
M chrome/browser/sync/sessions/sync_session.cc View 1 chunk +77 lines, -0 lines 0 comments Download
M chrome/browser/sync/sessions/test_util.cc View 1 chunk +4 lines, -11 lines 0 comments Download
M chrome/browser/sync/test/engine/fake_model_worker.h View 2 chunks +2 lines, -1 line 0 comments Download
M chrome/browser/sync/test/engine/fake_model_worker.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/chrome.gyp View 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
rlarocque
This mega-commit fixes SYNC_CYCLE_CONTINUATION GetUpdate bug. It took many patches to get to this point; ...
9 years ago (2011-12-23 02:30:19 UTC) #1
tim (not reviewing)
On 2011/12/23 02:30:19, rlarocque wrote: > This mega-commit fixes SYNC_CYCLE_CONTINUATION GetUpdate bug. It took many ...
8 years, 11 months ago (2012-01-04 20:30:21 UTC) #2
rlarocque
8 years, 11 months ago (2012-01-04 22:50:22 UTC) #3
On 2012/01/04 20:30:21, timsteele wrote:
> On 2011/12/23 02:30:19, rlarocque wrote:
> > This mega-commit fixes SYNC_CYCLE_CONTINUATION GetUpdate bug.  It took many
> > patches to get to this point; now I can finally commit this without breaking
> > things.
> > 
> > This is a big change.  If you would prefer, I could split it up as follows:
> > - A patch to add return values to SyncerCommand
> > - A patch to process SyncerCommand results and implement
> > SyncSession::Succeeded()
> > - Finally, another patch to hook up SyncSession::Succeeded() to the
> > SyncScheduler.
> > 
> > Personally, I think it makes more sense this way.  If there's a bug in this
> > change, it's likely due to the way those patches interact with each other. 
> I'm
> > hoping that squashing this patch set will make those bugs easier to find.
> 
> I think seeing it together like this helps fill in the blanks that would be
> there had you just sent out 3 patches as mentioned above because we can see
how
> things are supposed to interact.  But I still think landing it in 3 stages
will
> make everyone's (you, sheriffs, reviewers) lives easier for rebasing, landing
on
> trunk and dealing with fallout, allowing for more scrutiny of individual
parts,
> and in the future if anyone ever needs to revert a portion of it due to a
latent
> bug (and changes have landed atop this that use the new return value syntax,
for
> example).

I have taken your advice and split this into four separate patches.  The first
one is the fix for issue 105994, and the following three are as described above.
 I will post these for review one at a time.  

Here is the first review: http://codereview.chromium.org/9087020/

Feel free to post comments to this review, or to the reviews for individual
patches.  I'll try to respond to them either way.

Powered by Google App Engine
This is Rietveld 408576698