]> xenbits.xensource.com Git - xen.git/commit
oxenstored: discard old commit-history on txn end
authorThomas Sanders <thomas.sanders@citrix.com>
Thu, 23 Mar 2017 14:25:16 +0000 (14:25 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 28 Mar 2017 12:07:04 +0000 (13:07 +0100)
commitcfd8bd7d403e2cad706f220a90383922e4ef2f61
treec3c8038b1c2ace995acc60d63e3e06cc377efc93
parent00c7d98d2df18e0d138bc6ef59e9e07bfc756d34
oxenstored: discard old commit-history on txn end

The history of commits is to be used for working out which historical
commit(s) (including atomic writes) caused conflicts with a
currently-failing commit of a transaction. Any commit that was made
before the current transaction started cannot be relevant. Therefore
we never need to keep history from before the start of the
longest-running transaction that is open at any given time: whenever a
transaction ends (with or without a commit) then if it was the
longest-running open transaction we can delete history up until start
of the the next-longest-running open transaction.

Some transactions might stay open for a very long time, so if any
transaction exceeds conflict_max_history_seconds then we remove it
from consideration in this context, and will not guarantee to keep
remembering about historical commits made during such a transaction.

We implement this by keeping a list of all open transactions that have
not been open too long. When a transaction ends, we remove it from the
list, along with any that have been open longer than the maximum; then
we delete any history from before the start of the longest-running
transaction remaining in the list.

Signed-off-by: Thomas Sanders <thomas.sanders@citrix.com>
Reviewed-by: Jonathan Davies <jonathan.davies@citrix.com>
Reviewed-by: Christian Lindig <christian.lindig@citrix.com>
tools/ocaml/xenstored/history.ml
tools/ocaml/xenstored/process.ml
tools/ocaml/xenstored/transaction.ml