summaryrefslogtreecommitdiffstats
path: root/sync/sessions/session_state.h
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-26 00:06:47 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-26 00:06:47 +0000
commitce0f41696951562391ad3d1bf180c2ae08db66fb (patch)
treea502e5d771252e26df5f51477eb477696a2dc7f7 /sync/sessions/session_state.h
parent085e92da549d6e20df4e023687aad2c23e05aea2 (diff)
downloadchromium_src-ce0f41696951562391ad3d1bf180c2ae08db66fb.zip
chromium_src-ce0f41696951562391ad3d1bf180c2ae08db66fb.tar.gz
chromium_src-ce0f41696951562391ad3d1bf180c2ae08db66fb.tar.bz2
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. Review URL: https://chromiumcodereview.appspot.com/10210009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139159 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/sessions/session_state.h')
-rw-r--r--sync/sessions/session_state.h11
1 files changed, 0 insertions, 11 deletions
diff --git a/sync/sessions/session_state.h b/sync/sessions/session_state.h
index 3f37cd0..c2a3edc 100644
--- a/sync/sessions/session_state.h
+++ b/sync/sessions/session_state.h
@@ -23,7 +23,6 @@
#include "sync/engine/syncer_types.h"
#include "sync/engine/syncproto.h"
#include "sync/protocol/sync_protocol_error.h"
-#include "sync/sessions/ordered_commit_set.h"
#include "sync/syncable/model_type.h"
#include "sync/syncable/model_type_payload_map.h"
#include "sync/syncable/syncable.h"
@@ -114,12 +113,10 @@ class SyncSessionSnapshot {
const syncable::ModelTypePayloadMap& download_progress_markers,
bool more_to_sync,
bool is_silenced,
- int64 unsynced_count,
int num_encryption_conflicts,
int num_hierarchy_conflicts,
int num_simple_conflicts,
int num_server_conflicts,
- bool did_commit_items,
const SyncSourceInfo& source,
bool notifications_enabled,
size_t num_entries,
@@ -140,7 +137,6 @@ class SyncSessionSnapshot {
syncable::ModelTypePayloadMap download_progress_markers() const;
bool has_more_to_sync() const;
bool is_silenced() const;
- int64 unsynced_count() const;
int num_encryption_conflicts() const;
int num_hierarchy_conflicts() const;
int num_simple_conflicts() const;
@@ -161,12 +157,10 @@ class SyncSessionSnapshot {
syncable::ModelTypePayloadMap download_progress_markers_;
bool has_more_to_sync_;
bool is_silenced_;
- int64 unsynced_count_;
int num_encryption_conflicts_;
int num_hierarchy_conflicts_;
int num_simple_conflicts_;
int num_server_conflicts_;
- bool did_commit_items_;
SyncSourceInfo source_;
bool notifications_enabled_;
size_t num_entries_;
@@ -321,20 +315,15 @@ struct AllModelTypeState {
explicit AllModelTypeState(bool* dirty_flag);
~AllModelTypeState();
- // Commits for all model types are bundled together into a single message.
- ClientToServerMessage commit_message;
- ClientToServerResponse commit_response;
// We GetUpdates for some combination of types at once.
// requested_update_types stores the set of types which were requested.
syncable::ModelTypeSet updates_request_types;
ClientToServerResponse updates_response;
// Used to build the shared commit message.
- DirtyOnWrite<std::vector<int64> > unsynced_handles;
DirtyOnWrite<SyncerStatus> syncer_status;
DirtyOnWrite<ErrorCounters> error;
SyncCycleControlParameters control_params;
DirtyOnWrite<int64> num_server_changes_remaining;
- OrderedCommitSet commit_set;
};
// Grouping of all state that applies to a single ModelSafeGroup.