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

Issue 277583002: IndexedDB: Prevent store/index deletion from racing ahead of use (Closed)

Created:
6 years, 7 months ago by jsbell
Modified:
6 years, 7 months ago
Reviewers:
ericu, cmumford
CC:
chromium-reviews, jam, alecflett, ericu+idb_chromium.org, darin-cc_chromium.org, cmumford, dgrogan, jsbell+idb_chromium.org
Visibility:
Public.

Description

IndexedDB: Prevent store/index deletion from racing ahead of use In the Indexed DB spec, schema updates occur synchronously from the perspective of script, e.g. you can create a store then use it immediately without waiting for a request to complete. That model was carried through to the back end, but with a subtle issue that the deletion of a store or index could "race ahead" of a previously requested use of it. Change store/index deletion to take place in order with other requests, so do all the work (in-memory and backing store) during the scheduled operation, rather than on IPC receipt. Also change store/index creation to do all the work (in-memory and backing store) synchronously, since index population is already preemptively done. And since this requires shuffling when the "abort" operations should be queued, rework the API there slightly. BUG=370056, 368271, 362723 R=cmumford@chromium.org,ericu@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=272282

Patch Set 1 #

Patch Set 2 : Rework AbortTask test #

Patch Set 3 : Added tests #

Total comments: 14

Patch Set 4 : Address race; add unit test #

