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

Issue 8475017: Check node references during sync DB init (Closed)

Created:
9 years, 1 month ago by rlarocque
Modified:
9 years, 1 month ago
CC:
chromium-reviews, Raghu Simha, ncarter (slow), akalin, Nicolas Zea
Visibility:
Public.

Description

Check node references during sync DB init This commit adds a check to verify that the NEXT_ID, PREV_ID and PARENT_ID fields of nodes in the database point to the IDs of other existing nodes. The syncable::Database code assumes that this invariant always holds and seems to do a good job of maintaining it. This change ensures that the invariant holds at the time the data is loaded from disk. There exist some corrupt databases that cause the directory to behave unpredictably, since the code assumes the databsae is correct when it is read from disk. We can't do anything to fix those databases now that they've been written, but we can detect the corruption and recreate the affected databases. This check is implemented using a set of hash maps, so the cost of the check should scale well with the number of nodes (it's O(n)). The per-node cost of this check also seems cheap compared to the disc access. In release mode, loading 5000 nodes from a (probably in-cache) sqlite database took 53ms, while the check took 9 ms. BUG=101048 TEST=Manual. Corrupted the database with external sqlite tool, verified that the database was deleted and re-created next time Chrome was loaded. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=111033

Patch Set 1 #

Patch Set 2 : Take action when corruption is detected #

Patch Set 3 : Smaller patch, relies on other fixes #

Total comments: 3

Patch Set 4 : Respond to review comments #

Total comments: 1

Patch Set 5 : Remove unintentionally uploaded change #

Patch Set 6 : Use hash_set<std::string> because custom traits are not standardized #

Patch Set 7 : More win compile fixes #

Patch Set 8 : Fix merge conflicts #

Unified diffs Side-by-side diffs Delta from patch set Stats (+47 lines, -0 lines) Patch
M chrome/browser/sync/syncable/dir_open_result.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/sync/syncable/syncable.cc View 1 2 3 4 5 6 7 4 chunks +41 lines, -0 lines 0 comments Download
M chrome/browser/sync/syncable/syncable_id.h View 1 2 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 21 (0 generated)
rlarocque
My plan was to fix issue 103307 then commit this change. However, it looks like ...
9 years, 1 month ago (2011-11-09 21:56:15 UTC) #1
rlarocque
9 years, 1 month ago (2011-11-09 21:58:31 UTC) #2
rlarocque
Please disregard this review request for now. There are two serious issues with it that ...
9 years, 1 month ago (2011-11-10 21:31:48 UTC) #3
rlarocque
Reduce scope back to what it was in patch set #1, but retain the Windows ...
9 years, 1 month ago (2011-11-11 23:27:57 UTC) #4
tim (not reviewing)
http://codereview.chromium.org/8475017/diff/8001/chrome/browser/sync/syncable/syncable.cc File chrome/browser/sync/syncable/syncable.cc (right): http://codereview.chromium.org/8475017/diff/8001/chrome/browser/sync/syncable/syncable.cc#newcode71 chrome/browser/sync/syncable/syncable.cc:71: bool VerifyReferenceIntegrity(const syncable::MetahandlesIndex &index) { Should append 'Unsafe' to ...
9 years, 1 month ago (2011-11-14 19:23:44 UTC) #5
rlarocque
http://codereview.chromium.org/8475017/diff/8001/chrome/browser/sync/syncable/syncable.cc File chrome/browser/sync/syncable/syncable.cc (right): http://codereview.chromium.org/8475017/diff/8001/chrome/browser/sync/syncable/syncable.cc#newcode71 chrome/browser/sync/syncable/syncable.cc:71: bool VerifyReferenceIntegrity(const syncable::MetahandlesIndex &index) { On 2011/11/14 19:23:44, timsteele ...
9 years, 1 month ago (2011-11-14 22:05:10 UTC) #6
tim (not reviewing)
On 2011/11/14 22:05:10, rlarocque wrote: > http://codereview.chromium.org/8475017/diff/8001/chrome/browser/sync/syncable/syncable.cc > File chrome/browser/sync/syncable/syncable.cc (right): > > http://codereview.chromium.org/8475017/diff/8001/chrome/browser/sync/syncable/syncable.cc#newcode71 > ...
9 years, 1 month ago (2011-11-14 22:16:22 UTC) #7
rlarocque
On 2011/11/14 22:16:22, timsteele wrote: > On 2011/11/14 22:05:10, rlarocque wrote: > > > http://codereview.chromium.org/8475017/diff/8001/chrome/browser/sync/syncable/syncable.cc ...
9 years, 1 month ago (2011-11-14 23:05:14 UTC) #8
rlarocque
I had delayed sending the e-mail for this review because it depends on http://codereview.chromium.org/8496002/. That ...
9 years, 1 month ago (2011-11-15 21:40:56 UTC) #9
tim (not reviewing)
LGTM http://codereview.chromium.org/8475017/diff/14001/chrome/browser/sync/syncable/directory_manager.cc File chrome/browser/sync/syncable/directory_manager.cc (right): http://codereview.chromium.org/8475017/diff/14001/chrome/browser/sync/syncable/directory_manager.cc#newcode83 chrome/browser/sync/syncable/directory_manager.cc:83: dir.reset(new Directory); style nit - use Directory()
9 years, 1 month ago (2011-11-17 18:39:57 UTC) #10
rlarocque
On 2011/11/17 18:39:57, timsteele wrote: > LGTM > > http://codereview.chromium.org/8475017/diff/14001/chrome/browser/sync/syncable/directory_manager.cc > File chrome/browser/sync/syncable/directory_manager.cc (right): > ...
9 years, 1 month ago (2011-11-17 19:13:29 UTC) #11
rlarocque
That's better. The latest upload is much closer to patch set #3.
9 years, 1 month ago (2011-11-17 19:59:50 UTC) #12
tim (not reviewing)
LGTM++
9 years, 1 month ago (2011-11-17 21:21:09 UTC) #13
rlarocque
The previous patch didn't compile on Windows because of differences in the definition of hash_set's ...
9 years, 1 month ago (2011-11-18 19:49:38 UTC) #14
tim (not reviewing)
still LGTM
9 years, 1 month ago (2011-11-19 00:23:40 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rlarocque@chromium.org/8475017/30001
9 years, 1 month ago (2011-11-19 00:28:31 UTC) #16
commit-bot: I haz the power
Try job failure for 8475017-30001 (retry) on win_rel for step "compile" (clobber build). It's a ...
9 years, 1 month ago (2011-11-19 01:03:23 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rlarocque@chromium.org/8475017/30001
9 years, 1 month ago (2011-11-21 18:55:42 UTC) #18
commit-bot: I haz the power
Can't apply patch for file chrome/browser/sync/syncable/syncable.cc. While running patch -p1 --forward --force; patching file chrome/browser/sync/syncable/syncable.cc ...
9 years, 1 month ago (2011-11-21 18:55:44 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rlarocque@chromium.org/8475017/34001
9 years, 1 month ago (2011-11-21 21:32:44 UTC) #20
commit-bot: I haz the power
9 years, 1 month ago (2011-11-21 23:18:00 UTC) #21
Change committed as 111033

Powered by Google App Engine
This is Rietveld 408576698