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


Attachments
Patch (15.27 KB, patch)
2011-11-16 17:30 PST, Joshua Bell
no flags Review Patch | Details | Formatted Diff | Diff
Patch (17.61 KB, patch)
2011-11-17 11:16 PST, Joshua Bell
no flags Review Patch | Details | Formatted Diff | Diff
Patch (24.15 KB, patch)
2011-11-17 12:15 PST, Joshua Bell
no flags Review Patch | Details | Formatted Diff | Diff
Patch (25.07 KB, patch)
2011-11-23 11:30 PST, Joshua Bell
no flags Review Patch | Details | Formatted Diff | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2011-11-16 17:30:03 PST
IndexedDB: Indexes should be secondarily sorted on primary key
------- Comment #1 From 2011-11-16 17:30:30 PST -------
Created an attachment (id=115491) [details]
Patch
------- Comment #2 From 2011-11-16 17:31:25 PST -------
I should probably add something to the IDBLevelDBCodingTest.cpp
------- Comment #3 From 2011-11-17 11:16:55 PST -------
Created an attachment (id=115623) [details]
Patch
------- Comment #4 From 2011-11-17 11:22:21 PST -------
(From update of attachment 115623 [details])
Ugh, I actually need to remove some of the logic around "sequence number"; it's unnecessary for new records.
------- Comment #5 From 2011-11-17 12:15:29 PST -------
Created an attachment (id=115652) [details]
Patch
------- Comment #6 From 2011-11-17 12:17:07 PST -------
(From update of attachment 115652 [details])
Should be good to go now, review at leisure.
------- Comment #7 From 2011-11-21 04:02:04 PST -------
(From update of attachment 115652 [details])
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 From 2011-11-23 09:03:41 PST -------
(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.

Alternately, I could add another overload that takes sequenceNumber in the "correct" order, that's only used for testing.
------- Comment #9 From 2011-11-23 09:25:55 PST -------
(In reply to comment #8)
> (In reply to comment #7)
> > (From update of attachment 115652 [details] [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 From 2011-11-23 11:30:46 PST -------
Created an attachment (id=116386) [details]
Patch
------- Comment #11 From 2011-11-23 11:31:45 PST -------
tony@ can you take a look?
------- Comment #12 From 2011-11-24 10:10:17 PST -------
(From update of attachment 116386 [details])
Clearing flags on attachment: 116386

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