Bug 1190627 - Part 4 - Add telemetry probe for measuring how often we restore from the backup session copy. r=sebastian draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Wed, 01 Jun 2016 22:04:59 +0200
changeset 401234 dd7f34b4ea5c7fedb8c636ca600f954c1c1104f7
parent 401233 1eac3223c9c285fa327e084aa5e0ada566c539c9
child 528441 ccf41cd499b5e9cb74231a65bab66dbe753d3dce
push id26408
push usermozilla@buttercookie.de
push dateTue, 16 Aug 2016 18:08:19 +0000
reviewerssebastian
bugs1190627
milestone51.0a1
Bug 1190627 - Part 4 - Add telemetry probe for measuring how often we restore from the backup session copy. r=sebastian By comparing the rates for FENNEC_SESSIONSTORE_DAMAGED_SESSION_FILE and this new probe, we might be able to infer whether there is a failure mode for the session store where the main session store file is completely lost after an interrupted write and doesn't exist even as an empty file of 0 bytes size. The first run case will be excluded, because in that case both the main and the backup session file won't exist, so neither telemetry probe will be triggered. MozReview-Commit-ID: JTR54Vk18jW
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
toolkit/components/telemetry/Histograms.json
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -1399,20 +1399,26 @@ public abstract class GeckoApp
                             // Since we will also hit this situation regularly during first run though,
                             // we'll only report it in telemetry if we failed to restore despite the
                             // file existing, which means it's very probably damaged.
                             if (getProfile().sessionFileExists()) {
                                 Telemetry.addToHistogram("FENNEC_SESSIONSTORE_DAMAGED_SESSION_FILE", 1);
                             }
                             try {
                                 restoreMessage = restoreSessionTabs(isExternalURL, true);
+                                Telemetry.addToHistogram("FENNEC_SESSIONSTORE_RESTORING_FROM_BACKUP", 1);
                             } catch (SessionRestoreException ex) {
-                                // If this fails, too, do a normal startup.
-                                Log.e(LOGTAG, "An error occurred during restore", ex);
-                                mShouldRestore = false;
+                                if (!mShouldRestore) {
+                                    // Restoring only "failed" because the backup copy was deliberately empty, too.
+                                    Telemetry.addToHistogram("FENNEC_SESSIONSTORE_RESTORING_FROM_BACKUP", 1);
+                                } else {
+                                    // Restoring the backup failed, too, so do a normal startup.
+                                    Log.e(LOGTAG, "An error occurred during restore", ex);
+                                    mShouldRestore = false;
+                                }
                             }
                         }
                     }
                 }
 
                 synchronized (GeckoApp.this) {
                     mSessionRestoreParsingFinished = true;
                     GeckoApp.this.notifyAll();
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -9846,10 +9846,18 @@
   },
   "FENNEC_SESSIONSTORE_DAMAGED_SESSION_FILE": {
     "alert_emails": ["jh+bugzilla@buttercookie.de"],
     "expires_in_version": "56",
     "kind": "flag",
     "bug_numbers": [1284017],
     "description": "When restoring tabs on startup, reading from sessionstore.js failed, even though the file exists and is not containing an explicitly empty window.",
     "cpp_guard": "ANDROID"
+  },
+  "FENNEC_SESSIONSTORE_RESTORING_FROM_BACKUP": {
+    "alert_emails": ["jh+bugzilla@buttercookie.de"],
+    "expires_in_version": "56",
+    "kind": "flag",
+    "bug_numbers": [1190627],
+    "description": "When restoring tabs on startup, reading from sessionstore.js failed, but sessionstore.bak was read successfully.",
+    "cpp_guard": "ANDROID"
   }
 }