WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
100786
Expose snapshots in platform/leveldb wrapper API
https://bugs.webkit.org/show_bug.cgi?id=100786
Summary
Expose snapshots in platform/leveldb wrapper API
Joshua Bell
Reported
2012-10-30 14:01:24 PDT
Expose snapshots in platform/leveldb wrapper API
Attachments
Patch
(13.78 KB, patch)
2012-10-30 14:08 PDT
,
Joshua Bell
no flags
Details
Formatted Diff
Diff
Patch
(18.43 KB, patch)
2012-10-31 11:27 PDT
,
Joshua Bell
no flags
Details
Formatted Diff
Diff
Patch
(12.24 KB, patch)
2012-11-01 17:07 PDT
,
Joshua Bell
no flags
Details
Formatted Diff
Diff
Patch
(12.37 KB, patch)
2012-11-01 17:14 PDT
,
Joshua Bell
no flags
Details
Formatted Diff
Diff
Patch
(12.41 KB, patch)
2012-11-05 13:25 PST
,
Joshua Bell
no flags
Details
Formatted Diff
Diff
Patch
(12.40 KB, patch)
2012-11-07 10:35 PST
,
Joshua Bell
no flags
Details
Formatted Diff
Diff
Patch for landing
(14.68 KB, patch)
2012-11-08 13:33 PST
,
Joshua Bell
no flags
Details
Formatted Diff
Diff
Patch for landing
(14.68 KB, patch)
2012-11-08 13:45 PST
,
Joshua Bell
no flags
Details
Formatted Diff
Diff
Patch for landing
(12.36 KB, patch)
2012-11-08 13:50 PST
,
Joshua Bell
no flags
Details
Formatted Diff
Diff
Show Obsolete
(8)
View All
Add attachment
proposed patch, testcase, etc.
Joshua Bell
Comment 1
2012-10-30 14:08:34 PDT
Created
attachment 171516
[details]
Patch
Joshua Bell
Comment 2
2012-10-30 14:09:46 PDT
dgrogan@, alecflett@ - please take a look Not used yet, but this could be the basis of parallel transactions. (Mostly an excuse to play with the leveldb snapshot API.)
Alec Flett
Comment 3
2012-10-30 15:12:38 PDT
Comment on
attachment 171516
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=171516&action=review
> Source/WebCore/platform/leveldb/LevelDBDatabase.cpp:96 > +class LevelDBSnapshotImpl : public LevelDBSnapshot {
My only thought here is that making this another separate heap-based object behind an interface seems unnecessary.. I don't know *exactly* what the ownership model is for LevelDB snapshots (I see DB::ReleaseSnapshot though) but does ownership of this thing change ever? (seems like no...its always bound to the transaction in question)
Joshua Bell
Comment 4
2012-10-30 15:31:57 PDT
(In reply to
comment #3
)
> (From update of
attachment 171516
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=171516&action=review
> > > Source/WebCore/platform/leveldb/LevelDBDatabase.cpp:96 > > +class LevelDBSnapshotImpl : public LevelDBSnapshot { > > My only thought here is that making this another separate heap-based object behind an interface seems unnecessary.. I don't know *exactly* what the ownership model is for LevelDB snapshots (I see DB::ReleaseSnapshot though) but does ownership of this thing change ever? (seems like no...its always bound to the transaction in question)
Since leveldb doesn't have transactions, in leveldb its separate; you either read from a specific snapshot or just the database. The way we'd use it in IndexedDB we'd probably always have a IDBLevelDBBackingStoreTransaction own both a LevelDBSnapshot and a LevelDBTransaction. But I can imagine other clients of the WebCore::LevelDB* classes wanting to do things differently, so I stuck to the philosophy of making the WebCore::LevelDB* classes wrappers of leveldb (with value-adds). Making it "just" a property of the LevelDBTransaction (a flag passed in during construction) is doable.
Alec Flett
Comment 5
2012-10-30 15:42:23 PDT
Comment on
attachment 171516
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=171516&action=review
>>> Source/WebCore/platform/leveldb/LevelDBDatabase.cpp:96 >>> +class LevelDBSnapshotImpl : public LevelDBSnapshot { >> >> My only thought here is that making this another separate heap-based object behind an interface seems unnecessary.. I don't know *exactly* what the ownership model is for LevelDB snapshots (I see DB::ReleaseSnapshot though) but does ownership of this thing change ever? (seems like no...its always bound to the transaction in question) > > Since leveldb doesn't have transactions, in leveldb its separate; you either read from a specific snapshot or just the database. > > The way we'd use it in IndexedDB we'd probably always have a IDBLevelDBBackingStoreTransaction own both a LevelDBSnapshot and a LevelDBTransaction. But I can imagine other clients of the WebCore::LevelDB* classes wanting to do things differently, so I stuck to the philosophy of making the WebCore::LevelDB* classes wrappers of leveldb (with value-adds). > > Making it "just" a property of the LevelDBTransaction (a flag passed in during construction) is doable.
yeah - this is more or less what I meant - I think snapshots is a necessary primitive which lets you create consistent read transactions, at least in the sense that IDB thinks of them. They really aren't peers, one is a building block of the other.
Joshua Bell
Comment 6
2012-10-31 09:45:02 PDT
(In reply to
comment #5
)
> yeah - this is more or less what I meant - I think snapshots is a necessary primitive which lets you create consistent read transactions, at least in the sense that IDB thinks of them. They really aren't peers, one is a building block of the other.
Yeah, but should we expose that building block separately for non-IDB usage? I'm still on the fence. Bundling it into LevelDBTransaction would definitely be less code. One could argue that maybe *all* LevelDBTransactions should work off of snapshots, matching the IDB semantics. We'd want to perf test that, though - right now LevelDBTransactions are "cheap" and also have no lifetime requirements w/r/t other LevelDB objects. ... Also, this patch is incomplete: it doesn't handle iterators - LevelDBTransaction::createIterator() should use the associated snapshot, and LevelDBDatabase::createIterator() should take an optional snapshot.
Joshua Bell
Comment 7
2012-10-31 11:27:20 PDT
Created
attachment 171693
[details]
Patch
Joshua Bell
Comment 8
2012-10-31 11:28:21 PDT
Updated patch w/ support and tests for snapshots w/ iterators (creating iterators against a snapshot, and creating iterators against a transaction based on a snapshot)
Joshua Bell
Comment 9
2012-11-01 17:07:20 PDT
Created
attachment 171955
[details]
Patch
Early Warning System Bot
Comment 10
2012-11-01 17:10:41 PDT
Comment on
attachment 171955
[details]
Patch
Attachment 171955
[details]
did not pass qt-ews (qt): Output:
http://queues.webkit.org/results/14696475
Early Warning System Bot
Comment 11
2012-11-01 17:12:16 PDT
Comment on
attachment 171955
[details]
Patch
Attachment 171955
[details]
did not pass qt-wk2-ews (qt): Output:
http://queues.webkit.org/results/14692640
Joshua Bell
Comment 12
2012-11-01 17:14:31 PDT
Created
attachment 171957
[details]
Patch
Joshua Bell
Comment 13
2012-11-02 09:06:41 PDT
Based on conversations with alecflett@, just made LevelDBTransactions take and use snapshots implicitly. This matches the IndexedDB needs. alecflett@ - please take a look
Alec Flett
Comment 14
2012-11-02 16:50:00 PDT
Comment on
attachment 171957
[details]
Patch lgtm (makes me wonder if you can now have 'const LevelDBSnapshot m_snapshot;' - not a big deal though)
Joshua Bell
Comment 15
2012-11-05 13:25:07 PST
Created
attachment 172387
[details]
Patch
Joshua Bell
Comment 16
2012-11-05 13:25:30 PST
(In reply to
comment #14
)
> (makes me wonder if you can now have 'const LevelDBSnapshot m_snapshot;' - not a big deal though)
Yes, thanks. Added const qualifier.
Joshua Bell
Comment 17
2012-11-05 13:25:44 PST
tony@ - r?
Joshua Bell
Comment 18
2012-11-07 09:41:06 PST
abarth@ - if you're bored (heh), could you take a look?
Adam Barth
Comment 19
2012-11-07 10:29:57 PST
Comment on
attachment 172387
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=172387&action=review
> Source/WebCore/platform/leveldb/LevelDBDatabase.h:56 > + LevelDBSnapshot(LevelDBDatabase*);
explicit
Adam Barth
Comment 20
2012-11-07 10:31:44 PST
Looks like Tony has been reviewing most of the changes to this code. I think he gets back from vacation tomorrow. If you're in a rush, I can rubber-stamp this change, but I'm not super familiar with the code.
Joshua Bell
Comment 21
2012-11-07 10:32:29 PST
(In reply to
comment #20
)
> Looks like Tony has been reviewing most of the changes to this code. I think he gets back from vacation tomorrow. If you're in a rush, I can rubber-stamp this change, but I'm not super familiar with the code.
No rush on this one, thanks for looking.
Joshua Bell
Comment 22
2012-11-07 10:35:25 PST
Created
attachment 172833
[details]
Patch
Tony Chang
Comment 23
2012-11-08 13:08:03 PST
Comment on
attachment 172833
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=172833&action=review
> Source/WebCore/platform/leveldb/LevelDBDatabase.h:46 > +class LevelDBDatabase; > class LevelDBComparator;
Nit: sort
Joshua Bell
Comment 24
2012-11-08 13:33:10 PST
Created
attachment 173107
[details]
Patch for landing
WebKit Review Bot
Comment 25
2012-11-08 13:41:28 PST
Comment on
attachment 173107
[details]
Patch for landing Rejecting
attachment 173107
[details]
from commit-queue. Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2 Last 500 characters of output: Core/platform/leveldb/LevelDBTransaction.h patching file Source/WebKit/chromium/tests/LevelDBTest.cpp patching file LayoutTests/ChangeLog Hunk #1 succeeded at 94 (offset 57 lines). patching file LayoutTests/platform/chromium/TestExpectations Hunk #1 FAILED at 4190. 1 out of 1 hunk FAILED -- saving rejects to file LayoutTests/platform/chromium/TestExpectations.rej Failed to run "[u'/mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply', u'--force']" exit_code: 1 cwd: /mnt/git/webkit-commit-queue Full output:
http://queues.webkit.org/results/14758883
Joshua Bell
Comment 26
2012-11-08 13:44:33 PST
> 1 out of 1 hunk FAILED -- saving rejects to file LayoutTests/platform/chromium/TestExpectations.rej
*sigh* Rebased onto a dirty tree and didn't notice it in the diff. Bleah.
Joshua Bell
Comment 27
2012-11-08 13:45:38 PST
Created
attachment 173110
[details]
Patch for landing
Joshua Bell
Comment 28
2012-11-08 13:46:20 PST
Comment on
attachment 173110
[details]
Patch for landing Ugh, no, it wasn't in my local diff. One more time.
Joshua Bell
Comment 29
2012-11-08 13:50:06 PST
Created
attachment 173112
[details]
Patch for landing
WebKit Review Bot
Comment 30
2012-11-08 15:48:12 PST
Comment on
attachment 173112
[details]
Patch for landing Clearing flags on attachment: 173112 Committed
r133963
: <
http://trac.webkit.org/changeset/133963
>
WebKit Review Bot
Comment 31
2012-11-08 15:48:16 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug