Backed out changeset 20863de3b8f4 (bug 1329850) for eslint failure: redeclaration of collection in deeper scope in test_syncengine_sync.js. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Tue, 31 Jan 2017 18:46:39 +0100
changeset 331828 b5acbffc8ebf1472c5e6d6f85acdf52e142b0d31
parent 331827 fdac8d6dee0904239665338d1808b868cdd50436
child 331829 46d24f66905f04bb4b561d791a8b1012004b717b
child 331887 c22bc80b4d44f8b710c154eed2b52a73a167b037
push id36702
push userarchaeopteryx@coole-files.de
push dateTue, 31 Jan 2017 17:47:06 +0000
treeherderautoland@b5acbffc8ebf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1329850
milestone54.0a1
backs out20863de3b8f47cdd4760237c5e63fb0489a0c093
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 20863de3b8f4 (bug 1329850) for eslint failure: redeclaration of collection in deeper scope in test_syncengine_sync.js. r=backout
services/sync/modules/engines.js
services/sync/modules/engines/clients.js
services/sync/tests/unit/test_syncengine_sync.js
--- a/services/sync/modules/engines.js
+++ b/services/sync/modules/engines.js
@@ -1582,22 +1582,20 @@ SyncEngine.prototype = {
         try {
           out = this._createRecord(id);
           if (this._log.level <= Log.Level.Trace)
             this._log.trace("Outgoing: " + out);
 
           out.encrypt(this.service.collectionKeys.keyForCollection(this.name));
           ok = true;
         } catch (ex) {
-          this._log.warn("Error creating record", ex);
-          ++counts.failed;
-          if (Async.isShutdownException(ex) || !this.allowSkippedRecord) {
-            Observers.notify("weave:engine:sync:uploaded", counts, this.name);
+          if (Async.isShutdownException(ex)) {
             throw ex;
           }
+          this._log.warn("Error creating record", ex);
         }
         if (ok) {
           let { enqueued, error } = postQueue.enqueue(out);
           if (!enqueued) {
             ++counts.failed;
             if (!this.allowSkippedRecord) {
               throw error;
             }
--- a/services/sync/modules/engines/clients.js
+++ b/services/sync/modules/engines/clients.js
@@ -253,22 +253,16 @@ ClientEngine.prototype = {
     if (hasDupeCommand(clientCommands, command)) {
       return false;
     }
     allCommands[clientId] = clientCommands.concat(command);
     this._saveCommands(allCommands);
     return true;
   },
 
-  _removeClientCommands(clientId) {
-    const allCommands = this._readCommands();
-    delete allCommands[clientId];
-    this._saveCommands(allCommands);
-  },
-
   _syncStartup: function _syncStartup() {
     // Reupload new client record periodically.
     if (Date.now() / 1000 - this.lastRecordUpload > CLIENTS_TTL_REFRESH) {
       this._tracker.addChangedID(this.localID);
       this.lastRecordUpload = Date.now() / 1000;
     }
     SyncEngine.prototype._syncStartup.call(this);
   },
@@ -668,18 +662,16 @@ ClientEngine.prototype = {
    */
   _handleDisplayURIs: function _handleDisplayURIs(uris) {
     Svc.Obs.notify("weave:engine:clients:display-uris", uris);
   },
 
   _removeRemoteClient(id) {
     delete this._store._remoteClients[id];
     this._tracker.removeChangedID(id);
-    this._removeClientCommands(id);
-    this._modified.delete(id);
   },
 };
 
 function ClientStore(name, engine) {
   Store.call(this, name, engine);
 }
 ClientStore.prototype = {
   __proto__: Store.prototype,
--- a/services/sync/tests/unit/test_syncengine_sync.js
+++ b/services/sync/tests/unit/test_syncengine_sync.js
@@ -1512,106 +1512,16 @@ add_task(async function test_uploadOutgo
     // Ensure that the uploads were performed in batches of MAX_UPLOAD_RECORDS.
     do_check_eq(noOfUploads, Math.ceil(234 / MAX_UPLOAD_RECORDS));
 
   } finally {
     await cleanAndGo(engine, server);
   }
 });
 
-async function createRecordFailTelemetry(allowSkippedRecord) {
-  Service.identity.username = "foo";
-  let collection = new ServerCollection();
-  collection._wbos.flying = new ServerWBO("flying");
-  collection._wbos.scotsman = new ServerWBO("scotsman");
-
-  let server = sync_httpd_setup({
-      "/1.1/foo/storage/rotary": collection.handler()
-  });
-
-  await SyncTestingInfrastructure(server);
-
-  let engine = makeRotaryEngine();
-  engine.allowSkippedRecord = allowSkippedRecord;
-  let oldCreateRecord = engine._store.createRecord;
-  engine._store.createRecord = (id, collection) => {
-    if (id != "flying") {
-      throw new Error("oops");
-    }
-    return oldCreateRecord.call(engine._store, id, collection);
-  }
-  engine.lastSync = 123; // needs to be non-zero so that tracker is queried
-  engine._store.items = {flying: "LNER Class A3 4472",
-                         scotsman: "Flying Scotsman"};
-  // Mark these records as changed
-  const FLYING_CHANGED = 12345;
-  const SCOTSMAN_CHANGED = 23456;
-  engine._tracker.addChangedID("flying", FLYING_CHANGED);
-  engine._tracker.addChangedID("scotsman", SCOTSMAN_CHANGED);
-
-  let meta_global = Service.recordManager.set(engine.metaURL,
-                                              new WBORecord(engine.metaURL));
-  meta_global.payload.engines = {rotary: {version: engine.version,
-                                         syncID: engine.syncID}};
-
-  let ping;
-  try {
-    // Confirm initial environment
-    do_check_eq(engine.lastSyncLocal, 0);
-    do_check_eq(collection.payload("flying"), undefined);
-    do_check_eq(engine._tracker.changedIDs["flying"], FLYING_CHANGED);
-    do_check_eq(engine._tracker.changedIDs["scotsman"], SCOTSMAN_CHANGED);
-
-    engine.enabled = true;
-    ping = await sync_engine_and_validate_telem(engine, true, onErrorPing => {
-      ping = onErrorPing;
-    });
-
-    if (!allowSkippedRecord) {
-      do_throw("should not get here");
-    }
-
-    // Ensure the 'flying' record has been uploaded and is no longer marked.
-    do_check_true(!!collection.payload("flying"));
-    do_check_eq(engine._tracker.changedIDs["flying"], undefined);
-  } catch (err) {
-    if (allowSkippedRecord) {
-      do_throw("should not get here");
-    }
-
-    // Ensure the 'flying' record has not been uploaded and is still marked
-    do_check_false(collection.payload("flying"));
-    do_check_true(engine._tracker.changedIDs["flying"]);
-  } finally {
-    // Local timestamp has been set.
-    do_check_true(engine.lastSyncLocal > 0);
-
-    // We reported in telemetry that we failed a record
-    do_check_eq(ping.engines[0].outgoing[0].failed, 1);
-
-    // In any case, the 'scotsman' record couldn't be created so it wasn't
-    // uploaded nor it was not cleared from the tracker.
-    do_check_false(collection.payload("scotsman"));
-    do_check_eq(engine._tracker.changedIDs["scotsman"], SCOTSMAN_CHANGED);
-
-    engine._store.createRecord = oldCreateRecord;
-    await promiseClean(engine, server);
-  }
-}
-
-add_task(async function test_uploadOutgoing_createRecord_throws_reported_telemetry() {
-  _("SyncEngine._uploadOutgoing reports a failed record to telemetry if createRecord throws");
-  await createRecordFailTelemetry(true);
-});
-
-add_task(async function test_uploadOutgoing_createRecord_throws_dontAllowSkipRecord() {
-  _("SyncEngine._uploadOutgoing will throw if createRecord throws and allowSkipRecord is set to false");
-  await createRecordFailTelemetry(false);
-});
-
 add_task(async function test_uploadOutgoing_largeRecords() {
   _("SyncEngine._uploadOutgoing throws on records larger than MAX_UPLOAD_BYTES");
 
   let collection = new ServerCollection();
 
   let engine = makeRotaryEngine();
   engine.allowSkippedRecord = false;
   engine._store.items["large-item"] = "Y".repeat(MAX_UPLOAD_BYTES * 2);