Bug 97501 - IndexedDB: One transaction coordinator per database
Summary: IndexedDB: One transaction coordinator per database
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Joshua Bell
URL:
Keywords:
Depends on:
Blocks: 97570
  Show dependency treegraph
 
Reported: 2012-09-24 17:14 PDT by Joshua Bell
Modified: 2012-09-25 11:51 PDT (History)
5 users (show)

See Also:


Attachments
Patch (24.67 KB, patch)
2012-09-24 17:17 PDT, Joshua Bell
no flags Details | Formatted Diff | Diff
Patch (27.84 KB, patch)
2012-09-24 17:27 PDT, Joshua Bell
no flags Details | Formatted Diff | Diff
Patch (28.08 KB, patch)
2012-09-25 11:15 PDT, Joshua Bell
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Bell 2012-09-24 17:14:08 PDT
IndexedDB: One transaction coordinator per database
Comment 1 Joshua Bell 2012-09-24 17:17:45 PDT
Created attachment 165473 [details]
Patch
Comment 2 Joshua Bell 2012-09-24 17:18:52 PDT
dgrogan@, alecflett@ - please take a look

This turned out to be pretty straightforward to implement. Not a huge win, though, since transactions within databases are still executed serially.
Comment 3 WebKit Review Bot 2012-09-24 17:22:28 PDT
Comment on attachment 165473 [details]
Patch

Attachment 165473 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13990866
Comment 4 Joshua Bell 2012-09-24 17:27:17 PDT
Created attachment 165475 [details]
Patch
Comment 5 David Grogan 2012-09-25 10:54:10 PDT
Comment on attachment 165475 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=165475&action=review

LGTM

This is great, seems like an easy win.  readwrite transactions on separate databases will run in parallel too, right?

> LayoutTests/storage/indexeddb/resources/transaction-coordination-across-databases.js:6
> +description("Check that transactions in different databases can run in parallel.");

OT: I ran this test in content_shell and can get it to wedge by hitting refresh at various stages of completion.  I thought your two-phase consolidation eliminated the last known wedge vector, but it looks like there's still at least one outstanding.

> LayoutTests/storage/indexeddb/resources/transaction-coordination-across-databases.js:97
> +    }());

It seems that this pattern is shorthand for function doTransaction1Get() { ... } doTransaction1Get();  I suppose it also avoids putting doTransaction1Get in startWork()'s namespace and serves as notice to anyone reading the code that doTransaction1Get() is not called anywhere else.  Am I missing any other noteworthy properties of this pattern?  Also, does it have a name?

> LayoutTests/storage/indexeddb/resources/transaction-readwrite-exclusive.js:54
> +    evalAndLog("transaction1 = db1.transaction('store', 'readwrite')");

Given the level of parallelization that this patch gives us, where we serialize per database, this test would still pass if these were readonly transactions, correct?
Comment 6 Joshua Bell 2012-09-25 11:02:11 PDT
(In reply to comment #5)
> 
> This is great, seems like an easy win.  readwrite transactions on separate databases will run in parallel too, right?

Correct. I was thinking of readonly as being the "base" case to test for, but ensuring readwrite are parallelized across databases is a good point; I'll update the test.
 
> > LayoutTests/storage/indexeddb/resources/transaction-coordination-across-databases.js:97
> > +    }());
> 
> It seems that this pattern is shorthand for function doTransaction1Get() { ... } doTransaction1Get();  I suppose it also avoids putting doTransaction1Get in startWork()'s namespace and serves as notice to anyone reading the code that doTransaction1Get() is not called anywhere else.  Am I missing any other noteworthy properties of this pattern? 

Nope. I'll flatten it out a bit.

> Also, does it have a name?

It's an "Immediately Invoked Function Expression" (IIFE) with a named function so it can be called recursively.
 
> > LayoutTests/storage/indexeddb/resources/transaction-readwrite-exclusive.js:54
> > +    evalAndLog("transaction1 = db1.transaction('store', 'readwrite')");
> 
> Given the level of parallelization that this patch gives us, where we serialize per database, this test would still pass if these were readonly transactions, correct?

Correct. I could add a test that validates the *current* limitation but thought this was enough for now.
Comment 7 Joshua Bell 2012-09-25 11:15:31 PDT
Created attachment 165642 [details]
Patch
Comment 8 Joshua Bell 2012-09-25 11:17:49 PDT
tony@ - r?
Comment 9 WebKit Review Bot 2012-09-25 11:51:16 PDT
Comment on attachment 165642 [details]
Patch

Clearing flags on attachment: 165642

Committed r129534: <http://trac.webkit.org/changeset/129534>
Comment 10 WebKit Review Bot 2012-09-25 11:51:19 PDT
All reviewed patches have been landed.  Closing bug.