-
Notifications
You must be signed in to change notification settings - Fork 428
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
Remove the check which compares Mnesia directory with the value set in the app env when deleting Mnesia files #1904
Conversation
I'm OK with removing the check. Originally, the check was introduced since (not knowing it) I didn't want to program for the implementation of Eventually, we might just log the situation on a high verbosity level instead of throwing an error, so that a human operator knows about a potential misconfiguration. |
This patch removes the part of code which raises an error if Mnesia directory reported by `mnesia:system_info(directory)` is the same as `application:get_env(mnesia, dir)` when deleting Mnesia files. From now on only a warning message is emitted. The check sometimes resulted in unexpected errors. Users set Mnesia directory path using application env `mnesia.dir`. This path might be a relative path (it might be even an atom!). When Mnesia starts, it takes this value, converts it to absolute path and stored it in initial config. This is what `mnesia:system_info(directory)` returns, thus the check failed in simple situations when someone sets `mnesia.dir` to relative path. The check only succeeded in cases when `mnesia.dir` path is a normalized, absolute path.
360ff82
to
cb29dd4
Compare
Codecov Report
@@ Coverage Diff @@
## master #1904 +/- ##
==========================================
+ Coverage 72.63% 73.63% +0.99%
==========================================
Files 307 310 +3
Lines 28140 30863 +2723
==========================================
+ Hits 20440 22725 +2285
- Misses 7700 8138 +438
Continue to review full report at Codecov.
|
@erszcz I've added a warning log message if directories are not the same. I think that's a sweet spot between raising an error and not checking it at all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fine
This patch removes the check if Mnesia directory reported by
mnesia:system_info(directory)
is the same asapplication:get_env(mnesia, dir)
when deleting Mnesia files.The check sometimes resulted in unexpected errors. Users set Mnesia directory path using application env
mnesia.dir
. This path might be a relative path (it might be even an atom!). When Mnesia starts, it takes this value, converts it to absolute path and stored it in initial config. This is whatmnesia:system_info(directory)
returns, thus the check failed in simple situations when someone setsmnesia.dir
to relative path. The check only succeeded in cases whenmnesia.dir
path is a normalized, absolute path, or when Mnesia is stopped, in which caesmnesia:system_info(directory)
falls back to application env's values.