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

rocksdb creates LOCK and LOG files even if DB does not exist, and create_if_missing is false #5029

Open
gbitzes opened this issue Feb 28, 2019 · 6 comments

Comments

@gbitzes
Copy link
Contributor

gbitzes commented Feb 28, 2019

Expected behavior

If create_if_missing is false, and we point rocksdb to open some non-sense location such as /etc, rocksdb should fail to open the directory, without modifying anything inside said directory.

Actual behavior

rocksdb adds files like LOCK, LOG into the directory.

@riversand963
Copy link
Contributor

Thanks @gbitzes for reporting. Would you like to submit a PR to fix this?

@oferze
Copy link

oferze commented Mar 31, 2019

It's been a month and I since the OP didn't reply, I don't think they are going to submit a PR.
I would have done it but don't have the capacity at the moment.
Just writing here, hoping this would jump up in the queue.

It's a real issue, since sometimes I use rocksdb_open or even rocksdb_open_for_read_only just to check whether a directory contains a valid RocksDB storage or not.

The former, and in particular the latter, should "make no harm", meaning - if there's no RocksDB inside the directory, no file should be created.

@muralivemulapati
Copy link

I had not noticed this issue before I submitted PR 5230 which is the same issue.

@oferze
Copy link

oferze commented Apr 23, 2019

Thanks for your fix @muralivemulapati !

Hopefully you could wrap up the change based on the comment you got there.

@oferze
Copy link

oferze commented Apr 23, 2019

Reference: #5230

dartdart26 added a commit to dartdart26/concord-bft that referenced this issue Sep 28, 2020
If any of the passed RocksDB DBs to sparse_merkle_db_editor are
non-existent or empty, exit with an error instead of reporting empty
values. Prior to this change, the editor was first creating an empty DB
and then all commands were working by reporting default/empty values.

Since RocksDB doesn't offer a consistent method for checking if a DB
exists at a given path, first check if the passed directory exists. If
it doesn't, report an error. If it does, check if there are any keys in
the DB - if there are none, report an error. Above behavior can be
simplified when the following RocksDB issue is resolved:
facebook/rocksdb#5029

Add tests for non-existent and empty databases for commands accepting
both one and two DB paths.
dartdart26 added a commit to dartdart26/concord-bft that referenced this issue Sep 28, 2020
If any of the passed RocksDB DBs to sparse_merkle_db_editor are
non-existent or empty, exit with an error instead of reporting empty
values. Prior to this change, the editor was first creating an empty DB
and then all commands were working by reporting default/empty values.

Since RocksDB doesn't offer a consistent method for checking if a DB
exists at a given path, first check if the passed directory exists. If
it doesn't, report an error. If it does, check if there are any keys in
the DB - if there are none, report an error. Above behavior can be
simplified when the following RocksDB issue is resolved:
facebook/rocksdb#5029

Add tests for non-existent and empty databases for commands accepting
both one and two DB paths.
@oferze
Copy link

oferze commented Jul 29, 2021

This bug is still open

@jay-zhuang jay-zhuang linked a pull request Aug 2, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants