dgraph-io / badger

Fast key-value DB in Go.

Home Page:https://dgraph.io/badger

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[QUESTION]: Is it possible to access/open DB by one write process and multiple read processes?

PD-Pramila opened this issue · comments

Question.

No response

I am getting error " can not lock the dir" while opening it using readonly option, when it's already opened with default options.

I also tried to open just readonly mode, but it also fails.

Hi @PD-Pramila, this is not allowed right now.

Just to finally confirm. We can open DB once and that is for write/read only, correct??
We even can not open it just for read only, right?

Any plans to support it?

You can open the DB for read only if you like.

How to open for read only mode? When I set readonly option in options and try to open DB it gives errors.

For DB, which has some data stored in it:
error while opening memtables error: while opening fid: 39 error: while updating skiplist error: end offset: 20 < size: 134217728 error: Log truncate required to run DB. This might result in data loss\ngithub.com/dgraph-io/badger/v3.init

For new dir, when there is no data and try to open for read only:
no manifest found, required for read-only db"

I think, because the db was not closed properly. If you open it once in write mode and close it properly, you should be able to open it in read only mode after that.