Patch Set 5 : base::Closure copies const-refs, so this is better #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+319 lines, -119 lines) Patch
M content/browser/indexed_db/indexed_db_database.h View 1 2 3 4 2 chunks +2 lines, -8 lines 2 comments Download
M content/browser/indexed_db/indexed_db_database.cc View 1 2 3 4 13 chunks +64 lines, -69 lines 4 comments Download
M content/browser/indexed_db/indexed_db_database_unittest.cc View 1 2 3 8 chunks +194 lines, -5 lines 0 comments Download
M content/browser/indexed_db/indexed_db_fake_backing_store.h View 1 2 3 1 chunk +9 lines, -0 lines 0 comments Download
M content/browser/indexed_db/indexed_db_fake_backing_store.cc View 1 2 3 3 chunks +17 lines, -6 lines 0 comments Download
M content/browser/indexed_db/indexed_db_transaction.h View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/indexed_db/indexed_db_transaction.cc View 2 chunks +6 lines, -12 lines 0 comments Download
M content/browser/indexed_db/indexed_db_transaction_unittest.cc View 1 2 4 chunks +23 lines, -18 lines 0 comments Download
M content/browser/indexed_db/mock_indexed_db_callbacks.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/indexed_db/mock_indexed_db_callbacks.cc View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 21 (0 generated)
jsbell
To land this will require disabling a test that probes at this indirectly on the ...
6 years, 7 months ago (2014-05-08 00:06:56 UTC) #1
jsbell
I added some tests; nothing too exciting but they exercise the op and op/abort paths. ...
6 years, 7 months ago (2014-05-13 08:17:38 UTC) #2
ericu
Sorry about the delay. It looks OK on the surface; I want to take a ...
6 years, 7 months ago (2014-05-13 16:33:15 UTC) #3
cmumford
Looks like storage/indexeddb/createIndex-after-failure.html is now failing. https://codereview.chromium.org/277583002/diff/40001/content/browser/indexed_db/indexed_db_transaction.cc File content/browser/indexed_db/indexed_db_transaction.cc (right): https://codereview.chromium.org/277583002/diff/40001/content/browser/indexed_db/indexed_db_transaction.cc#newcode102 content/browser/indexed_db/indexed_db_transaction.cc:102: RunTasksIfStarted(); Will PostTask ...
6 years, 7 months ago (2014-05-13 21:56:23 UTC) #4
ericu
https://codereview.chromium.org/277583002/diff/40001/content/browser/indexed_db/indexed_db_database.cc File content/browser/indexed_db/indexed_db_database.cc (right): https://codereview.chromium.org/277583002/diff/40001/content/browser/indexed_db/indexed_db_database.cc#newcode331 content/browser/indexed_db/indexed_db_database.cc:331: base::Bind(&IndexedDBDatabase::DeleteObjectStoreOperation, This change makes the RemoveObjectStore call async. Does ...
6 years, 7 months ago (2014-05-14 01:08:00 UTC) #5
jsbell
On 2014/05/13 21:56:23, cmumford wrote: > Looks like storage/indexeddb/createIndex-after-failure.html is now failing. > Yes, the ...
6 years, 7 months ago (2014-05-14 10:49:36 UTC) #6
jsbell
Thanks for taking a look. Further thoughts on splitting this up - or doing more ...
6 years, 7 months ago (2014-05-14 11:05:52 UTC) #7
jsbell
https://codereview.chromium.org/277583002/diff/40001/content/browser/indexed_db/indexed_db_database.cc File content/browser/indexed_db/indexed_db_database.cc (right): https://codereview.chromium.org/277583002/diff/40001/content/browser/indexed_db/indexed_db_database.cc#newcode755 content/browser/indexed_db/indexed_db_database.cc:755: metadata_.object_stores.end()); On 2014/05/14 01:08:00, ericu wrote: > Is using ...
6 years, 7 months ago (2014-05-14 11:17:11 UTC) #8
ericu
On Wed, May 14, 2014 at 4:05 AM, <jsbell@chromium.org> wrote: > Thanks for taking a ...
6 years, 7 months ago (2014-05-14 18:08:22 UTC) #9
jsbell
On 2014/05/14 18:08:22, ericu wrote: > Right--I got that. What I'm wondering about is, after ...
6 years, 7 months ago (2014-05-14 20:41:08 UTC) #10
ericu
On Wed, May 14, 2014 at 1:41 PM, <jsbell@chromium.org> wrote: > On 2014/05/14 18:08:22, ericu ...
6 years, 7 months ago (2014-05-14 20:47:02 UTC) #11
jsbell
More testing revealed a fun edge case. https://codereview.chromium.org/277583002/diff/80001/content/browser/indexed_db/indexed_db_database.cc File content/browser/indexed_db/indexed_db_database.cc (right): https://codereview.chromium.org/277583002/diff/80001/content/browser/indexed_db/indexed_db_database.cc#newcode430 content/browser/indexed_db/indexed_db_database.cc:430: return; Seems ...
6 years, 7 months ago (2014-05-19 22:07:07 UTC) #12
cmumford
https://codereview.chromium.org/277583002/diff/80001/content/browser/indexed_db/indexed_db_database.cc File content/browser/indexed_db/indexed_db_database.cc (right): https://codereview.chromium.org/277583002/diff/80001/content/browser/indexed_db/indexed_db_database.cc#newcode1289 content/browser/indexed_db/indexed_db_database.cc:1289: const IndexedDBObjectStoreMetadata object_store_metadata = Can this be a const ...
6 years, 7 months ago (2014-05-20 15:29:32 UTC) #13
jsbell
https://codereview.chromium.org/277583002/diff/80001/content/browser/indexed_db/indexed_db_database.cc File content/browser/indexed_db/indexed_db_database.cc (right): https://codereview.chromium.org/277583002/diff/80001/content/browser/indexed_db/indexed_db_database.cc#newcode1289 content/browser/indexed_db/indexed_db_database.cc:1289: const IndexedDBObjectStoreMetadata object_store_metadata = On 2014/05/20 15:29:33, cmumford wrote: ...
6 years, 7 months ago (2014-05-20 15:34:43 UTC) #14
jsbell
FYI, blink-side tests are at: https://codereview.chromium.org/291243003
6 years, 7 months ago (2014-05-20 20:39:13 UTC) #15
jsbell
Any other feedback on this? (Or anything that I missed from previous feedback?)
6 years, 7 months ago (2014-05-21 17:46:24 UTC) #16
cmumford
lgtm
6 years, 7 months ago (2014-05-21 17:57:33 UTC) #17
ericu
lgtm
6 years, 7 months ago (2014-05-21 19:51:28 UTC) #18
jsbell
The CQ bit was checked by jsbell@chromium.org
6 years, 7 months ago (2014-05-22 16:18:15 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jsbell@chromium.org/277583002/80001
6 years, 7 months ago (2014-05-22 16:19:52 UTC) #20
commit-bot: I haz the power
6 years, 7 months ago (2014-05-22 19:42:43 UTC) #21
Message was sent while issue was closed.
Change committed as 272282

Powered by Google App Engine
This is Rietveld 408576698