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

Issue 2062013002: Fetch incremental updates. Store new state in V4Store. (Closed)

Created:
4 years, 6 months ago by vakh (use Gerrit instead)
Modified:
4 years, 5 months ago
CC:
asvitkine+watch_chromium.org, woz, chromium-reviews, grt+watch_chromium.org, noé
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fetch incremental updates. Store new state in V4Store. This CL does the following: 1. Makes V4Database the source of truth about the number and status of the lists being updated. 2. Fetch updates for 2 different lists: Malware and Social Engineering. Previously we were just downloading Malware. 3. Update requests are now incremental. Each V4Store updates its "state" when processing an update response so the next update request is incremental on top of that state. 4. Tests to verify that the V4Database and V4Store are being updated correctly. 5. Force enable V4 updates for debug builds (bringing it back). Overall design document: https://goto.google.com/design-doc-v4store After this CL: 1. V4LocalDatabaseManager tells V4Database about which lists to fetch (and their filename) at init time. 2. From here on, V4Database becomes the single source of truth for all information about the lists. 3. V4Database creates a V4Store for each of the lists. 4. When the V4Database is ready (this happens on the task runner), the update manager schedules the next update. 5. When the update is received, V4Database determines which stores to update and updates them on the task runner. 6. Updating a V4Store is done by creating a new store that's equivalent to the old store + the update. 7. When the new store is ready, the V4Database swaps it in for the old store. 8. When all the stores that needed to be updated have been updated, the update manager schedules the next update. BUG=543161 Committed: https://crrev.com/370e9320906395ba0c795af2d3b4cedf864f936d Cr-Commit-Position: refs/heads/master@{#402565}

Patch Set 1 #

Patch Set 2 : Update BUILD.gn #

Patch Set 3 : Remove some logging #

Patch Set 4 : Undo forced frequent updates useful for debugging #

Patch Set 5 : Nit: Use base::SStringPrintf instead of string concat #

Total comments: 40

Patch Set 6 : nparker comments addressed #

Patch Set 7 : Nits: Fixed a crash. Corrected a DCHECK. #

Patch Set 8 : Nits: Added some comments in BUILD.gn. Using #else for platform_type until I resolve the android bu… #

Total comments: 96

Patch Set 9 : CR feedback: shess@ (except store_state_map ownership) #

Patch Set 10 : Don't cache store state. Makes ownership straightforward. #

Patch Set 11 : Use PlatformTest as the base class for V4UpdateProtocolManagerTest #

Patch Set 12 : git fetch && git pull && gclient sync #

Patch Set 13 : Nit: Make V4Store's member variables private instead of protected, because why not? #

Patch Set 14 : git fetch && git pull #

Total comments: 22

Patch Set 15 : git fetch && pull #

Patch Set 16 : Address comments by shess@ #

Patch Set 17 : Nit: store_file_name_map ready at compile time #

Patch Set 18 : Minor: Filename format in CamelCase: <ThreatEntryType><ThreatType>.store #

Patch Set 19 : CR feedback from shess@ #

Patch Set 20 : git fetch && git pull && gclient sync #

Total comments: 16

Patch Set 21 : Minor: CR feedback: shess@ #

Patch Set 22 : git fetch && git pull && gclient sync #

Patch Set 23 : Minor: shess@ latest CR #

Patch Set 24 : git fetch && git pull && gclient sync #

Total comments: 6

