Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] LiteDB ENSURE: stored slot must be same as called #1984

Open
alb3ric opened this issue Apr 12, 2021 · 6 comments
Open

[BUG] LiteDB ENSURE: stored slot must be same as called #1984

alb3ric opened this issue Apr 12, 2021 · 6 comments
Labels

Comments

@alb3ric
Copy link

alb3ric commented Apr 12, 2021

Version
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.<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](Func2 fn)
at LiteDB.LiteCollection`1.Upsert(T entity)

Thanks in advance for the help.

Regards

@alb3ric alb3ric added the bug label Apr 12, 2021
@mbdavid
Copy link
Owner

mbdavid commented Apr 13, 2021

Hi @alb3ric, this ensure prevent database to be corrupted. I add this checkes to capture corruption problems...

Can you send me your database (have any sensitive/customer data)? You can send to mauricio.david at gmail.

@alb3ric
Copy link
Author

alb3ric commented Apr 13, 2021

Hello Mauricio,

I understand that the checks is to capture corruption problems and I think it's great.
I just don't understand why I get this error :)

I just sent you the file by email.

Thanks in advance.

Regards

@honorew
Copy link

honorew commented May 25, 2021

Is there a solution? Me too

@BenWoodford
Copy link

I too would like to know how to avoid/solve this issue...

@BenWoodford
Copy link

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.

@zhoushinian
Copy link

any solutions? how to avoid/solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants