diff --git a/index.bs b/index.bs index 4de017b..82f9c67 100644 --- a/index.bs +++ b/index.bs @@ -892,10 +892,9 @@ and data mutation operations. All transactions are created through a [=/connection=], which is the transaction's connection. -A [=/transaction=] has a scope that determines the -[=/object stores=] with which the transaction may interact. A -transaction's scope remains fixed for the lifetime of that -transaction. +A [=/transaction=] has a scope which is a [=/set=] of [=/object stores=] that the transaction may interact with. A transaction's scope remains fixed for the lifetime of that transaction. + +Two [=/transactions=] have overlapping scope if any [=/object store=] is in both transactions' [=transaction/scope=]. A [=/transaction=] has a mode that determines which types of interactions can be performed upon that transaction. The [=transaction/mode=] @@ -908,7 +907,7 @@ following: The transaction is only allowed to read data. No modifications can be done by this type of transaction. This has the advantage that several [=read-only transactions=] can run at the same time even - if their [=transaction/scopes=] are overlapping, i.e. if they are using the + if their [=transaction/scopes=] are [=overlapping=], i.e. if they are using the same object stores. This type of transaction can be created any time once a database has been opened. @@ -917,7 +916,7 @@ following: The transaction is allowed to read, modify and delete data from existing object stores. However object stores and indexes can't be added or removed. Multiple {{"readwrite"}} transactions - can't run at the same time if their [=transaction/scopes=] are overlapping + can't run at the same time if their [=transaction/scopes=] are [=overlapping=] since that would mean that they can modify each other's data in the middle of the transaction. This type of transaction can be created any time once a database has been opened. @@ -1115,87 +1114,42 @@ They will return true if any transactions were cleaned up, or false otherwise. each [=/transaction=]. - -### Transaction scheduling ### {#transaction-scheduling} - - An event with type `complete` is fired at a [=/transaction=] that has successfully [=transaction/committed=]. An event with type `abort` is fired at a [=/transaction=] that has [=transaction/aborted=]. -The following constraints define when a [=/transaction=] can be -[=transaction/started=]: + +### Transaction scheduling ### {#transaction-scheduling} + -* Any number of [=read-only transactions=] are allowed to run - concurrently, even if the transaction's [=transaction/scope=] overlap and - include the same [=/object stores=]. As long as a [=read-only - transaction=] is running, the data that the implementation returns - through [=/requests=] created with that transaction must remain - constant. That is, two requests to read the same piece of data - must yield the same result both for the case when data is found - and the result is that data, and for the case when data is not - found and a lack of data is indicated. +The following constraints define when a [=/transaction=] can be [=transaction/started=]: - +* A [=read-only transactions=] |tx| can [=transaction/start=] when there are no read/write transactions which: + * Were [=transaction/created=] before |tx|; and + * have [=overlapping scopes=] with |tx|; and + * are not [=transaction/finished=]. +* A read/write transaction |tx| can [=transaction/start=] when there are no [=/transactions=] which: + * Were [=transaction/created=] before |tx|; and + * have [=overlapping scopes=] with |tx|; and + * are not [=transaction/finished=]. -* Similarly, implementations must ensure that a read/write - transaction is only affected by changes to [=/object - stores=] that are made using the transaction itself. For - example, the implementation must ensure that another transaction - does not modify the contents of [=/object stores=] in the - read/write transaction's [=transaction/scope=]. The implementation - must also ensure that if the read/write transaction - completes successfully, the changes written to [=/object - stores=] using the transaction can be committed to the - [=database=] without merge conflicts. An implementation must - not abort a transaction due to merge conflicts. - -* If multiple read/write transactions are attempting to access - the same object store (i.e. if they have overlapping [=transaction/scope=]), - the transaction that was [=transaction/created=] first must be the transaction - which gets access to the object store first. Due to the - requirements in the previous paragraph, this also means that it is - the only transaction which has access to the object store until - the transaction is [=transaction/finished=]. - -* Any transaction [=transaction/created=] after a read/write transaction - must see the changes written by the read/write transaction. - So if a read/write transaction, A, is created, and later - another transaction B, is created, and the two transactions have - overlapping [=transaction/scopes=], then B must see any changes made to any - [=/object stores=] that are part of that overlapping [=transaction/scope=]. - Due to the requirements in the previous paragraph, this also means - that the B transaction does not have access to any [=/object - stores=] in that overlapping [=transaction/scope=] until the A transaction is - [=transaction/finished=]. +Implementations may impose additional constraints. For example, implementations are not required to run non-[=overlapping=] read/write transactions in parallel, or may impose limits on the number of running transactions. - + + ### Upgrade transactions ### {#upgrade-transaction-construct} @@ -6864,6 +6818,7 @@ For the revision history of the second edition, see [that document's Revision Hi * Restrict array keys to [=/Array exotic objects=] (i.e. disallow proxies). ([Issue #309](https://github.com/w3c/IndexedDB/issues/309)) * Transactions are now temporarily made inactive during clone operations. * Added {{IDBTransactionOptions/durability}} option and {{IDBTransaction/durability}} attribute. ([Issue #50](https://github.com/w3c/IndexedDB/issues/50)) +* Specified [[#transaction-scheduling]] more precisely and disallow starting read/write transactions while read-only transactions with overlapping scope are running. ([Issue #253](https://github.com/w3c/IndexedDB/issues/253)) # Acknowledgements # {#acknowledgements}