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

Issue 10832329: Update next_id when loading sync DB (Closed)

Created:
8 years, 4 months ago by rlarocque
Modified:
8 years, 4 months ago
Reviewers:
Nicolas Zea
CC:
chromium-reviews
Visibility:
Public.

Description

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. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=152706

Patch Set 1 #

Total comments: 4

Patch Set 2 : Tests and fixes #

Total comments: 1

Patch Set 3 : Fix unit tests #

Total comments: 11

Patch Set 4 : Address review comments #

Total comments: 4

Patch Set 5 : Some fixes #

Patch Set 6 : Fixes + Rebase #

Patch Set 7 : Fix win compile #

Unified diffs Side-by-side diffs Delta from patch set Stats (+158 lines, -50 lines) Patch
M sync/syncable/dir_open_result.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M sync/syncable/directory.cc View 1 2 1 chunk +8 lines, -0 lines 0 comments Download
M sync/syncable/syncable_unittest.cc View 1 2 3 4 5 6 9 chunks +149 lines, -50 lines 0 comments Download

Messages

Total messages: 15 (0 generated)
rlarocque
Please review.
8 years, 4 months ago (2012-08-16 00:36:14 UTC) #1
Nicolas Zea
http://codereview.chromium.org/10832329/diff/1/sync/syncable/dir_open_result.h File sync/syncable/dir_open_result.h (right): http://codereview.chromium.org/10832329/diff/1/sync/syncable/dir_open_result.h#newcode19 sync/syncable/dir_open_result.h:19: FAILED_INITIAL_WRITE, comment about why we care? http://codereview.chromium.org/10832329/diff/1/sync/syncable/directory.cc File sync/syncable/directory.cc ...
8 years, 4 months ago (2012-08-16 20:40:10 UTC) #2
Nicolas Zea
Also, how tough would it be to add unit tests for this class?
8 years, 4 months ago (2012-08-16 20:40:34 UTC) #3
rlarocque
On 2012/08/16 20:40:34, nzea wrote: > Also, how tough would it be to add unit ...
8 years, 4 months ago (2012-08-17 17:59:41 UTC) #4
rlarocque
http://codereview.chromium.org/10832329/diff/1/sync/syncable/dir_open_result.h File sync/syncable/dir_open_result.h (right): http://codereview.chromium.org/10832329/diff/1/sync/syncable/dir_open_result.h#newcode19 sync/syncable/dir_open_result.h:19: FAILED_INITIAL_WRITE, On 2012/08/16 20:40:10, nzea wrote: > comment about ...
8 years, 4 months ago (2012-08-17 18:02:07 UTC) #5
Nicolas Zea
LGTM http://codereview.chromium.org/10832329/diff/7001/sync/syncable/directory.cc File sync/syncable/directory.cc (right): http://codereview.chromium.org/10832329/diff/7001/sync/syncable/directory.cc#newcode212 sync/syncable/directory.cc:212: if (!SaveChanges()) { nit: remove curly braces
8 years, 4 months ago (2012-08-17 18:09:27 UTC) #6
rlarocque
It was supposed to be simple. This patch has now grown by a factor of ...
8 years, 4 months ago (2012-08-17 22:03:03 UTC) #7
Nicolas Zea
http://codereview.chromium.org/10832329/diff/9001/sync/syncable/syncable_unittest.cc File sync/syncable/syncable_unittest.cc (right): http://codereview.chromium.org/10832329/diff/9001/sync/syncable/syncable_unittest.cc#newcode1264 sync/syncable/syncable_unittest.cc:1264: TEST_F(SyncableDirectoryTest, LocalIdReuseTestWithSave) { is this really testing anything different ...
8 years, 4 months ago (2012-08-21 00:26:35 UTC) #8
rlarocque
http://codereview.chromium.org/10832329/diff/9001/sync/syncable/syncable_unittest.cc File sync/syncable/syncable_unittest.cc (right): http://codereview.chromium.org/10832329/diff/9001/sync/syncable/syncable_unittest.cc#newcode1264 sync/syncable/syncable_unittest.cc:1264: TEST_F(SyncableDirectoryTest, LocalIdReuseTestWithSave) { On 2012/08/21 00:26:35, nzea wrote: > ...
8 years, 4 months ago (2012-08-21 00:54:35 UTC) #9
Nicolas Zea
LGTM http://codereview.chromium.org/10832329/diff/9001/sync/syncable/syncable_unittest.cc File sync/syncable/syncable_unittest.cc (right): http://codereview.chromium.org/10832329/diff/9001/sync/syncable/syncable_unittest.cc#newcode1264 sync/syncable/syncable_unittest.cc:1264: TEST_F(SyncableDirectoryTest, LocalIdReuseTestWithSave) { On 2012/08/21 00:54:35, rlarocque wrote: ...
8 years, 4 months ago (2012-08-21 01:08:56 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rlarocque@chromium.org/10832329/5003
8 years, 4 months ago (2012-08-21 18:19:31 UTC) #11
rlarocque
http://codereview.chromium.org/10832329/diff/8002/sync/syncable/syncable_unittest.cc File sync/syncable/syncable_unittest.cc (right): http://codereview.chromium.org/10832329/diff/8002/sync/syncable/syncable_unittest.cc#newcode1451 sync/syncable/syncable_unittest.cc:1451: ASSERT_EQ(OPENED, dir_->Open(kName, &delegate_, On 2012/08/21 01:08:56, nzea wrote: > ...
8 years, 4 months ago (2012-08-21 18:27:29 UTC) #12
commit-bot: I haz the power
Try job failure for 10832329-5003 (retry) on linux_chromeos for steps "interactive_ui_tests, browser_tests, unit_tests". It's a ...
8 years, 4 months ago (2012-08-21 18:58:28 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rlarocque@chromium.org/10832329/12006
8 years, 4 months ago (2012-08-21 22:23:23 UTC) #14
commit-bot: I haz the power
8 years, 4 months ago (2012-08-22 01:04:21 UTC) #15
Change committed as 152706

Powered by Google App Engine
This is Rietveld 408576698