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

Issue 8725014: Merge 111033 - Check node references during sync DB init (Closed)

Created:
9 years ago by rlarocque
Modified:
9 years ago
Reviewers:
rlarocque
CC:
chromium-reviews, Raghu Simha, ncarter (slow), tim (not reviewing), idana
Visibility:
Public.

Description

Merge 111033 - 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. Review URL: http://codereview.chromium.org/8475017 TBR=rlarocque@chromium.org Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=111791

Patch Set 1 #

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

Messages

Total messages: 1 (0 generated)
rlarocque
9 years ago (2011-11-28 22:29:16 UTC) #1

          

Powered by Google App Engine
This is Rietveld 408576698