Bug 190917 - IndexedDB: iteration of cursors skip records if updated or deleted
Summary: IndexedDB: iteration of cursors skip records if updated or deleted
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sihui Liu
URL:
Keywords: InRadar
Depends on: 207437
Blocks:
  Show dependency treegraph
 
Reported: 2018-10-25 13:54 PDT by Sihui Liu
Modified: 2020-02-08 21:09 PST (History)
8 users (show)

See Also:


Attachments
Patch (10.20 KB, patch)
2018-10-25 17:30 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-sierra (2.37 MB, application/zip)
2018-10-25 18:30 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews104 for mac-sierra-wk2 (2.93 MB, application/zip)
2018-10-25 18:40 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews125 for ios-simulator-wk2 (2.34 MB, application/zip)
2018-10-25 19:21 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews204 for win-future (12.71 MB, application/zip)
2018-10-25 19:25 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews112 for mac-sierra (3.37 MB, application/zip)
2018-10-25 20:57 PDT, EWS Watchlist
no flags Details
Patch (12.13 KB, patch)
2018-10-26 11:28 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews201 for win-future (12.75 MB, application/zip)
2018-10-26 13:07 PDT, EWS Watchlist
no flags Details
Patch (17.18 KB, patch)
2018-10-26 23:08 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews204 for win-future (12.81 MB, application/zip)
2018-10-27 00:43 PDT, EWS Watchlist
no flags Details
Patch (13.25 KB, patch)
2018-10-29 16:36 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews107 for mac-sierra-wk2 (3.36 MB, application/zip)
2018-10-29 17:33 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews102 for mac-sierra (2.37 MB, application/zip)
2018-10-29 17:37 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews112 for mac-sierra (3.06 MB, application/zip)
2018-10-29 18:32 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews123 for ios-simulator-wk2 (2.31 MB, application/zip)
2018-10-29 18:38 PDT, EWS Watchlist
no flags Details
Patch (13.39 KB, patch)
2018-10-29 18:50 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff
Patch for landing (13.29 KB, patch)
2018-10-30 09:34 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sihui Liu 2018-10-25 13:54:52 PDT
If we update or delete a record using cursor, when the cursor continues, it would skip records with same key value.
w3c test: w3c/web-platform-tests/blob/master/IndexedDB/idbcursor-iterating-update.htm.
Comment 1 Sihui Liu 2018-10-25 13:55:56 PDT
<rdar://problem/35250410>
Comment 2 Sihui Liu 2018-10-25 17:30:25 PDT
Created attachment 353133 [details]
Patch
Comment 3 EWS Watchlist 2018-10-25 18:30:48 PDT
Comment on attachment 353133 [details]
Patch

Attachment 353133 [details] did not pass mac-ews (mac):
Output: https://webkit-queues.webkit.org/results/9732484

New failing tests:
imported/w3c/web-platform-tests/IndexedDB/idbcursor-iterating-update.htm
Comment 4 EWS Watchlist 2018-10-25 18:30:50 PDT
Created attachment 353137 [details]
Archive of layout-test-results from ews102 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 5 EWS Watchlist 2018-10-25 18:40:53 PDT
Comment on attachment 353133 [details]
Patch

Attachment 353133 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/9732516

New failing tests:
imported/w3c/web-platform-tests/IndexedDB/idbcursor-iterating-update.htm
Comment 6 EWS Watchlist 2018-10-25 18:40:55 PDT
Created attachment 353139 [details]
Archive of layout-test-results from ews104 for mac-sierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews104  Port: mac-sierra-wk2  Platform: Mac OS X 10.12.6
Comment 7 EWS Watchlist 2018-10-25 19:21:00 PDT
Comment on attachment 353133 [details]
Patch

Attachment 353133 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/9732594

New failing tests:
imported/w3c/web-platform-tests/IndexedDB/idbcursor-iterating-update.htm
Comment 8 EWS Watchlist 2018-10-25 19:21:01 PDT
Created attachment 353143 [details]
Archive of layout-test-results from ews125 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews125  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.6
Comment 9 EWS Watchlist 2018-10-25 19:24:59 PDT
Comment on attachment 353133 [details]
Patch

Attachment 353133 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/9732938

New failing tests:
storage/indexeddb/cursor-added-bug.html
storage/indexeddb/modern/index-cursor-3.html
Comment 10 EWS Watchlist 2018-10-25 19:25:10 PDT
Created attachment 353144 [details]
Archive of layout-test-results from ews204 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews204  Port: win-future  Platform: CYGWIN_NT-6.1-2.10.0-0.325-5-3-x86_64-64bit
Comment 11 EWS Watchlist 2018-10-25 20:57:32 PDT
Comment on attachment 353133 [details]
Patch

Attachment 353133 [details] did not pass mac-debug-ews (mac):
Output: https://webkit-queues.webkit.org/results/9733348

New failing tests:
imported/w3c/web-platform-tests/IndexedDB/idbcursor-iterating-update.htm
Comment 12 EWS Watchlist 2018-10-25 20:57:34 PDT
Created attachment 353152 [details]
Archive of layout-test-results from ews112 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews112  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 13 Sihui Liu 2018-10-26 11:28:09 PDT
Created attachment 353194 [details]
Patch
Comment 14 EWS Watchlist 2018-10-26 13:07:45 PDT
Comment on attachment 353194 [details]
Patch

Attachment 353194 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/9742110

New failing tests:
storage/indexeddb/cursor-added-bug.html
storage/indexeddb/modern/index-cursor-3.html
Comment 15 EWS Watchlist 2018-10-26 13:07:56 PDT
Created attachment 353205 [details]
Archive of layout-test-results from ews201 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews201  Port: win-future  Platform: CYGWIN_NT-6.1-2.10.0-0.325-5-3-x86_64-64bit
Comment 16 Chris Dumez 2018-10-26 14:15:10 PDT
Comment on attachment 353194 [details]
Patch

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

> Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp:219
> +    fetch(true);

We like to use enum classes for parameters like this so that it looks obvious from the call site what the parameter means:
enum class shouldFetchForSameKey : bool { No, Yes };
Comment 17 Sihui Liu 2018-10-26 23:08:30 PDT
Created attachment 353223 [details]
Patch
Comment 18 EWS Watchlist 2018-10-27 00:43:23 PDT
Comment on attachment 353223 [details]
Patch

Attachment 353223 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/9746753

New failing tests:
storage/indexeddb/cursor-added-bug.html
storage/indexeddb/cursor-update-while-iterating.html
Comment 19 EWS Watchlist 2018-10-27 00:43:35 PDT
Created attachment 353226 [details]
Archive of layout-test-results from ews204 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews204  Port: win-future  Platform: CYGWIN_NT-6.1-2.10.0-0.325-5-3-x86_64-64bit
Comment 20 Sihui Liu 2018-10-29 16:36:02 PDT
Created attachment 353332 [details]
Patch
Comment 21 EWS Watchlist 2018-10-29 17:33:03 PDT
Comment on attachment 353332 [details]
Patch

Attachment 353332 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/9773423

New failing tests:
storage/indexeddb/cursor-update-while-iterating.html
Comment 22 EWS Watchlist 2018-10-29 17:33:04 PDT
Created attachment 353336 [details]
Archive of layout-test-results from ews107 for mac-sierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-sierra-wk2  Platform: Mac OS X 10.12.6
Comment 23 EWS Watchlist 2018-10-29 17:37:18 PDT
Comment on attachment 353332 [details]
Patch

Attachment 353332 [details] did not pass mac-ews (mac):
Output: https://webkit-queues.webkit.org/results/9773475

New failing tests:
storage/indexeddb/cursor-update-while-iterating.html
Comment 24 EWS Watchlist 2018-10-29 17:37:20 PDT
Created attachment 353337 [details]
Archive of layout-test-results from ews102 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 25 EWS Watchlist 2018-10-29 18:32:55 PDT
Comment on attachment 353332 [details]
Patch

Attachment 353332 [details] did not pass mac-debug-ews (mac):
Output: https://webkit-queues.webkit.org/results/9773547

New failing tests:
storage/indexeddb/cursor-update-while-iterating.html
Comment 26 EWS Watchlist 2018-10-29 18:32:57 PDT
Created attachment 353339 [details]
Archive of layout-test-results from ews112 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews112  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 27 EWS Watchlist 2018-10-29 18:38:55 PDT
Comment on attachment 353332 [details]
Patch

Attachment 353332 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/9773558

New failing tests:
storage/indexeddb/cursor-update-while-iterating.html
Comment 28 EWS Watchlist 2018-10-29 18:38:57 PDT
Created attachment 353342 [details]
Archive of layout-test-results from ews123 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews123  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.6
Comment 29 Sihui Liu 2018-10-29 18:50:38 PDT
Created attachment 353343 [details]
Patch
Comment 30 Chris Dumez 2018-10-30 09:05:51 PDT
Comment on attachment 353343 [details]
Patch

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

r=me with comments

> LayoutTests/storage/indexeddb/resources/cursor-update-while-iterating.js:10
> +objectArray = [

const objectArray ?

> LayoutTests/storage/indexeddb/resources/cursor-update-while-iterating.js:19
> +    for (var i = 0; i < objectArray.length; i ++)

No space between i and ++. In this case though, I think the loop for look better like so:
for (let object of objectArray)
    objectStore.add(object).onerror = unexpectedErrorCallback;

> LayoutTests/storage/indexeddb/resources/cursor-update-while-iterating.js:39
> +    trans = evalAndLog("trans = db.transaction('objectStore', 'readwrite')");

Let's call it transaction or t, 'trans' looks weird.

> LayoutTests/storage/indexeddb/resources/cursor-update-while-iterating.js:65
> +                debug("FAIL: cursor didn't go through whole array.");

testFailed("Cursor didn't go through whole array.");

> LayoutTests/storage/indexeddb/resources/cursor-update-while-iterating.js:67
> +                debug("Successfully iterated whole array with cursor updates.")

testPassed("Successfully iterated whole array with cursor updates.");
Comment 31 Sihui Liu 2018-10-30 09:34:32 PDT
Created attachment 353375 [details]
Patch for landing
Comment 32 WebKit Commit Bot 2018-10-30 10:11:46 PDT
Comment on attachment 353375 [details]
Patch for landing

Clearing flags on attachment: 353375

Committed r237590: <https://trac.webkit.org/changeset/237590>
Comment 33 WebKit Commit Bot 2018-10-30 10:11:49 PDT
All reviewed patches have been landed.  Closing bug.