tm-db icon indicating copy to clipboard operation
tm-db copied to clipboard

BoltDB cannot state sync

Open faddat opened this issue 3 years ago • 4 comments

Bolt stores everything as a single file (iirc)

So now we get:

panic: failed to initialize database: open /Users/faddat/.osmosisd/data/snapshots/metadata.db: no such file or directory

Feedback needed, please let me know which direction to take:

  • Remove Boltdb
  • Fix this somehow

faddat avatar Apr 25 '22 13:04 faddat

I'm not sure I understand the connection between BoltDB using a single file format and the inability to state sync. The latter seems like the first thing to tackle.

Are there an issue and/or some logs that could help us understand what's happening?

creachadair avatar Apr 25 '22 14:04 creachadair

oh, sure thing!

Ok, so, currently we make everything as a folder.

So like:

/Users/faddat/.osmosisd/data/snapshots/metadata.db

is a folder. In fact maybe I can fix that now. Bolt would like a file

faddat avatar Apr 25 '22 16:04 faddat

Ok, so, currently we make everything as a folder.

So like:

/Users/faddat/.osmosisd/data/snapshots/metadata.db

is a folder. In fact maybe I can fix that now. Bolt would like a file

Is that behaviour specific to Osmosis? I ask, because as far as I know stock Tendermint doesn't create the database path directly—it creates the enclosing directory (e.g., $TMHOME/data), but the database path itself is left to the tm-db backend.

If the host is creating the target path as well as the enclosing directory, then probably the simplest fix is to disable the boltdb backend for that host. (That doesn't require any changes to tm-db, just presumably a build constraint for the host itself "you can't use this backend").

Perhaps better would be to have the host not try to pre-create the target path. The tm-db backends all create their working directory anyway, so it's redundant (though harmless) to do it explicitly. And then BoltDB should work out of the box. (If it doesn't already, tm-db should probably require that the implementation be responsible for creating its own targets—Badger and LevelDB definitely already do, I am not sure about Rocks).

I don't think it necessarily makes sense to delete the boltdb backend from tm-db just for this alone, though.

creachadair avatar Apr 26 '22 00:04 creachadair

thanks I will look into it next week :)

faddat avatar May 01 '22 07:05 faddat