Bug 1595935 - Remove a couple of long expired telemetry probes from the permission manager; r=baku
authorEhsan Akhgari <ehsan@mozilla.com>
Sun, 17 Nov 2019 07:22:02 +0000
changeset 502346 d057aee5120ff2d216e33e4ebcfe6ea92a0d29f6
parent 502345 afe80b4ff889ef7e63982b70a267d37bb38393e1
child 502347 04cd216d7e69f37dbdf74e4993b0e283d4b39283
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1595935
milestone72.0a1
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
Bug 1595935 - Remove a couple of long expired telemetry probes from the permission manager; r=baku Differential Revision: https://phabricator.services.mozilla.com/D52762
extensions/permissions/nsPermissionManager.cpp
toolkit/components/telemetry/Histograms.json
toolkit/components/telemetry/histogram-allowlists.json
--- a/extensions/permissions/nsPermissionManager.cpp
+++ b/extensions/permissions/nsPermissionManager.cpp
@@ -1308,18 +1308,16 @@ nsresult nsPermissionManager::InitDB(boo
       // backwards compatability), and a moz_perms table. The moz_hosts table
       // will have a v4 schema, and the moz_perms table will have a v6 schema.
       case 4:
       case 6: {
         bool hostsTableExists = false;
         mDBConn->TableExists(NS_LITERAL_CSTRING("moz_hosts"),
                              &hostsTableExists);
         if (hostsTableExists) {
-          bool migrationError = false;
-
           // Both versions 4 and 6 have a version 4 formatted hosts table named
           // moz_hosts. We can migrate this table to our version 7 table
           // moz_perms. If moz_perms is present, then we can use it as a basis
           // for comparison.
 
           rv = mDBConn->BeginTransaction();
           NS_ENSURE_SUCCESS(rv, rv);
 
@@ -1362,22 +1360,20 @@ nsresult nsPermissionManager::InitDB(boo
           int64_t modificationTime;
           bool isInBrowserElement;
           bool hasResult;
 
           while (NS_SUCCEEDED(stmt->ExecuteStep(&hasResult)) && hasResult) {
             // Read in the old row
             rv = stmt->GetUTF8String(0, host);
             if (NS_WARN_IF(NS_FAILED(rv))) {
-              migrationError = true;
               continue;
             }
             rv = stmt->GetUTF8String(1, type);
             if (NS_WARN_IF(NS_FAILED(rv))) {
-              migrationError = true;
               continue;
             }
             permission = stmt->AsInt32(2);
             expireType = stmt->AsInt32(3);
             expireTime = stmt->AsInt64(4);
             modificationTime = stmt->AsInt64(5);
             isInBrowserElement = static_cast<bool>(stmt->AsInt32(6));
 
@@ -1386,17 +1382,16 @@ nsresult nsPermissionManager::InitDB(boo
             UpgradeHostToOriginDBMigration upHelper(mDBConn, &id);
             rv = UpgradeHostToOriginAndInsert(
                 host, type, permission, expireType, expireTime,
                 modificationTime, isInBrowserElement, &upHelper);
             if (NS_FAILED(rv)) {
               NS_WARNING(
                   "Unexpected failure when upgrading migrating permission "
                   "from host to origin");
-              migrationError = true;
             }
           }
 
           // We don't drop the moz_hosts table such that it is available for
           // backwards-compatability and for future migrations in case of
           // migration errors in the current code.
           // Create a marker empty table which will indicate that the moz_hosts
           // table is intended to act as a backup. If this table is not present,
@@ -1413,58 +1408,34 @@ nsresult nsPermissionManager::InitDB(boo
             // re-migration. We count the rows in the old table for telemetry,
             // and then back up their old database as moz_perms_v6
 
             nsCOMPtr<mozIStorageStatement> countStmt;
             rv = mDBConn->CreateStatement(
                 NS_LITERAL_CSTRING("SELECT COUNT(*) FROM moz_perms"),
                 getter_AddRefs(countStmt));
             bool hasResult = false;
-            if (NS_SUCCEEDED(rv) &&
-                NS_SUCCEEDED(countStmt->ExecuteStep(&hasResult)) && hasResult) {
-              int32_t permsCount = countStmt->AsInt32(0);
-
-              // The id variable contains the number of rows inserted into the
-              // moz_hosts_new table (as one ID was used per entry)
-              uint32_t telemetryValue;
-              if (permsCount > id) {
-                telemetryValue = 3;  // NEW > OLD
-              } else if (permsCount == id) {
-                telemetryValue = 2;  // NEW == OLD
-              } else if (permsCount == 0) {
-                telemetryValue = 0;  // NEW = 0
-              } else {
-                telemetryValue = 1;  // NEW < OLD
-              }
-
-              // Report the telemetry value to telemetry
-              mozilla::Telemetry::Accumulate(
-                  mozilla::Telemetry::PERMISSIONS_REMIGRATION_COMPARISON,
-                  telemetryValue);
-            } else {
+            if (NS_FAILED(rv) ||
+                NS_FAILED(countStmt->ExecuteStep(&hasResult)) || !hasResult) {
               NS_WARNING("Could not count the rows in moz_perms");
             }
 
             // Back up the old moz_perms database as moz_perms_v6 before we
             // move the new table into its position
             rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
                 "ALTER TABLE moz_perms RENAME TO moz_perms_v6"));
             NS_ENSURE_SUCCESS(rv, rv);
           }
 
           rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
               "ALTER TABLE moz_hosts_new RENAME TO moz_perms"));
           NS_ENSURE_SUCCESS(rv, rv);
 
           rv = mDBConn->CommitTransaction();
           NS_ENSURE_SUCCESS(rv, rv);
-
-          mozilla::Telemetry::Accumulate(
-              mozilla::Telemetry::PERMISSIONS_MIGRATION_7_ERROR,
-              NS_WARN_IF(migrationError));
         } else {
           // We don't have a moz_hosts table, so we create one for downgrading
           // purposes. This table is empty.
           rv = mDBConn->ExecuteSimpleSQL(
               NS_LITERAL_CSTRING("CREATE TABLE moz_hosts ("
                                  " id INTEGER PRIMARY KEY"
                                  ",host TEXT"
                                  ",type TEXT"
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -12683,33 +12683,16 @@
   },
   "SHOULD_AUTO_DETECT_LANGUAGE": {
     "record_in_processes": ["main", "content"],
     "products": ["firefox", "fennec", "geckoview"],
     "expires_in_version": "default",
     "kind": "flag",
     "description": "Tracks situations when the user opts for auto-detecting the language of a page"
   },
-  "PERMISSIONS_REMIGRATION_COMPARISON": {
-    "record_in_processes": ["main", "content"],
-    "products": ["firefox", "fennec", "geckoview"],
-    "alert_emails": ["nika@thelayzells.com"],
-    "expires_in_version": "44",
-    "kind": "enumerated",
-    "n_values": 10,
-    "description": "Reports a comparison between row count of original and re-migration of the v7 permissions DB. 0=New == 0, 1=New < Old, 2=New == Old, 3=New > Old"
-  },
-  "PERMISSIONS_MIGRATION_7_ERROR": {
-    "record_in_processes": ["main", "content"],
-    "products": ["firefox", "fennec", "geckoview"],
-    "alert_emails": ["nika@thelayzells.com"],
-    "expires_in_version": "44",
-    "kind": "boolean",
-    "description": "Was there an error while performing the v7 permissions DB migration?"
-  },
   "VIDEO_EME_REQUEST_SUCCESS_LATENCY_MS": {
     "record_in_processes": ["main", "content"],
     "products": ["firefox", "fennec", "geckoview"],
     "alert_emails": ["jya@mozilla.com", "drno@ohlmeier.org"],
     "expires_in_version": "63",
     "kind": "exponential",
     "high": 60000,
     "n_buckets": 60,
--- a/toolkit/components/telemetry/histogram-allowlists.json
+++ b/toolkit/components/telemetry/histogram-allowlists.json
@@ -745,18 +745,16 @@
     "ONBEFOREUNLOAD_PROMPT_ACTION",
     "ONBEFOREUNLOAD_PROMPT_COUNT",
     "OSFILE_WORKER_LAUNCH_MS",
     "OSFILE_WORKER_READY_MS",
     "OSFILE_WRITEATOMIC_JANK_MS",
     "PAGE_FAULTS_HARD",
     "PAINT_BUILD_DISPLAYLIST_TIME",
     "PAINT_RASTERIZE_TIME",
-    "PERMISSIONS_MIGRATION_7_ERROR",
-    "PERMISSIONS_REMIGRATION_COMPARISON",
     "PERMISSIONS_SQL_CORRUPTED",
     "PLACES_ANNOS_BOOKMARKS_COUNT",
     "PLACES_ANNOS_PAGES_COUNT",
     "PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS",
     "PLACES_AUTOCOMPLETE_URLINLINE_DOMAIN_QUERY_TIME_MS",
     "PLACES_BACKUPS_BOOKMARKSTREE_MS",
     "PLACES_BACKUPS_DAYSFROMLAST",
     "PLACES_BACKUPS_TOJSON_MS",