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

Issue 1226213002: Sync: Support nodes with implicit permanent folders: Node Browser and out-of-order loading from DB (Closed)

Created:
5 years, 5 months ago by stanisc
Modified:
5 years, 5 months ago
CC:
chromium-reviews, tim+watch_chromium.org, zea+watch_chromium.org, maxbogue+watch_chromium.org, pvalenzuela+watch_chromium.org, plaree+watch_chromium.org, arv+watch_chromium.org, maniscalco+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Sync: Support nodes with implicit permanent folders: Node Browser and out-of-order loading from DB The fix contains two parts: 1) Changed Sync Node Browser code to handle nodes with unset PARENT_ID. The parent ID would be unset only for nodes with flat hierarchy where all the nodes are under the same type root folder. In that case the parent-child relationship is determined based on the node's model type. EntryKernel::ToValue already generated serverModelType field, although it would be unset for nodes that never synced to the server. To make it more reliable I changed the field to modelType and added the code to set it based on combination of both server and client model type. Most of the change deals with renaming serverModelType to modelType. 2) When testing the issue #1 with an older account I noticed issues with ParentChildIndex not associating a few nodes (with implicit Parent ID) correctly with their corresponding permanent folders. The issue turned out to be caused by an arbitrary out-of-order loading of nodes from the database. When a node with unset Parent ID was inserted before its permanent folder, ParentChildIndex would place it in the OrderedChildSet associated with empty ("") ParentID and this node would essentially be invisible for the rest of the code querying the index. To handle this out-of-order insertion correctly, I changed data organization in ParentChildIndex. There now two data structures: a) Parent ID to OrderedChildSet map is still used to organize collections of children for types with explicit Parent ID like bookmarks. b) There is also an array of OrderedChildSet indexed by model type which contains flat collections of entries for non-hierarchical types. c) The latter type of collections are also shared with the Parent ID to OrderedChildSet map so that querying by Parent ID still works non-hierarchical types. The sharing occurs when the index sees an entry that it recognizes as a type root folder. BUG=438313 TBR=nkostylev@chromium.org Committed: https://crrev.com/c2b13973453530ab01e92fee880e14b34c0c420b Cr-Commit-Position: refs/heads/master@{#338364}

Patch Set 1 #

Patch Set 2 : Fixed tests #

Patch Set 3 : Fixed memory leak #

Total comments: 17

Patch Set 4 : Addressed CR feedback #

Total comments: 8

Patch Set 5 : Added <vector> include #

Patch Set 6 : Addressed second round of CR #

Total comments: 4

Patch Set 7 : Changed comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+235 lines, -96 lines) Patch
M chrome/browser/resources/sync_internals/data.js View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/resources/sync_internals/node_browser.html View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/resources/sync_internals/sync_node_browser.js View 3 chunks +22 lines, -17 lines 0 comments Download
M chrome/browser/ui/webui/sync_internals_browsertest.js View 2 chunks +2 lines, -2 lines 0 comments Download
M sync/internal_api/public/base/model_type.h View 1 chunk +6 lines, -0 lines 0 comments Download
M sync/internal_api/sync_manager_impl_unittest.cc View 1 2 chunks +2 lines, -2 lines 0 comments Download
M sync/internal_api/write_node.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M sync/syncable/entry_kernel.cc View 2 chunks +8 lines, -5 lines 0 comments Download
M sync/syncable/entry_kernel_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M sync/syncable/model_type.cc View 1 2 3 1 chunk +9 lines, -0 lines 0 comments Download
M sync/syncable/parent_child_index.h View 1 2 3 4 5 3 chunks +21 lines, -6 lines 0 comments Download
M sync/syncable/parent_child_index.cc View 1 2 3 4 5 6 3 chunks +139 lines, -57 lines 0 comments Download
M sync/syncable/parent_child_index_unittest.cc View 2 chunks +21 lines, -2 lines 0 comments Download

Messages

