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

Issue 805633004: Enable Null Syncable ID which is different than Root ID. (Closed)

Created:
6 years ago by stanisc
Modified:
5 years, 12 months ago
Reviewers:
Nicolas Zea, *pavely
CC:
chromium-reviews, tim+watch_chromium.org, pvalenzuela+watch_chromium.org, maxbogue+watch_chromium.org, zea+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

Enable Null Syncable ID which is different than Root ID. This patch prepares sync codebase for supporting datatypes with implicit permanent forlders by introducing an empty/unset syncable ID. There was a notion of Null ID before but it was equivalent to the root ID which caused some confusion in the code - a Null ID would sometimes be used where a "root" would be appropriate and vice versa. See the following code fragment for an example: // TODO(sync): We could use null here, but to ease conversion we use "r". // fix this, this is madness :) inline bool IsNull() const { return IsRoot(); } This change will be followed by one or two separate changes that will actually remove dependencies on PARENT_ID and SERVER_PARENT_ID and use a different way to organize nodes in the directory based on node's datatype rather than parent ID. This change impacts the following: 1) The default ID value in EntryKernel ID fields and elsewhere is Null ID and not Root ID as it used to be. 2) This means that some tests that depended on Root ID being set implicitly in PARENT_ID and SERVER_PARENT_ID now need to set these IDs explicitly. 3) Node's GetPredecessorId, GetSuccessorId, and GetFirstChildId methods now return a null ID rather than a root ID when there is no predecessor, successor, or children. 4) Small changed throughout the code to make sure that null IDs and root IDs are used accordingly (now that they are no longer equivalent). 5) Changed some validation methods to accept Null IDs to avoid large changes in the test code. BUG=438313 Committed: https://crrev.com/60c25aebaf6c3bbc90c9c82f83a752ca58c7ddce Cr-Commit-Position: refs/heads/master@{#309495}

Patch Set 1 #

Patch Set 2 : Removed some dependencies on SERVER_PARENT_ID #

Total comments: 10

Patch Set 3 : Addressed CR feedback #

Unified diffs Side-by-side diffs Delta from patch set Stats (+86 lines, -86 lines) Patch
M sync/engine/commit_util.cc View 2 chunks +4 lines, -4 lines 0 comments Download
M sync/engine/directory_update_handler_unittest.cc View 1 2 15 chunks +26 lines, -28 lines 0 comments Download
M sync/engine/get_commit_ids.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M sync/engine/syncer_unittest.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M sync/engine/syncer_util.cc View 1 chunk +1 line, -1 line 0 comments Download
M sync/engine/syncer_util_unittest.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M sync/internal_api/base_node.cc View 1 chunk +3 lines, -3 lines 0 comments Download
M sync/internal_api/sync_manager_impl_unittest.cc View 1 chunk +4 lines, -1 line 0 comments Download
M sync/internal_api/sync_rollback_manager_base.cc View 1 chunk +1 line, -1 line 0 comments Download
M sync/internal_api/test/test_entry_factory.cc View 1 chunk +1 line, -1 line 0 comments Download
M sync/internal_api/write_node.cc View 1 chunk +1 line, -1 line 0 comments Download
M sync/syncable/directory.cc View 2 chunks +3 lines, -2 lines 0 comments Download
M sync/syncable/directory_backing_store.cc View 1 chunk +5 lines, -3 lines 0 comments Download
M sync/syncable/directory_unittest.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M sync/syncable/entry_kernel.h View 1 chunk +1 line, -0 lines 0 comments Download
M sync/syncable/mutable_entry.cc View 1 chunk +8 lines, -4 lines 0 comments Download
M sync/syncable/nigori_util.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M sync/syncable/parent_child_index_unittest.cc View 1 5 chunks +5 lines, -9 lines 0 comments Download
M sync/syncable/syncable_base_transaction.cc View 1 chunk +1 line, -1 line 0 comments Download
M sync/syncable/syncable_id.h View 1 2 4 chunks +6 lines, -13 lines 0 comments Download
M sync/syncable/syncable_id.cc View 4 chunks +8 lines, -4 lines 0 comments Download
M sync/test/engine/test_id_factory.h View 1 chunk +1 line, -3 lines 0 comments Download

Messages

Total messages: 15 (5 generated)
stanisc
Nicolas, PTAL.
6 years ago (2014-12-18 22:56:40 UTC) #2
Nicolas Zea
I didn't manage to get to this today. Might be better to have Nick or ...
6 years ago (2014-12-20 00:59:25 UTC) #3
stanisc
Pavely@chromium.org, please take a look.
6 years ago (2014-12-20 01:10:47 UTC) #6
pavely
https://codereview.chromium.org/805633004/diff/20001/sync/engine/commit_util.cc File sync/engine/commit_util.cc (right): https://codereview.chromium.org/805633004/diff/20001/sync/engine/commit_util.cc#newcode154 sync/engine/commit_util.cc:154: if (new_parent_id != server_parent_id && !server_parent_id.IsNull() && Could you ...
5 years, 12 months ago (2014-12-22 21:38:09 UTC) #7
stanisc
https://codereview.chromium.org/805633004/diff/20001/sync/engine/commit_util.cc File sync/engine/commit_util.cc (right): https://codereview.chromium.org/805633004/diff/20001/sync/engine/commit_util.cc#newcode154 sync/engine/commit_util.cc:154: if (new_parent_id != server_parent_id && !server_parent_id.IsNull() && On 2014/12/22 ...
5 years, 12 months ago (2014-12-22 21:56:01 UTC) #8
pavely
lgtm after addressing small comments. https://codereview.chromium.org/805633004/diff/20001/sync/engine/commit_util.cc File sync/engine/commit_util.cc (right): https://codereview.chromium.org/805633004/diff/20001/sync/engine/commit_util.cc#newcode154 sync/engine/commit_util.cc:154: if (new_parent_id != server_parent_id ...
5 years, 12 months ago (2014-12-22 22:00:48 UTC) #9
stanisc
Addressed CR feedback. https://codereview.chromium.org/805633004/diff/20001/sync/engine/directory_update_handler_unittest.cc File sync/engine/directory_update_handler_unittest.cc (right): https://codereview.chromium.org/805633004/diff/20001/sync/engine/directory_update_handler_unittest.cc#newcode32 sync/engine/directory_update_handler_unittest.cc:32: using syncable::Id; On 2014/12/22 21:38:09, pavely ...
5 years, 12 months ago (2014-12-22 22:44:20 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/805633004/60001
5 years, 12 months ago (2014-12-22 23:52:11 UTC) #13
commit-bot: I haz the power
Committed patchset #3 (id:60001)
5 years, 12 months ago (2014-12-23 00:03:09 UTC) #14
commit-bot: I haz the power
5 years, 12 months ago (2014-12-23 00:04:01 UTC) #15
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/60c25aebaf6c3bbc90c9c82f83a752ca58c7ddce
Cr-Commit-Position: refs/heads/master@{#309495}

Powered by Google App Engine
This is Rietveld 408576698