Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Unified Diff: sync/syncable/directory.cc

Issue 10832329: Update next_id when loading sync DB (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« sync/syncable/dir_open_result.h ('K') | « sync/syncable/dir_open_result.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/syncable/directory.cc
diff --git a/sync/syncable/directory.cc b/sync/syncable/directory.cc
index 9348338925f114f2e8052c7323fc4f30bebf0255..34df6da140ed78b4b063d3c55aca3a902bd235a5 100644
--- a/sync/syncable/directory.cc
+++ b/sync/syncable/directory.cc
@@ -204,6 +204,15 @@ DirOpenResult Directory::OpenImpl(
kernel_ = new Kernel(name, info, delegate, transaction_observer);
kernel_->metahandles_index->swap(metas_bucket);
InitializeIndices();
+
+ // Write back the share info to reserve some space in 'next_id'. This will
+ // prevent local ID reuse in the case of an early crash. See the comments in
+ // TakeSnapshotForSaveChanges() or crbug.com/142987 for more information.
+ kernel_->info_status = KERNEL_SHARE_INFO_DIRTY;
+ if (!SaveChanges()) {
+ result = FAILED_INITIAL_WRITE;
Nicolas Zea 2012/08/16 20:40:10 return FAILED_INITIAL_WRITE?
rlarocque 2012/08/17 18:02:07 Wow, that was a dumb mistake. Fixed. Unfortunate
+ }
+
return OPENED;
}
« sync/syncable/dir_open_result.h ('K') | « sync/syncable/dir_open_result.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698