| Transaction.No ->
error "attempted to replay a non-full transaction";
false
- | Transaction.Full(id, oldroot, cstore) ->
+ | Transaction.Full(id, oldstore, cstore) ->
let tid = Connection.start_transaction c cstore in
let new_t = Transaction.make tid cstore in
let con = sprintf "r(%d):%s" id (Connection.get_domstr c) in
type ty = No | Full of (
int * (* Transaction id *)
- Store.Node.t * (* Original root *)
+ Store.t * (* Original store *)
Store.t (* A pointer to the canonical store: its root changes on each transaction-commit *)
)
type t = {
ty: ty;
+ start_count: int64;
store: Store.t; (* This is the store that we change in write operations. *)
quota: Quota.t;
mutable paths: (Xenbus.Xb.Op.operation * Store.Path.t) list;
mutable write_lowpath: Store.Path.t option;
}
+let counter = ref 0L
+
let make id store =
- let ty = if id = none then No else Full(id, Store.get_root store, store) in
+ let ty = if id = none then No else Full(id, Store.copy store, store) in
{
ty = ty;
+ start_count = !counter;
store = if id = none then store else Store.copy store;
quota = Quota.copy store.Store.quota;
paths = [];
let has_commited =
match t.ty with
| No -> true
- | Full (id, oldroot, cstore) -> (* "cstore" meaning current canonical store *)
+ | Full (id, oldstore, cstore) -> (* "cstore" meaning current canonical store *)
let commit_partial oldroot cstore store =
(* get the lowest path of the query and verify that it hasn't
been modified by others transactions. *)
if !test_eagain && Random.int 3 = 0 then
false
else
- try_commit oldroot cstore t.store
+ try_commit (Store.get_root oldstore) cstore t.store
in
if has_commited && has_write_ops then
Disk.write t.store;