[BUG] LiteDB ENSURE: stored slot must be same as called
See original GitHub issueVersion 5.0.10 .NET 4.7 Windows 2016
Describe the bug
I have a database in version 5.0.10. When upserting I got this error => “LiteDB ENSURE: stored slot must be same as called” and then it keet doing it If I reopen the database i got this error : LiteDB ENSURE: invalid segment position and then when inserting the previous errors is coming back.
Code to Reproduce
I can send the database (73MO)
Screenshots/Stacktrace
System.Exception: LiteDB ENSURE: stored slot must be same as called
at LiteDB.Constants.ENSURE(Boolean conditional, String message)
at LiteDB.Engine.Snapshot.GetFreeDataPage(Int32 bytesLength)
at LiteDB.Engine.DataService.<>c__DisplayClass3_0.<<Insert>g__source|0>d.MoveNext()
at LiteDB.Engine.BufferWriter…ctor(IEnumerable1 source) at LiteDB.Engine.DataService.Insert(BsonDocument doc) at LiteDB.Engine.LiteEngine.InsertDocument(Snapshot snapshot, BsonDocument doc, BsonAutoId autoId, IndexService indexer, DataService data) at LiteDB.Engine.LiteEngine.<>c__DisplayClass31_0.<Upsert>b__0(TransactionService transaction) at LiteDB.Engine.LiteEngine.AutoTransaction[T](Func
2 fn)
at LiteDB.LiteCollection`1.Upsert(T entity)
Thanks in advance for the help.
Regards
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:6 (1 by maintainers)
Top GitHub Comments
FYI for all: I managed to make a system for detecting this and repairing the DB by running .Rebuild() which failed due to trying to insert a duplicate ID, so I catch the exception, get all the data out of the DB by just using FindAll, and then create a new one fresh and insert the data into that one, then for the sake of cleanliness my application closes and re-opens to ensure a clean slate.
Is there a solution? Me too