Transaction cancelled when index does not exist
See original GitHub issueIf there is a query inside a transaction, and index on the field is not created yet, then after query executes transaction is in the Canceled state.
That happens because when there is no index, IndexNotFoundException is thrown first, and inner transaction in DbEngine.Find is rolled back (and outer transaction cancelled). Upper in the stack exception get caught and index created, and query succeeds. But outer transaction could not be committed because it’s cancelled.
Test to reproduce:
[TestMethod]
public void TestIndexCreationInsideTransaction()
{
using (var tmp = new TempFile())
{
using (var db = new LiteDatabase(tmp.ConnectionString))
{
var col = db.GetCollection("col");
using (var trans = db.BeginTrans())
{
col.Insert(new BsonDocument().Add("test", 0));
var query = Query.EQ("test", 0);
// Index is created here
col.Find(query).ToList();
// Fails with TransactionCanceledException
trans.Commit();
}
}
}
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:16 (8 by maintainers)
Top Results From Across the Web
TransactionCanceledException (AWS SDK for Java - 1.12.533)
There is insufficient provisioned capacity for the transaction to be completed. An item size becomes too large (larger than 400 KB), or a...
Read more >Troubleshoot TransactWriteItems API failing with Amazon ...
There are a number of reasons that a TransactWriteItems request might fail or ... "message": "Transaction cancelled, please refer cancellation reasons for ...
Read more >Create index CONCURRENTLY in PostgreSQL
Because of this the index does not exist when the transaction is aborted (the create index statement is canceled). When you build the...
Read more >TransactionCanceledException (AWS SDK for Java
There is insufficient provisioned capacity for the transaction to be completed. An item size becomes too large (larger than 400 KB), or a...
Read more >TransactWriteItems - Amazon DynamoDB - AWS Documentation
The entire transaction request was canceled. DynamoDB cancels a TransactWriteItems request under the following circumstances:
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
All clear. I understand now. Thanks for clearing this up
Hi @baSSiLL, I will try to take a look on this. I’m out of time for last days. Transactions will be die 😃 To be thread safe, next version will not support transactions (ACID will be only in document level).