Guard against negative time deltas

Despite the use of `erlang:monotonic_time/0`, it is still possible on
some platforms, such as sleeping/awakening laptops, for time to move
in surprising directions. When this happens, and a negative time delta
is passed to `timebin/1`, it crashes with:

bad arithmetic expression at math:log10/1 <= ioq_server:timebin/1(line:480)

This adds a guard to return `0` for negative numbers as well as zero.
1 file changed
tree: 440818a5ce500254a27c42f858a41f410df6429c
  1. include/
  2. priv/
  3. src/
  4. test/
  5. .gitignore
  6. IOQ2.md
  7. operator_guide.md
  8. README.md
  9. rebar.config.script
README.md

IOQ classes

The following are the list of IOQ classes:

  • interactive
  • db_update
  • view_update
  • db_compact
  • view_compact
  • internal_repl
  • low

Bypassing IOQ

One can configure an ioq bypass, which removes an IO class from prioritization, as below:

config:set("ioq.bypass", "view_update", "true")

Note that setting an IOQ bypass can effectively trump all other classes, especially in the case of an interactive bypass v. compaction. This can lead to high disk usage.

Setting priorities

The priority for a class can also be set ala:

config:set("ioq", "compaction", "0.3")

Or globally, using snippet/rpc:

s:set_config("ioq", "compaction", "0.314", global)
rpc:multicall(config, set, ["ioq", "compaction", "0.217"])

As the interactive class is ‘everything else’ its priority cannot be directly set.