don't fail on invalid server deltas which don't apply to the local snapshot; wipe the local snapshot instead
authorDan Mills <thunder@mozilla.com>
Wed, 02 Apr 2008 00:00:24 -0700
changeset 44418 1551b4e98d43f36ff02feb425d77274967e13228
parent 44417 da35c2efce5f7db42648668dd450df2663a23d7a
child 44419 a0b5a748653d71ec475b772ed2bf393e9d1e12e1
child 44421 8b345cd5706bd3988d7c44c5bf8f5995964de4fa
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
don't fail on invalid server deltas which don't apply to the local snapshot; wipe the local snapshot instead
services/sync/modules/engines.js
--- a/services/sync/modules/engines.js
+++ b/services/sync/modules/engines.js
@@ -566,19 +566,27 @@ Engine.prototype = {
         allDeltas = this._json.decode(data);
         deltas = [];
 
       } else { // this._snapshot.version > status.maxVersion
         this._log.error("Server snapshot is older than local snapshot");
         break;
       }
 
-      for (var i = 0; i < deltas.length; i++) {
-        snap.applyCommands.async(snap, self.cb, deltas[i]);
-        yield;
+      try {
+        for (var i = 0; i < deltas.length; i++) {
+          snap.applyCommands.async(snap, self.cb, deltas[i]);
+          yield;
+        }
+      } catch (e) {
+        this._log.error("Error applying remote deltas to saved snapshot");
+        this._log.error("Clearing local snapshot; next sync will merge");
+        this._log.debug("Exception: " + Utils.exceptionStr(e));
+        this._log.trace("Stack:\n" + Utils.stackTrace(e));
+        this._snapshot.wipe();
       }
 
       ret.status = 0;
       ret.formatVersion = status.formatVersion;
       ret.maxVersion = status.maxVersion;
       ret.snapVersion = status.snapVersion;
       ret.snapEncryption = status.snapEncryption;
       ret.deltasEncryption = status.deltasEncryption;