[erlang-patches] mnesia: Use chained send_after instead of send_interval

James Wheare james@REDACTED
Wed Sep 26 16:27:09 CEST 2012


Fetch command:
 git fetch git://github.com/jwheare/otp.git mnesia_interval_removal

Compare: https://github.com/jwheare/otp/compare/mnesia_interval_removal
Patch: https://github.com/jwheare/otp/compare/mnesia_interval_removal.patch

 mnesia_controller.erl |   15 +++++++++--
 mnesia_recover.erl    |   66 ++++++++++++++++++++++++++++----------------------
 mnesia_tm.erl         |    3 +-
 1 commit, 3 files changed, 51 insertions(+), 33 deletions(-)

---

mnesia: Use chained send_after instead of send_interval

timer:send_interval behaves badly when resuming from sleep on some
platforms. For example, if I sleep for 10 minutes, and have a
send_interval running once per minute, when I resume, 10 messages
will be sent immediately, eliminating the benefit of only running
the work periodically. This is admittedly a separate bug with
send_interval, but the workaround is straightforward, and also
protects from messages piling up in the queue when the work takes
longer than the interval.

This patch fixes piled up error reports on resume from sleep:

** WARNING ** Mnesia is overloaded: {dump_log, write_threshold}

You'll still be warned if mnesia is overloaded, just not repeatedly.

Additionally, erlang:send_after is more efficient than using the
timer module equivalent [1]

[1] http://www.erlang.org/doc/efficiency_guide/commoncaveats.html#id57251



More information about the erlang-patches mailing list