w3c / IndexedDB

Indexed Database API
https://w3c.github.io/IndexedDB/
Other
240 stars 62 forks source link

How a transaction is implemented as a queue hang #291

Open liangzhuang327 opened 5 years ago

liangzhuang327 commented 5 years ago

Generally speaking, the above requirements mean that any transaction which has an overlapping scope with a read/write transaction and which was created after that read/write transaction, can’t run in parallel with that read/write transaction.(Mentioned in W3C

And my question is : How does indexedDB do to suspend the remaining transactions when multiple read/write transactions are opened at the same time? Is it done with the browser's Event Loop?

inexorabletash commented 4 years ago

The transaction processing model is somewhat underspecified (and has been the case since the initial IDB spec); the relevant text is in https://w3c.github.io/IndexedDB/#transaction-scheduling and https://w3c.github.io/IndexedDB/#transaction-lifecycle which rather informally defines the preconditions for a transaction to start.

Ideally, the spec would define transaction scheduling e.g. as a parallel queue. The steps are not run synchronously with any agent's (document's/worker's) event queue.

PRs that firm up transaction behavior here would be welcome.