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

Fix #436 object_database created outside of witness data directory #689

Merged
merged 2 commits into from
Feb 28, 2018
Merged

Fix #436 object_database created outside of witness data directory #689

merged 2 commits into from
Feb 28, 2018

Conversation

windycrypto
Copy link
Member

@windycrypto windycrypto commented Feb 25, 2018

PR for #436.

@windycrypto
Copy link
Member Author

@pmconrad thanks for you reviews in #687:

IMO you shouldn't introduce an "_opened" flag without

  1. specifying what it means that the database is "open", and
  2. consistently checking the flag wherever it makes sense.
    For example, what happens if you create objects in a database that is not "open", and then call
    open(). Doesn't make sense, should be forbidden.

It seems that database::wipe is only ever called from application::startup. before database::open is called. A minimalist fix would be to simply remove the call to database::close() in database::wipe(). I haven't checked if close has any other relevant side effects though.

I have removed unrelated changes of .gitignore and added more comments for _opened.

IMO database::wipe() is to delete the index&data files, so it's properly database::close() it before deleting theses files. No guarantee database::wipe() only be called from application::startup() in the future.

@abitmore abitmore added this to the Next Non-Consensus-Changing Release milestone Feb 25, 2018
@abitmore
Copy link
Member

Looks fine for me.

Copy link
Contributor

@pmconrad pmconrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
The change has the desired effect.
The definition of "open" is not quite what I'd hoped for :-), but it's consistent and it's a step in the right direction.

* Whether database is successfully opened or not.
*
* The database is considered open when there's no exception
* or assertion fail during database::open() method.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...and database::close() has not been called, or failed during execution.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you~ I have supplemented the comments.

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 this pull request may close these issues.

3 participants