IndexedDB 2.0: Massively speedup IDBIndex.get().
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Dec 2016 20:56:50 +0000 (20:56 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Dec 2016 20:56:50 +0000 (20:56 +0000)
commite604b51bd773b972c719cee71de7326b18f66fc4
tree53b285d4eb47f071ed87ed0bb5978a362b28ee93
parenta54e98100db2910f655db7939ffdcdb9d6ab934c
IndexedDB 2.0: Massively speedup IDBIndex.get().
https://bugs.webkit.org/show_bug.cgi?id=165802

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (No behavior change to Javascript, table upgrade change covered by API test).

This change upgrades the IndexRecords schema to include the ObjectStore record ID for the referenced record.
It also adds a SQLite Index-by-key on IndexRecords.

This speeds up PerformanceTests/IndexedDB/index-get.html by 15-20x.

* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::v3IndexRecordsTableSchema):
(WebCore::IDBServer::v3IndexRecordsTableSchemaAlternate):
(WebCore::IDBServer::v1IndexRecordsIndexSchema):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsTable):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidIndexRecordsIndex):
(WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo):
(WebCore::IDBServer::SQLiteIDBBackingStore::createIndex):
(WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexKey):
(WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::updateOneIndexForAddRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::addRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::getIndexRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey):
* Modules/indexeddb/server/SQLiteIDBBackingStore.h:

* Modules/indexeddb/server/SQLiteIDBCursor.cpp:
(WebCore::IDBServer::SQLiteIDBCursor::markAsErrored):
(WebCore::IDBServer::SQLiteIDBCursor::internalAdvanceOnce):
* Modules/indexeddb/server/SQLiteIDBCursor.h:
(WebCore::IDBServer::SQLiteIDBCursor::currentRecordRowID):

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/IDBIndexUpgradeToV2.html: Added.
* TestWebKitAPI/Tests/WebKit2Cocoa/IDBIndexUpgradeToV2.mm: Added.
* TestWebKitAPI/Tests/WebKit2Cocoa/IndexUpgrade.blob: Added.
* TestWebKitAPI/Tests/WebKit2Cocoa/IndexUpgrade.sqlite3: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209824 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h
Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp
Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.h
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IDBIndexUpgradeToV2.html [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IDBIndexUpgradeToV2.mm [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexUpgrade.blob [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexUpgrade.sqlite3 [new file with mode: 0644]