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

Issue 10823203: Fix downloads db state=3 corruption using version=23 (Closed)

Created:
8 years, 4 months ago by benjhayden
Modified:
8 years, 4 months ago
CC:
chromium-reviews, brettw-cc_chromium.org
Visibility:
Public.

Description

Fix downloads db state=3 corruption using version=23 dcommitted because the bots don't like binary files. Add a layer of abstraction between the |state| db field and DownloadItem::DownloadState. This will actually prevent the same problem from happening again when I reland http://codereview.chromium.org/10704026/ BUG=140687 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=150542

Patch Set 1 #

Patch Set 2 : update HistoryTest #

Patch Set 3 : fix secondary crash in BaseDownloadItemModel::InterruptReasonMessage() #

Patch Set 4 : version=23 #

Total comments: 15

Patch Set 5 : . #

Patch Set 6 : . #

Patch Set 7 : . #

Patch Set 8 : update version in typical_profile #

Patch Set 9 : merge #

Unified diffs Side-by-side diffs Delta from patch set Stats (+172 lines, -29 lines) Patch
M chrome/browser/download/download_item_model.cc View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/history/download_database.h View 1 2 3 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/browser/history/download_database.cc View 1 2 3 4 9 chunks +71 lines, -12 lines 0 comments Download
M chrome/browser/history/history_database.cc View 1 2 3 2 chunks +12 lines, -1 line 0 comments Download
M chrome/browser/history/history_unittest.cc View 1 2 3 4 5 6 7 chunks +78 lines, -12 lines 0 comments Download
M chrome/test/data/profiles/typical_history/Default/History View 0 chunks +-1 lines, --1 lines 0 comments Download
M content/browser/download/download_item_impl.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M content/public/browser/download_persistent_store_info.h View 1 2 3 3 chunks +3 lines, -2 lines 0 comments Download
M content/public/browser/download_persistent_store_info.cc View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 26 (0 generated)
benjhayden
PTAL
8 years, 4 months ago (2012-08-07 15:53:06 UTC) #1
Randy Smith (Not in Mondays)
LGTM.
8 years, 4 months ago (2012-08-07 16:22:55 UTC) #2
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/benjhayden@chromium.org/10823203/3
8 years, 4 months ago (2012-08-07 16:23:49 UTC) #3
commit-bot: I haz the power
Presubmit check for 10823203-3 failed and returned exit status 1. Running presubmit commit checks ...
8 years, 4 months ago (2012-08-07 16:23:51 UTC) #4
benjhayden
Asanka, PTAL at PS3. Chris's suggestion to take the code for a spin revealed a ...
8 years, 4 months ago (2012-08-07 17:41:24 UTC) #5
asanka
On 2012/08/07 17:41:24, benjhayden_chromium wrote: > Asanka, PTAL at PS3. Chris's suggestion to take the ...
8 years, 4 months ago (2012-08-07 17:57:54 UTC) #6
benjhayden
On 2012/08/07 17:57:54, asanka wrote: > On 2012/08/07 17:41:24, benjhayden_chromium wrote: > > Asanka, PTAL ...
8 years, 4 months ago (2012-08-07 18:14:30 UTC) #7
asanka
LGTM
8 years, 4 months ago (2012-08-07 18:46:00 UTC) #8
benjhayden
PTAL Tested manually: from a fresh build from tot, download a file to completion close ...
8 years, 4 months ago (2012-08-07 20:15:18 UTC) #9
benjhayden
Scott, would you mind looking over my migration code?
8 years, 4 months ago (2012-08-07 20:16:21 UTC) #10
Randy Smith (Not in Mondays)
http://codereview.chromium.org/10823203/diff/9004/chrome/browser/history/download_database.cc File chrome/browser/history/download_database.cc (right): http://codereview.chromium.org/10823203/diff/9004/chrome/browser/history/download_database.cc#newcode182 chrome/browser/history/download_database.cc:182: continue; UMA? (You're welcome to say not in this ...
8 years, 4 months ago (2012-08-07 20:36:16 UTC) #11
sky
In general we don't have this level of defensive code in Chrome. Also, you should ...
8 years, 4 months ago (2012-08-07 20:54:17 UTC) #12
asanka
http://codereview.chromium.org/10823203/diff/9004/chrome/browser/history/download_database.cc File chrome/browser/history/download_database.cc (right): http://codereview.chromium.org/10823203/diff/9004/chrome/browser/history/download_database.cc#newcode182 chrome/browser/history/download_database.cc:182: continue; If you skip this early, wouldn't you risk ...
8 years, 4 months ago (2012-08-07 20:56:14 UTC) #13
Randy Smith (Not in Mondays)
http://codereview.chromium.org/10823203/diff/9004/chrome/browser/history/download_database.cc File chrome/browser/history/download_database.cc (right): http://codereview.chromium.org/10823203/diff/9004/chrome/browser/history/download_database.cc#newcode182 chrome/browser/history/download_database.cc:182: continue; On 2012/08/07 20:54:17, sky wrote: > On 2012/08/07 ...
8 years, 4 months ago (2012-08-07 21:01:35 UTC) #14
sky
On Tue, Aug 7, 2012 at 2:01 PM, <rdsmith@chromium.org> wrote: > > http://codereview.chromium.org/10823203/diff/9004/chrome/browser/history/download_database.cc > File ...
8 years, 4 months ago (2012-08-07 22:36:35 UTC) #15
Randy Smith (Not in Mondays)
On 2012/08/07 22:36:35, sky wrote: > On Tue, Aug 7, 2012 at 2:01 PM, <mailto:rdsmith@chromium.org> ...
8 years, 4 months ago (2012-08-08 00:01:27 UTC) #16
Randy Smith (Not in Mondays)
LGTM conditional on either not doing general from-DB sanitization or putting UMA in so we ...
8 years, 4 months ago (2012-08-08 00:01:59 UTC) #17
benjhayden
On 2012/08/07 22:36:35, sky wrote: > On Tue, Aug 7, 2012 at 2:01 PM, <mailto:rdsmith@chromium.org> ...
8 years, 4 months ago (2012-08-08 01:11:06 UTC) #18
benjhayden
working on a test for the migration. http://codereview.chromium.org/10823203/diff/9004/chrome/browser/history/download_database.cc File chrome/browser/history/download_database.cc (right): http://codereview.chromium.org/10823203/diff/9004/chrome/browser/history/download_database.cc#newcode182 chrome/browser/history/download_database.cc:182: continue; On ...
8 years, 4 months ago (2012-08-08 01:11:52 UTC) #19
Randy Smith (Not in Mondays)
Still LGTM. http://codereview.chromium.org/10823203/diff/9004/chrome/browser/history/download_database.cc File chrome/browser/history/download_database.cc (right): http://codereview.chromium.org/10823203/diff/9004/chrome/browser/history/download_database.cc#newcode182 chrome/browser/history/download_database.cc:182: continue; On 2012/08/08 01:11:52, benjhayden_chromium wrote: > ...
8 years, 4 months ago (2012-08-08 01:52:25 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/benjhayden@chromium.org/10823203/3017
8 years, 4 months ago (2012-08-08 03:19:16 UTC) #21
commit-bot: I haz the power
Presubmit check for 10823203-3017 failed and returned exit status 1. Running presubmit commit checks ...
8 years, 4 months ago (2012-08-08 03:19:21 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/benjhayden@chromium.org/10823203/3017
8 years, 4 months ago (2012-08-08 03:21:36 UTC) #23
benjhayden
I fixed the version in the typical_history sqlite3 file, but it isn't showing up on ...
8 years, 4 months ago (2012-08-08 03:33:42 UTC) #24
sky
LGTM
8 years, 4 months ago (2012-08-08 04:14:34 UTC) #25
sky
8 years, 4 months ago (2012-08-08 04:55:59 UTC) #26
On Tue, Aug 7, 2012 at 6:11 PM,  <benjhayden@chromium.org> wrote:
> On 2012/08/07 22:36:35, sky wrote:
>>
>> On Tue, Aug 7, 2012 at 2:01 PM,  <mailto:rdsmith@chromium.org> wrote:
>> >
>> >
>
>
>
http://codereview.chromium.org/10823203/diff/9004/chrome/browser/history/down...
>>
>> > File chrome/browser/history/download_database.cc (right):
>> >
>> >
>
>
>
http://codereview.chromium.org/10823203/diff/9004/chrome/browser/history/down...
>>
>> > chrome/browser/history/download_database.cc:182: continue;
>> > On 2012/08/07 20:54:17, sky wrote:
>> >>
>> >> On 2012/08/07 20:36:16, rdsmith wrote:
>> >> > UMA?  (You're welcome to say not in this CL, but I do want it,
>> >
>> > because I don't
>> >>
>> >> > want us to just ignore problems like the one that just happened.)
>> >
>> >
>> >> Why add this? At best we do a DCHECK for this sort of thing.
>> >
>> >
>> > The basic problem is that almost any sanitization would have meant we
>> > didn't notice the bug that started all this, which showed up as a crash
>> > on canary.  So I want something that has some chance of letting us know
>> > if there's a lot of DB corruption out in the wild, so that we can
>> > respond to it and make sure it's not the result of a bug in the code.
>> > Is there some better pattern?
>
>
>> Code like this wouldn't have helped identify the problem. Well, I
>> guess it wouldn't crash but the database would have been in a bad
>> state. The problem with this is where do you draw the line? What about
>> verifying the time is valid? What about ensuring total_byes is >= 0?
>
>
> This isn't just sanitization. This is a layer of abstraction that will
> actually
> prevent the same problem from happening when i reland the change that caused
> this mess.

I was referring to the DCHECKs. I agree having a database specific
mapping is a good idea.

  -Scott

>
>
>
>> Add a test for migration and I'll approve this.
>
>
> Adding a test now. I'll say PTAL when done if you're online, otherwise i'll
> tbr.
>
>
>>    -Scott
>
>
>
>
> http://codereview.chromium.org/10823203/

Powered by Google App Engine
This is Rietveld 408576698