Total messages: 15 (3 generated)
stanisc
nkostylev@: Please review chrome/browser/ui/webui/sync_internals_browsertest.js zea@: Please review the rest of the change.
5 years, 5 months ago (2015-07-09 20:17:27 UTC) #2
stanisc
https://codereview.chromium.org/1226213002/diff/40001/sync/syncable/parent_child_index.cc File sync/syncable/parent_child_index.cc (right): https://codereview.chromium.org/1226213002/diff/40001/sync/syncable/parent_child_index.cc#newcode104 sync/syncable/parent_child_index.cc:104: // model type specific child set and now own ...
5 years, 5 months ago (2015-07-09 20:33:48 UTC) #3
Nicolas Zea
https://codereview.chromium.org/1226213002/diff/40001/sync/syncable/model_type.cc File sync/syncable/model_type.cc (right): https://codereview.chromium.org/1226213002/diff/40001/sync/syncable/model_type.cc#newcode1220 sync/syncable/model_type.cc:1220: return model_type == BOOKMARKS; should this include TOP_LEVEL_FOLDER? https://codereview.chromium.org/1226213002/diff/40001/sync/syncable/parent_child_index.cc ...
5 years, 5 months ago (2015-07-09 20:36:34 UTC) #4
stanisc
https://codereview.chromium.org/1226213002/diff/40001/sync/syncable/model_type.cc File sync/syncable/model_type.cc (right): https://codereview.chromium.org/1226213002/diff/40001/sync/syncable/model_type.cc#newcode1220 sync/syncable/model_type.cc:1220: return model_type == BOOKMARKS; On 2015/07/09 20:36:34, Nicolas Zea ...
5 years, 5 months ago (2015-07-09 21:45:17 UTC) #5
stanisc
Addressed CR feedback https://codereview.chromium.org/1226213002/diff/40001/sync/syncable/model_type.cc File sync/syncable/model_type.cc (right): https://codereview.chromium.org/1226213002/diff/40001/sync/syncable/model_type.cc#newcode1220 sync/syncable/model_type.cc:1220: return model_type == BOOKMARKS; On 2015/07/09 ...
5 years, 5 months ago (2015-07-09 23:59:27 UTC) #6
Nicolas Zea
Couple more comments https://codereview.chromium.org/1226213002/diff/60001/sync/syncable/parent_child_index.cc File sync/syncable/parent_child_index.cc (right): https://codereview.chromium.org/1226213002/diff/60001/sync/syncable/parent_child_index.cc#newcode56 sync/syncable/parent_child_index.cc:56: delete type_root_child_sets_[i]; Would a scoped_vector work? ...
5 years, 5 months ago (2015-07-10 00:12:58 UTC) #7
stanisc
https://codereview.chromium.org/1226213002/diff/60001/sync/syncable/parent_child_index.cc File sync/syncable/parent_child_index.cc (right): https://codereview.chromium.org/1226213002/diff/60001/sync/syncable/parent_child_index.cc#newcode56 sync/syncable/parent_child_index.cc:56: delete type_root_child_sets_[i]; On 2015/07/10 00:12:57, Nicolas Zea wrote: > ...
5 years, 5 months ago (2015-07-10 04:58:51 UTC) #8
Nicolas Zea
lgtm https://codereview.chromium.org/1226213002/diff/100001/sync/syncable/parent_child_index.cc File sync/syncable/parent_child_index.cc (right): https://codereview.chromium.org/1226213002/diff/100001/sync/syncable/parent_child_index.cc#newcode207 sync/syncable/parent_child_index.cc:207: // of UNSPECIFIED model type. Nit: any entries ...
5 years, 5 months ago (2015-07-10 18:37:10 UTC) #9
stanisc
https://codereview.chromium.org/1226213002/diff/100001/sync/syncable/parent_child_index.cc File sync/syncable/parent_child_index.cc (right): https://codereview.chromium.org/1226213002/diff/100001/sync/syncable/parent_child_index.cc#newcode207 sync/syncable/parent_child_index.cc:207: // of UNSPECIFIED model type. On 2015/07/10 18:37:10, Nicolas ...
5 years, 5 months ago (2015-07-10 20:20:22 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1226213002/120001
5 years, 5 months ago (2015-07-10 21:19:58 UTC) #13
commit-bot: I haz the power
Committed patchset #7 (id:120001)
5 years, 5 months ago (2015-07-10 21:26:50 UTC) #14
commit-bot: I haz the power
5 years, 5 months ago (2015-07-10 21:28:30 UTC) #15
Message was sent while issue was closed.
Patchset 7 (id:??) landed as
https://crrev.com/c2b13973453530ab01e92fee880e14b34c0c420b
Cr-Commit-Position: refs/heads/master@{#338364}

Powered by Google App Engine
This is Rietveld 408576698