mon: PaxosService: fix trim criteria so to avoid constantly trimming
Say a service establishes it will only keep 500 versions once a given
condition X is true. Now say that said condition X only becomes true
after said service committing some 800 versions.
Once we decide to trim, this service would trim all 300 surplus versions
in one go. After that, each committed version would also trim the
previous version.
Trimming an unbounded number of versions is not a good practice
as it will generate bigger transactions (thus a greater workload on
leveldb) and therefore bigger messages too.
Constantly trimming versions implies more frequent accesses to leveldb,
and keeping around a couple more versions won't hurt us in any significant
way, so let us put off trimming unless we go over a predefined minimum.
This patch adds two new options:
paxos service trim min - minimum amount of versions to trigger a trim
(default: 30, 0 disables it)
paxos service trim max - maximum amount of versions to trim during a
single proposal
(default: 50, 0 disables it)
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>