[w3c/IndexedDB] Algorithm to "store a record" doesn't undo store on index constraint failure (#342)

https://w3c.github.io/IndexedDB/#object-store-storage-operation has:


Step 1.2: _...run possibly update the key generator for store with key_

Step 4: _Store a record in store containing..._

Steps 5.3 and 5.4: _If ... index already contains a record with key equal to index key, and index’s unique flag is true, then this operation failed with a "ConstraintError" DOMException. Abort this algorithm without taking any further steps._

There's no verbiage that the key generator update or store should be undone.

Similarly, if there are multiple indexes, there's no text indicating that a failure on a later index should undo any _...store a record in index..._ actions.

One approach might be to introduce transaction-like prose, e.g. rewrite the steps as "...tentatively store..." and have a final "commit any tentative changes" sep. 

A simpler change might be to have the "Abort this algorithm..." invocation include text to undo any changes to stores or key generator updates made by this algorithm. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/IndexedDB/issues/342

Received on Tuesday, 30 June 2020 20:21:45 UTC