Patch Set 25 : Minor: Fix DCHECK #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+522 lines, -184 lines) Patch
M chrome/browser/safe_browsing/services_delegate_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +6 lines, -0 lines 0 comments Download
M components/safe_browsing_db/BUILD.gn View 1 2 3 4 5 6 7 4 chunks +7 lines, -0 lines 0 comments Download
M components/safe_browsing_db/v4_database.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 6 chunks +36 lines, -11 lines 0 comments Download
M components/safe_browsing_db/v4_database.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 4 chunks +76 lines, -13 lines 0 comments Download
M components/safe_browsing_db/v4_database_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 5 chunks +176 lines, -52 lines 0 comments Download
M components/safe_browsing_db/v4_local_database_manager.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2 chunks +6 lines, -1 line 0 comments Download
M components/safe_browsing_db/v4_local_database_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 7 chunks +44 lines, -24 lines 1 comment Download
M components/safe_browsing_db/v4_protocol_manager_util.h View 1 2 3 4 5 6 7 8 4 chunks +30 lines, -4 lines 0 comments Download
M components/safe_browsing_db/v4_protocol_manager_util.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +25 lines, -0 lines 0 comments Download
M components/safe_browsing_db/v4_store.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +22 lines, -8 lines 0 comments Download
M components/safe_browsing_db/v4_store.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +33 lines, -1 line 1 comment Download
M components/safe_browsing_db/v4_update_protocol_manager.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 5 chunks +8 lines, -21 lines 0 comments Download
M components/safe_browsing_db/v4_update_protocol_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 8 chunks +15 lines, -18 lines 0 comments Download
M components/safe_browsing_db/v4_update_protocol_manager_unittest.cc View 1 2 3 4 5 6 7 8 9 10 10 chunks +31 lines, -31 lines 0 comments Download
M tools/metrics/histograms/histograms.xml View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +7 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 72 (10 generated)
vakh (use Gerrit instead)
Update BUILD.gn
4 years, 6 months ago (2016-06-14 02:41:37 UTC) #2
vakh (use Gerrit instead)
Remove some logging
4 years, 6 months ago (2016-06-14 02:51:27 UTC) #3
vakh (use Gerrit instead)
shess@chromium.org: Please review changes in * nparker@chromium.org: Please review changes in *
4 years, 6 months ago (2016-06-14 02:52:39 UTC) #5
vakh (use Gerrit instead)
Undo forced frequent updates useful for debugging
4 years, 6 months ago (2016-06-14 16:54:26 UTC) #6
vakh (use Gerrit instead)
Nit: Use base::SStringPrintf instead of string concat
4 years, 6 months ago (2016-06-14 17:13:49 UTC) #7
vakh (use Gerrit instead)
Ping.
4 years, 6 months ago (2016-06-15 18:00:46 UTC) #8
Nathan Parker
I'm excited about updates coming in! https://codereview.chromium.org/2062013002/diff/80001/components/safe_browsing_db/v4_database.cc File components/safe_browsing_db/v4_database.cc (right): https://codereview.chromium.org/2062013002/diff/80001/components/safe_browsing_db/v4_database.cc#newcode31 components/safe_browsing_db/v4_database.cc:31: if (!base_path.IsAbsolute() || ...
4 years, 6 months ago (2016-06-15 21:24:21 UTC) #9
vakh (use Gerrit instead)
nparker comments addressed
4 years, 6 months ago (2016-06-16 01:07:09 UTC) #10
vakh (use Gerrit instead)
Thanks for the review. PTAL. https://codereview.chromium.org/2062013002/diff/80001/components/safe_browsing_db/v4_database.cc File components/safe_browsing_db/v4_database.cc (right): https://codereview.chromium.org/2062013002/diff/80001/components/safe_browsing_db/v4_database.cc#newcode31 components/safe_browsing_db/v4_database.cc:31: if (!base_path.IsAbsolute() || store_file_name_map.empty()) ...
4 years, 6 months ago (2016-06-16 01:07:35 UTC) #11
vakh (use Gerrit instead)
Nits: Fixed a crash. Corrected a DCHECK.
4 years, 6 months ago (2016-06-16 01:50:45 UTC) #12
vakh (use Gerrit instead)
I'm super confused why the Android GN builds are trying to compile the v4_local_database_manager.cc The ...
4 years, 6 months ago (2016-06-16 07:03:36 UTC) #13
vakh (use Gerrit instead)
Interestingly, all the failing targets are trying to compile both ":safe_browsing_api_handler" and ":v4_local_database_manager" which should ...
4 years, 6 months ago (2016-06-16 07:08:13 UTC) #14
vakh (use Gerrit instead)
Nits: Added some comments in BUILD.gn. Using #else for platform_type until I resolve the android ...
4 years, 6 months ago (2016-06-16 22:34:21 UTC) #15
Scott Hess - ex-Googler
On 2016/06/16 07:08:13, vakh wrote: > Interestingly, all the failing targets are trying to compile ...
4 years, 6 months ago (2016-06-16 23:42:04 UTC) #16
Nathan Parker
lgtm with some comments https://codereview.chromium.org/2062013002/diff/80001/components/safe_browsing_db/v4_database.cc File components/safe_browsing_db/v4_database.cc (right): https://codereview.chromium.org/2062013002/diff/80001/components/safe_browsing_db/v4_database.cc#newcode161 components/safe_browsing_db/v4_database.cc:161: (*store_state_map_)[store_map_iter.first] = store_map_iter.second->state(); On 2016/06/16 ...
4 years, 6 months ago (2016-06-17 21:34:19 UTC) #17
Scott Hess - ex-Googler
As you can see, I'm a bit against checking in logging code. AFAICT it's essentially ...
4 years, 6 months ago (2016-06-17 22:53:44 UTC) #18
Scott Hess - ex-Googler
Also, there's a subset of this CL which is just renaming type things. I fully ...
4 years, 6 months ago (2016-06-17 22:54:48 UTC) #19
vakh (use Gerrit instead)
CR feedback: shess@ (except store_state_map ownership)
4 years, 6 months ago (2016-06-20 22:28:08 UTC) #20
vakh (use Gerrit instead)
shess@ -- addressed most of your comments. Except the ownership of store_state_map, which I am ...
4 years, 6 months ago (2016-06-20 22:28:43 UTC) #21
vakh (use Gerrit instead)
Don't cache store state. Makes ownership straightforward.
4 years, 6 months ago (2016-06-20 23:50:18 UTC) #22
vakh (use Gerrit instead)
Use PlatformTest as the base class for V4UpdateProtocolManagerTest
4 years, 6 months ago (2016-06-20 23:59:17 UTC) #23
vakh (use Gerrit instead)
On 2016/06/17 22:54:48, Scott Hess wrote: > Also, there's a subset of this CL which ...
4 years, 6 months ago (2016-06-21 00:14:25 UTC) #24
vakh (use Gerrit instead)
git fetch && git pull && gclient sync
4 years, 6 months ago (2016-06-21 00:25:56 UTC) #25
vakh (use Gerrit instead)
I've removed the caching of the StoreStateMap from V4Database since it was difficult to justify ...
4 years, 6 months ago (2016-06-21 00:29:36 UTC) #26
vakh (use Gerrit instead)
Nit: Make V4Store's member variables private instead of protected, because why not?
4 years, 6 months ago (2016-06-21 01:04:31 UTC) #27
vakh (use Gerrit instead)
git fetch && git pull
4 years, 6 months ago (2016-06-21 19:05:48 UTC) #28
vakh (use Gerrit instead)
On 2016/06/17 at 22:54:48, shess wrote: > Also, there's a subset of this CL which ...
4 years, 6 months ago (2016-06-21 19:08:33 UTC) #29
Scott Hess - ex-Googler
OK, this is a review-of-responses-to-comments. https://codereview.chromium.org/2062013002/diff/140001/components/safe_browsing_db/v4_database.cc File components/safe_browsing_db/v4_database.cc (right): https://codereview.chromium.org/2062013002/diff/140001/components/safe_browsing_db/v4_database.cc#newcode111 components/safe_browsing_db/v4_database.cc:111: if (old_store->state() != response.new_client_state()) ...
4 years, 6 months ago (2016-06-21 21:03:44 UTC) #30
Scott Hess - ex-Googler
Apologies, I lost mental containment and bailed on the last few files. They had fewer ...
4 years, 6 months ago (2016-06-21 22:23:25 UTC) #31
vakh (use Gerrit instead)
git fetch && pull
4 years, 6 months ago (2016-06-21 22:32:16 UTC) #32
vakh (use Gerrit instead)
Address comments by shess@
4 years, 6 months ago (2016-06-21 23:17:50 UTC) #33
vakh (use Gerrit instead)
Thanks for another round of review, shess@ I've addressed some of the comments and responded ...
4 years, 6 months ago (2016-06-21 23:19:35 UTC) #34
vakh (use Gerrit instead)
Nit: store_file_name_map ready at compile time
4 years, 6 months ago (2016-06-21 23:54:30 UTC) #35
vakh (use Gerrit instead)
Minor: Filename format in CamelCase: <ThreatEntryType><ThreatType>.store
4 years, 6 months ago (2016-06-23 00:24:48 UTC) #36
vakh (use Gerrit instead)
https://codereview.chromium.org/2062013002/diff/80001/components/safe_browsing_db/v4_local_database_manager.cc File components/safe_browsing_db/v4_local_database_manager.cc (right): https://codereview.chromium.org/2062013002/diff/80001/components/safe_browsing_db/v4_local_database_manager.cc#newcode204 components/safe_browsing_db/v4_local_database_manager.cc:204: (*store_file_name_map)[update_list_identifier] = "os_url_malware.store"; On 2016/06/17 21:34:19, Nathan Parker wrote: ...
4 years, 6 months ago (2016-06-23 00:28:07 UTC) #37
vakh (use Gerrit instead)
CR feedback from shess@
4 years, 6 months ago (2016-06-23 06:22:10 UTC) #38
vakh (use Gerrit instead)
Thanks for the review. I have addressed all the comments so far. PTAL. https://codereview.chromium.org/2062013002/diff/140001/components/safe_browsing_db/v4_database.cc File ...
4 years, 6 months ago (2016-06-23 06:23:50 UTC) #39
vakh (use Gerrit instead)
git fetch && git pull && gclient sync
4 years, 6 months ago (2016-06-23 16:20:21 UTC) #40
Scott Hess - ex-Googler
I agree we're getting close to the end of the line, here. https://codereview.chromium.org/2062013002/diff/140001/components/safe_browsing_db/v4_database.cc File components/safe_browsing_db/v4_database.cc ...
4 years, 6 months ago (2016-06-24 23:01:19 UTC) #41
vakh (use Gerrit instead)
Minor: CR feedback: shess@
4 years, 6 months ago (2016-06-25 01:50:09 UTC) #42
vakh (use Gerrit instead)
git fetch && git pull && gclient sync
4 years, 5 months ago (2016-06-27 18:44:15 UTC) #43
vakh (use Gerrit instead)
https://codereview.chromium.org/2062013002/diff/140001/components/safe_browsing_db/v4_database.cc File components/safe_browsing_db/v4_database.cc (right): https://codereview.chromium.org/2062013002/diff/140001/components/safe_browsing_db/v4_database.cc#newcode119 components/safe_browsing_db/v4_database.cc:119: response, current_task_runner, store_ready_callback)); On 2016/06/24 23:01:18, Scott Hess wrote: ...
4 years, 5 months ago (2016-06-27 19:38:27 UTC) #44
vakh (use Gerrit instead)
rkaplow@ -- Could you please review the changes in histograms.xml? Thanks.
4 years, 5 months ago (2016-06-27 22:06:04 UTC) #46
Scott Hess - ex-Googler
https://codereview.chromium.org/2062013002/diff/140001/components/safe_browsing_db/v4_local_database_manager.cc File components/safe_browsing_db/v4_local_database_manager.cc (right): https://codereview.chromium.org/2062013002/diff/140001/components/safe_browsing_db/v4_local_database_manager.cc#newcode250 components/safe_browsing_db/v4_local_database_manager.cc:250: v4_database_->ApplyUpdate(responses); On 2016/06/27 19:38:26, vakh wrote: > On 2016/06/24 ...
4 years, 5 months ago (2016-06-27 22:19:18 UTC) #47
Scott Hess - ex-Googler
https://codereview.chromium.org/2062013002/diff/380001/components/safe_browsing_db/v4_update_protocol_manager.cc File components/safe_browsing_db/v4_update_protocol_manager.cc (right): https://codereview.chromium.org/2062013002/diff/380001/components/safe_browsing_db/v4_update_protocol_manager.cc#newcode196 components/safe_browsing_db/v4_update_protocol_manager.cc:196: const StoreStateMap* store_state_map) { On 2016/06/27 22:19:17, Scott Hess ...
4 years, 5 months ago (2016-06-27 22:37:58 UTC) #48
vakh (use Gerrit instead)
Minor: shess@ latest CR
4 years, 5 months ago (2016-06-27 23:58:06 UTC) #49
vakh (use Gerrit instead)
https://codereview.chromium.org/2062013002/diff/140001/components/safe_browsing_db/v4_local_database_manager.cc File components/safe_browsing_db/v4_local_database_manager.cc (right): https://codereview.chromium.org/2062013002/diff/140001/components/safe_browsing_db/v4_local_database_manager.cc#newcode250 components/safe_browsing_db/v4_local_database_manager.cc:250: v4_database_->ApplyUpdate(responses); On 2016/06/27 22:19:17, Scott Hess wrote: > On ...
4 years, 5 months ago (2016-06-27 23:58:53 UTC) #50
vakh (use Gerrit instead)
git fetch && git pull && gclient sync
4 years, 5 months ago (2016-06-28 06:52:24 UTC) #51
rkaplow
lgtm histogram lg
4 years, 5 months ago (2016-06-28 15:10:45 UTC) #52
Scott Hess - ex-Googler
lgtm. Minor nit on the DCHECK(x >= y), you can ignore me or fix it ...
4 years, 5 months ago (2016-06-28 18:18:06 UTC) #53
vakh (use Gerrit instead)
https://codereview.chromium.org/2062013002/diff/460001/components/safe_browsing_db/v4_database.cc File components/safe_browsing_db/v4_database.cc (right): https://codereview.chromium.org/2062013002/diff/460001/components/safe_browsing_db/v4_database.cc#newcode96 components/safe_browsing_db/v4_database.cc:96: db_updated_callback_ = db_updated_callback; On 2016/06/28 18:18:06, Scott Hess (OOO ...
4 years, 5 months ago (2016-06-28 19:02:03 UTC) #54
vakh (use Gerrit instead)
Minor: Fix DCHECK
4 years, 5 months ago (2016-06-28 19:02:45 UTC) #55
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2062013002/480001
4 years, 5 months ago (2016-06-28 19:04:50 UTC) #58
commit-bot: I haz the power
Try jobs failed on following builders: linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/95251)
4 years, 5 months ago (2016-06-28 19:56:19 UTC) #60
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2062013002/480001
4 years, 5 months ago (2016-06-28 20:03:53 UTC) #62
commit-bot: I haz the power
Committed patchset #25 (id:480001)
4 years, 5 months ago (2016-06-28 22:11:42 UTC) #64
commit-bot: I haz the power
Patchset 25 (id:??) landed as https://crrev.com/370e9320906395ba0c795af2d3b4cedf864f936d Cr-Commit-Position: refs/heads/master@{#402565}
4 years, 5 months ago (2016-06-28 22:14:48 UTC) #66
Pete Williamson
On 2016/06/28 22:14:48, commit-bot: I haz the power wrote: > Patchset 25 (id:??) landed as ...
4 years, 5 months ago (2016-06-28 23:35:58 UTC) #67
Scott Hess - ex-Googler
https://codereview.chromium.org/2062013002/diff/480001/components/safe_browsing_db/v4_local_database_manager.cc File components/safe_browsing_db/v4_local_database_manager.cc (right): https://codereview.chromium.org/2062013002/diff/480001/components/safe_browsing_db/v4_local_database_manager.cc#newcode42 components/safe_browsing_db/v4_local_database_manager.cc:42: "UrlSoceng.store"}}; There's your sizes problem. Sigh. Probably just have ...
4 years, 5 months ago (2016-06-28 23:46:12 UTC) #68
vakh (use Gerrit instead)
On 2016/06/28 at 23:46:12, shess wrote: > https://codereview.chromium.org/2062013002/diff/480001/components/safe_browsing_db/v4_local_database_manager.cc > File components/safe_browsing_db/v4_local_database_manager.cc (right): > > https://codereview.chromium.org/2062013002/diff/480001/components/safe_browsing_db/v4_local_database_manager.cc#newcode42 ...
4 years, 5 months ago (2016-06-29 01:12:37 UTC) #69
vakh (use Gerrit instead)
On 2016/06/29 at 01:12:37, vakh wrote: > On 2016/06/28 at 23:46:12, shess wrote: > > ...
4 years, 5 months ago (2016-06-29 01:21:03 UTC) #70
brucedawson
4 years, 5 months ago (2016-07-07 18:15:30 UTC) #72
Message was sent while issue was closed.
https://codereview.chromium.org/2062013002/diff/480001/components/safe_browsi...
File components/safe_browsing_db/v4_store.cc (right):

https://codereview.chromium.org/2062013002/diff/480001/components/safe_browsi...
components/safe_browsing_db/v4_store.cc:33: return base::StringPrintf("path: %s;
state: %s", store_path_.value().c_str(),
Unfortunately... store_path_.value() is a wstring in Windows, so you can't print
it with %s.

crbug.com/626411 filed.

Powered by Google App Engine
This is Rietveld 408576698