File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -727,10 +727,13 @@ module Xt = struct
727727 and gt = rollback casn gt_mark gt in
728728 CASN { loc; state; lt; gt; awaiters = [] })
729729
730- type 'x snap = cass
730+ type 'x snap = cass * Action .t
731731
732- let snapshot ~xt = xt.cass
733- let rollback ~xt snap = xt.cass < - rollback xt.casn snap xt.cass
732+ let snapshot ~xt = (xt.cass, xt.post_commit)
733+
734+ let rollback ~xt (snap , post_commit ) =
735+ xt.cass < - rollback xt.casn snap xt.cass;
736+ xt.post_commit < - post_commit
734737
735738 let rec first ~xt tx = function
736739 | [] -> tx ~xt
Original file line number Diff line number Diff line change @@ -524,21 +524,29 @@ let test_rollback () =
524524 let n_permanent = Random. int n_locs in
525525 let n_rollbacks = Random. int n_locs in
526526
527+ let expected = ref false in
528+ let unexpected = ref false in
529+
527530 let tx ~xt =
528531 in_place_shuffle locs;
529532 for i = 0 to n_permanent - 1 do
530533 Xt. incr ~xt locs.(i)
531534 done ;
535+ Xt. post_commit ~xt (fun () -> expected := true );
532536
533537 let snap = Xt. snapshot ~xt in
534538 in_place_shuffle locs;
535539 for i = 0 to n_rollbacks - 1 do
536540 Xt. incr ~xt locs.(i)
537541 done ;
542+ Xt. post_commit ~xt (fun () -> unexpected := true );
538543 Xt. rollback ~xt snap
539544 in
540545 Xt. commit { tx };
541546
547+ assert ! expected;
548+ assert (not ! unexpected);
549+
542550 accum := n_permanent + ! accum
543551 done ;
544552
You can’t perform that action at this time.
0 commit comments