Bug 72567 - IndexedDB: Indexes should be secondarily sorted on primary key
: IndexedDB: Indexes should be secondarily sorted on primary key
Status: RESOLVED FIXED
Product: WebKit
Classification: Unclassified
Component: New Bugs
: 528+ (Nightly build)
: Unspecified Unspecified
: P2 Normal
Assigned To: Joshua Bell
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-16 17:30 PST by Joshua Bell
Modified: 2011-11-24 10:10 PST (History)
4 users (show)

See Also:


Attachments
Patch (15.27 KB, patch)
2011-11-16 17:30 PST, Joshua Bell
no flags Details | Formatted Diff | Diff
Patch (17.61 KB, patch)
2011-11-17 11:16 PST, Joshua Bell
no flags Details | Formatted Diff | Diff
Patch (24.15 KB, patch)
2011-11-17 12:15 PST, Joshua Bell
no flags Details | Formatted Diff | Diff
Patch (25.07 KB, patch)
2011-11-23 11:30 PST, 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 2011-11-16 17:30:03 PST
IndexedDB: Indexes should be secondarily sorted on primary key
Comment 1 Joshua Bell 2011-11-16 17:30:30 PST
Created attachment 115491 [details]
Patch
Comment 2 Joshua Bell 2011-11-16 17:31:25 PST
I should probably add something to the IDBLevelDBCodingTest.cpp
Comment 3 Joshua Bell 2011-11-17 11:16:55 PST
Created attachment 115623 [details]
Patch
Comment 4 Joshua Bell 2011-11-17 11:22:21 PST
Comment on attachment 115623 [details]
Patch

Ugh, I actually need to remove some of the logic around "sequence number"; it's unnecessary for new records.
Comment 5 Joshua Bell 2011-11-17 12:15:29 PST
Created attachment 115652 [details]
Patch
Comment 6 Joshua Bell 2011-11-17 12:17:07 PST
Comment on attachment 115652 [details]
Patch

Should be good to go now, review at leisure.
Comment 7 Hans Wennborg 2011-11-21 04:02:04 PST
Comment on attachment 115652 [details]
Patch

Looks great, thanks for fixing this!

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

> Source/WebCore/ChangeLog:7
> +

Maybe say a few words in the Changelog about how this is implemented, i.e. that we're appending the primary key to index data keys.

> Source/WebKit/chromium/ChangeLog:6
> +        Reviewed by NOBODY (OOPS!).

I would probably add a line saying that this updates the unit test.

> Source/WebCore/storage/IDBLevelDBCoding.cpp:1429
> +Vector<char> IndexDataKey::encode(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const Vector<char>& encodedUserKey, const Vector<char>& encodedPrimaryKey, int64_t sequenceNumber)

hmm, maybe we should change the parameter order here? So far, I think they've been in the same order that we encode them.

> LayoutTests/storage/indexeddb/cursor-primary-key-order.html:95
> +    curreq = evalAndLog("curreq = index.openCursor()");

not super happy about "curreq" as name.. cursorRequest, or just request, maybe?
Comment 8 Joshua Bell 2011-11-23 09:03:41 PST
(In reply to comment #7)
> (From update of attachment 115652 [details])
> 
> > Source/WebCore/storage/IDBLevelDBCoding.cpp:1429
> > +Vector<char> IndexDataKey::encode(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const Vector<char>& encodedUserKey, const Vector<char>& encodedPrimaryKey, int64_t sequenceNumber)
> 
> hmm, maybe we should change the parameter order here? So far, I think they've been in the same order that we encode them.

Following this change, sequenceNumber is unnecessary except for testing; it has a default in the header, so I wanted it to be last.

Alternately, I could add another overload that takes sequenceNumber in the "correct" order, that's only used for testing.
Comment 9 Hans Wennborg 2011-11-23 09:25:55 PST
(In reply to comment #8)
> (In reply to comment #7)
> > (From update of attachment 115652 [details] [details])
> > 
> > > Source/WebCore/storage/IDBLevelDBCoding.cpp:1429
> > > +Vector<char> IndexDataKey::encode(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const Vector<char>& encodedUserKey, const Vector<char>& encodedPrimaryKey, int64_t sequenceNumber)
> > 
> > hmm, maybe we should change the parameter order here? So far, I think they've been in the same order that we encode them.
> 
> Following this change, sequenceNumber is unnecessary except for testing; it has a default in the header, so I wanted it to be last.

Didn't realize there was a default in the header. Never mind, then.
Comment 10 Joshua Bell 2011-11-23 11:30:46 PST
Created attachment 116386 [details]
Patch
Comment 11 Joshua Bell 2011-11-23 11:31:45 PST
tony@ can you take a look?
Comment 12 WebKit Review Bot 2011-11-24 10:10:17 PST
Comment on attachment 116386 [details]
Patch

Clearing flags on attachment: 116386

Committed r101142: <http://trac.webkit.org/changeset/101142>
Comment 13 WebKit Review Bot 2011-11-24 10:10:21 PST
All reviewed patches have been landed.  Closing bug.