adospace / litedbpad

LinqPad driver for LiteDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Database size exceeds limit of 0B

michalhainc opened this issue · comments

Hi opened my db

there is ~7K documents in the Telemetry collection, tried FindAll() and got this error (see screenshot)

LinqPad version: 5.26.01

image

Count method for example... it works.

Are you able to open the database in a standard application? it seems like the database is somewhat corrupted

Yes I am able to open the db in this app https://github.com/falahati/LiteDBViewer and also in my .net app
so I suppose it is okay.

OK, I've updated the driver to latest LiteDB version (4.1.4). Please download the new driver and see if it works.
In case it doesn't please test connection, it should give you an exception stack trace:

image

Hi, thanks for trying to resolve the issue.
Updated my lpx file with your latest commit,
I did what you asked for, here is the result:

No error on test connection. But Telemetry.FindAll() -> the issue still present
image

FindOne... same issue:
image

Count works on this collection:
image

Same file opened in https://github.com/falahati/LiteDBViewer:
image

One way how I could help to debug is I will have a look in my db if there is some sensitive data and if not I can send the file over to you.

I played a bit with the litedb shell and when I try find operation without filter I get this exception directly from litedb:

image

So maybe your code just doesn't bubble this exception up to the user.

This makes me feel that something is really wrong with my db and the https://github.com/falahati/LiteDBViewer just selects first N objects from the collection and doesnt hit this error.

It looks like few people have hit this issue as well, here is some search in LiteDb gitbug issue list:
https://github.com/mbdavid/litedb/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+Unable+to+cast+object+of+type+%27LiteDB.EmptyPage%27

Just ignore the previous post... I have now another copy of the db file with double amount of records then before. Now the LiteDb Shell behaves fine when doing find all query, but your linq pad driver has still the same problem. I believe the file before was somehow damaged because stupid me copied it while the app writing to it was running. Now I copied with the app stopped.

So I cloned your repo and I attached VS debugger to the linqpad and its query processes and I got this stack trace for 'Telemetry.FindOne(x=>true)':

LiteDB.LiteException: Database size exceeds limit of 0B.
   at LiteDB.FileDiskService.SetLength(Int64 fileSize)
   at LiteDB.TransactionService.Commit()
   at LiteDB.LiteEngine.Commit()
   at LiteDB.LiteEngine.Transaction[T](String collection, Boolean addIfNotExists, Func`2 action)
   at LiteDB.LiteEngine.EnsureIndex(String collection, String field, Boolean unique)
   at LiteDB.LiteCollection`1.IndexFactory(String field)
   at LiteDB.LiteCollection`1.<Find>b__17_0(String c, String f)
   at LiteDB.Query.Run(CollectionPage col, IndexService indexer)
   at LiteDB.LiteEngine.<Find>d__51.MoveNext()
   at LiteDB.LiteCollection`1.<Find>d__17.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at LiteDB.LiteCollection`1.FindOne(Expression`1 predicate)
   at UserQuery.RunUserAuthoredQuery() in C:\Users\mhainc\AppData\Local\Temp\LINQPad5\_vvhyqhid\query_kgyprf.cs:line 37
   at LINQPad.ExecutionModel.ClrQueryRunner.Run()
   at LINQPad.ExecutionModel.Server.RunQuery(QueryRunner runner)

ok, can you test the new version I've just posted?
Please ensure to use last version (1.0.4) as from your screenshots seems you're using an old one, also ensure that Journal = true and LimitSize = is long.MaxValue (both by default).

image

image

I already played with these limit numbers, but to no effect, I will try with the new version

Wonderfull, thank you

image