This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing data inconsistency problem with lovefield/indexeddb. There is …
…currently the possibility for a bad transaction when you are trying to replace a row, in a single row object store. The problem manifests as follows - have a single row in an object store - do a transaction that deletes the row, and then inserts a new row - observe that in the end, no rows exist. The way this happens is that the lovefield journal flushing code allows its delete and put calls to race (i.e. not promise chained). Delete has a special optimization where it counts the number of rows in the table, and if the number of IDS to delete == the number of rows that exist, then it just clears the table. For the case of single row delete/insert, the following sequence can happen with the race. 1. delete code counts number of rows that exist (returns 1) 2. put happens (now number of rows == 2) 3. chained from 1, objectStore.clear() is called (removes 2 instead of 1) ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=171225366
- Loading branch information
Showing
9 changed files
with
469 additions
and
385 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.