diff options
author | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-22 01:04:18 +0000 |
---|---|---|
committer | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-22 01:04:18 +0000 |
commit | 14c8f6359e00f22043ff52c68c3bdd81bb72aef2 (patch) | |
tree | b7cd54ac4e695fd15177fcd17633c619c9e61c36 /sync/syncable/dir_open_result.h | |
parent | 86feb4531d767b1493a03bee051e13a2e878c14f (diff) | |
download | chromium_src-14c8f6359e00f22043ff52c68c3bdd81bb72aef2.zip chromium_src-14c8f6359e00f22043ff52c68c3bdd81bb72aef2.tar.gz chromium_src-14c8f6359e00f22043ff52c68c3bdd81bb72aef2.tar.bz2 |
Update next_id when loading sync DB
The directory code is smart enough to maintain a bit of extra slack in
the next_id so we don't accidentally reuse IDs if we crash. However,
it only works after we've saved changes to the directory at least once.
This change ensures that we save changes immediately after we load the
directory, so that we can recover from crashes that occur before we
would otherwise save changes due to natural causes.
This won't do anything to help users who've gotten into a bad state
because next_id was corrupted by an early crash, but it will prevent us
from corrupting databases in the future.
BUG=142987
TEST=See below:
Examine 'next_id' in sync DB. Open chrome and close it within two to
ten seconds. Verify 'next_id' has been incremented.
Review URL: https://chromiumcodereview.appspot.com/10832329
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152706 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/syncable/dir_open_result.h')
-rw-r--r-- | sync/syncable/dir_open_result.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sync/syncable/dir_open_result.h b/sync/syncable/dir_open_result.h index 222be8b..0df3c6c 100644 --- a/sync/syncable/dir_open_result.h +++ b/sync/syncable/dir_open_result.h @@ -16,6 +16,7 @@ enum DirOpenResult { NOT_INITIALIZED, FAILED_DATABASE_CORRUPT, // Something is wrong with the DB FAILED_LOGICAL_CORRUPTION, // Invalid database contents FAILED_IN_UNITTEST, // For tests. + FAILED_INITIAL_WRITE, // Early write to DB failed. }; } // namespace syncable } // namespace syncer |