OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Package txnBuf contains a transaction buffer filter for the datastore |
| 6 // service. |
| 7 // |
| 8 // By default, datastore transactions take a snapshot of the entity group as |
| 9 // soon as you Get or Put into it. All subsequent Get (and query) operations |
| 10 // reflect the state of the ORIGINAL transaction snapshot, regardless of any |
| 11 // Put/Delete operations you've done since the beginning of the transaction. |
| 12 // |
| 13 // If you've installed this transaction buffer, then: |
| 14 // - All mutations will be reflected in all read operations (see LIMITATIONS). |
| 15 // Without the buffer, read operations always observe the state of the |
| 16 // entity group(s) at the time that the transaction started. |
| 17 // |
| 18 // - All mutation operations will be buffered until the close of the |
| 19 // transaction. This can help reduce the transaction size, and thus avoid |
| 20 // the transaction size limit (currently 10MB). Multiple puts to the same |
| 21 // entity will not increase the transaction size multiple times. |
| 22 // |
| 23 // - Transactions inside of an existing transaction will add to their outer |
| 24 // transaction if they don't cause the outer transaction to exceed its |
| 25 // size budget. |
| 26 // |
| 27 // - If an inner transaction would cause the OUTERMOST transaction to exceed |
| 28 // the appengine-imposed 10MB transaction size limit, an error will be |
| 29 // returned from the inner transaction, instead of adding it into the |
| 30 // outermost transaction. This only applies to the first level of inner |
| 31 // transactions, and does not apply to recursive transactions. The reason |
| 32 // for this is that it's entirely feasible for inner transactions to |
| 33 // temporarially exceed the limit, but still only commit an outer |
| 34 // transaction which is under the limit. An example of this would be having |
| 35 // one inner-inner transaction add a lot of large entities and then having |
| 36 // a subsequent inner-inner transaction delete some of those entities. |
| 37 // |
| 38 // LIMITATIONS (only inside of a transaction) |
| 39 // - KeysOnly/Projection/Count queries are supported, but may incur additional |
| 40 // costs. |
| 41 // |
| 42 // These query types are implemented via projection queries, but will |
| 43 // project all order-by fields in addition to any specified in the original |
| 44 // query. |
| 45 // |
| 46 // - Distinct Projection queries do all 'distinct' deduplication in-memory. |
| 47 // This could make them substantially more expensive than their native |
| 48 // equivalent. |
| 49 // |
| 50 // - Metadata entities (e.g. `__entity_group__`) will reflect their values as |
| 51 // they were at the beginning of the transaction, and will not increment |
| 52 // as you write inside of the transaction. |
| 53 // |
| 54 // - Query cursors are not supported. Since the cursor format for the |
| 55 // in-memory datastore implementation isn't compatible with the production |
| 56 // cursors, it would be pretty tricky to make it so that cursors were |
| 57 // viable outside the transaction as well as inside of it while also having |
| 58 // it accurately reflect the 'merged' query results. |
| 59 // |
| 60 // - No parallel access to datastore while in a transaction; all nested |
| 61 // transactions are serialized. This is done for simplicity and correctness. |
| 62 // |
| 63 // - The changing of namespace inside of a transaction is undefined... This is |
| 64 // just generally a terrible idea anyway, but I thought it was worth |
| 65 // mentioning. |
| 66 package txnBuf |
OLD | NEW |