0

Working with LiteDB, the initial construction of the database has no real issue, however on subsequent loads, it is trying to find a file which does not exist.

According to their documentation, journaling is something that is on by default, however it does not document how to disable this, or more ideal, how to ensure that the journal file actually gets created.

You can use their demonstration from their website, or the code from my other stackoverflow issue ( LiteDB: Invalid BSON data type 'Null' on field '_id' )which will demonstrate this problem by generating the following exception with tracing open :

Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll ("Could not find file 'D:\Code\bin\Debug\cache-journal.db'.")

... where D:\Code\bin\Debug\ will vary based on where you are testing this from.

My questions which I believe should take care of the above exception are :

  • How can I ensure the journal file is created ?
  • How can I disable journaling (if desired) ?
Community
  • 1
  • 1
Kraang Prime
  • 9,981
  • 10
  • 58
  • 124
  • According to [the documentation](https://github.com/mbdavid/LiteDB/wiki/Journaling-and-Recovery), you can disable journaling by adding "; journal=false" to the connection string. – Anon Coward Jul 13 '16 at 01:31
  • @AnonCoward - thank you, that helps to clear up one of the questions here. It will at least eliminate errors on loading for now. Now just need an answer for the other question. (also, thank you for that link. I missed that Journaling link on their wiki :) – Kraang Prime Jul 13 '16 at 01:35
  • Yep, hopefully someone that knows litedb can answer that side of things. Though, a quick google shows [this issue](https://github.com/mbdavid/LiteDB/issues/148) that was closed 3 days ago, so you might just be seeing a bug. – Anon Coward Jul 13 '16 at 01:37
  • @AnonCoward - yes, i did see that issue already, i am working from master tree from going on almost 2 days ago which is later than that issues closure date. I keep re-reading it as it keeps coming up in google queries among some semi-gems, and mostly unrelated to litedb at all stuff. – Kraang Prime Jul 13 '16 at 01:39
  • Hi guys, I'm from LiteDB. This issue was fixed in march, but I closed only 4 days ago. Please, use tag v.2.0.0-rc for now... LiteDB is updating for final release v2 when will suport portable plataforms. – mbdavid Jul 13 '16 at 20:34

1 Answers1

1

In v1.0.4: Journal mode are enabled by default and can be disabled in connection string using journal=false. But will still testing for a journal file when open database.

In 2.0.0-rc: Journal mode are enabled only in disk implementation (no journal in Stream initialization). To disabled, use journal=false. Now, if you journal are disabled - no disk checks.

mbdavid
  • 1,076
  • 7
  • 8
  • Current build of 2.0.0-rc, fails to initialize at all, however 1.0.4 will still throw the file not found exception internally even after `filename=cache.db; journal=false`. The difference in adding that string is instead of 2 errors, I get 1 error. – Kraang Prime Jul 14 '16 at 20:47
  • 1
    I'm current updating LiteDB in master branch. Please, download this version of v2 that will works. https://github.com/mbdavid/LiteDB/tree/00665de7322f1e48b40a7084f58dcded3243b6d9 – mbdavid Jul 15 '16 at 21:29