memento
memento copied to clipboard
Add Supervisor with startup and recovery strategies
Hi there!
We are using Memento in prototyping a realtime cluster. It's working well, but, as we head toward production the usual Mnesia rough edges stick out and require sanding.
I thought about writing some sort of library internally, but, then I figured this might be of use to you and a greater community. So, I wanted to get the general idea in front of you to see how you feel about it before I get too much deeper.
The gist:
- Add a Supervisor. Mnesia clustering is stateful and pretty much necessitates it.
- Add a thin strategy framework around startup and recovery concerns.
- Share out our specific use case implementation (RAM only).
Most of it is additive but I did, in this PR, change one core Memento behavior and I'd like to highlight that for your thoughts:
default_opts = [majority: true] (in table.ex)
We're using Mnesia's majority checking feature (https://erlang.org/doc/man/mnesia.html) to "Fail fast" and prevent netsplits from split-braining our data. You mentioned Memento is opinionated to safety, by design, and default majority on felt in spirit with that.
Any feedback? Questions? Otherwise?
Hey @hewsut! Thank you for the PR and yes, the goal is to have Memento pre-configured with the safest and sane options. It'll take me a few days to dive deep into the changes and understand exactly what's going on and how that modifies the existing behaviour along with any migrations/guides that need to be set up.
I'll comment back here with my thoughts.
Thanks! I'll try to annotate and add any other supporting documentation references I can think of.
@sheharyarn do you have a sense yet whether you want something like this to land in Memento?
I'm hoping to pick this back up over the next few weeks to finish up.
I would love to have this merged into master.
Just ping me here once you're done with your pending changes, I'll take a final pass, do any code/documentation/ci cleanup needed and merge this in!
Cool -- I will do that. If we continue to use Mnesia as we head toward production at work -- I'd estimate timeframe here as "soon"(ish). If we end up just grabbing Redis, it may be longer as it'll become side work rather than day job.
Even if we go Redis -- I'm committed to getting something like this done. I am a strong believer that there's a future for Mnesia in the right kinds of cases.
@hewsut @sheharyarn any plans to merge this?
@Exadra37 Sadly, this is stuck for the foreseeable future. This PR isn't yet mergeable and we were force pivoted to a different project at work. While this area of the Elixir ecosystem really interests me, I can't see squeezing this in outside work right now.
@sheharyarn feel free to close as stale if you need. I hope to be back sometime I just don't know when. :(
This PR isn't yet mergeable
I would like to help but I have a limited knowledge of Elixir, but I am planning to use Mnesia in production. The remaining work is something that I could achieve with some guidelines and mentor-ship from you?
While this area of the Elixir ecosystem really interests me, I can't see squeezing this in outside work right now.
So this means that at work Redis was chosen hover Mnesia?
Hello, just casually checking along researching modern mnesia APIs. I really like the looks of this project and this PR! Is there any possibility work on this might continue?