Skip to content

[BUG] Multiple call of GetPlan method throw exeption #1681

@mikhail-khalizev

Description

@mikhail-khalizev

Version
5.0.7

Describe the bug
Multiple call of GetPlan method throw LiteDB.LiteException : Maximum number of transactions reached

Code to Reproduce

public class Customer
{
    public string Login { get; set; }
    public string Name { get; set; }
}

[Fact]
public void CallGetPlanManyTimes()
{
    using (var db = new LiteDatabase(":memory:"))
    {
        var col = db.GetCollection<Customer>("col");
        col.Insert(new Customer { Name = "name1" });
        col.Insert(new Customer { Name = "name2" });
        
        for (var i = 0; i < 200; i++)
        {
            var query = col.Query().Where(x => x.Name == "name1");
            var plan = query.GetPlan();
        }
    }
}

Expected behavior
No exception thrown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions