Bug 746035 - Bail out of Profile Migration on errors. r=lucasr a=blocking-fennec
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Thu, 19 Apr 2012 16:41:53 +0200
changeset 95274 12a595c5d7a40ec2e3a9d46d45b28a136060ea8a
parent 95273 2d335134f808ee73bfff826989ff430b90e95185
child 95275 a9ee797ccd070edaae8a75cb8e786e8af9b6354b
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslucasr, blocking-fennec
bugs746035
milestone14.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 746035 - Bail out of Profile Migration on errors. r=lucasr a=blocking-fennec
mobile/android/base/ProfileMigrator.java
--- a/mobile/android/base/ProfileMigrator.java
+++ b/mobile/android/base/ProfileMigrator.java
@@ -270,17 +270,18 @@ public class ProfileMigrator {
 
     // Have Sync settings been transferred?
     public boolean hasSyncMigrated() {
         return getPreferences().getBoolean(PREFS_MIGRATE_SYNC_DONE, false);
     }
 
     // Has migration run before?
     protected boolean hasMigrationRun() {
-        return areBookmarksMigrated() && (getMigratedHistoryEntries() > 0);
+        return areBookmarksMigrated()
+            && ((getMigratedHistoryEntries() > 0) || isHistoryMigrated());
     }
 
     // Has migration entirely finished?
     protected boolean hasMigrationFinished() {
         return areBookmarksMigrated() && isHistoryMigrated();
     }
 
     protected SharedPreferences getPreferences() {
@@ -573,16 +574,18 @@ public class ProfileMigrator {
                     mRerootMap.put(placesFolderId, getFolderId(name));
                     Log.v(LOGTAG, "Name: " + name + ", pid=" + placesFolderId
                           + ", nid=" + mRerootMap.get(placesFolderId));
                     cursor.moveToNext();
                 }
                 cursor.close();
             } catch (SQLiteBridgeException e) {
                 Log.e(LOGTAG, "Failed to get bookmark roots: ", e);
+                // Do not try again.
+                setMigratedBookmarks();
                 return;
             }
         }
 
         protected void updateBrowserHistory(String url, String title,
                                             long date, int visits) {
             Cursor cursor = null;
 
@@ -784,16 +787,18 @@ public class ProfileMigrator {
                     } catch (Exception e) {
                         Log.e(LOGTAG, "Error adding history entry: ", e);
                     }
                     cursor.moveToNext();
                 }
                 cursor.close();
             } catch (SQLiteBridgeException e) {
                 Log.e(LOGTAG, "Failed to get history: ", e);
+                // Do not try again.
+                setMigratedHistory();
                 return;
             }
 
             flushBatchOperations();
 
             int totalEntries = currentEntries + queryResultEntries;
             setMigratedHistoryEntries(totalEntries);
 
@@ -1032,16 +1037,18 @@ public class ProfileMigrator {
                     iterations++;
                     Log.i(LOGTAG, "Iteration = " + iterations + ", added " + added +
                           " bookmark(s), skipped " + skipped + " bookmark(s)");
                 } while (!openFolders.isEmpty());
 
                 cursor.close();
             } catch (SQLiteBridgeException e) {
                 Log.e(LOGTAG, "Failed to get bookmarks: ", e);
+                // Do not try again.
+                setMigratedBookmarks();
                 return;
             }
 
             flushBatchOperations();
         }
 
         protected void flushBatchOperations() {
             Log.i(LOGTAG, "Flushing " + mOperations.size() + " DB operations");