0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

modules/vm: Fix sequence sharing condition for already retired evals.

This commit is contained in:
Jason Volk 2019-03-28 16:22:19 -07:00
parent 8e23a49ced
commit 83593c5533

View file

@ -815,19 +815,24 @@ ircd::m::vm::write_prepare(eval &eval,
assert(eval.opts); assert(eval.opts);
const auto &opts{*eval.opts}; const auto &opts{*eval.opts};
// Share a transaction with any other evals on this stack. This // Share a transaction with any other unretired evals on this stack. This
// should mean the bottom-most/lowest-sequence eval on this ctx. // should mean the bottom-most/lowest-sequence eval on this ctx.
const auto get_other_txn{[&eval] const auto get_other_txn{[&eval]
(auto &other) (auto &other)
{ {
if(&other != &eval && other.txn) if(&other == &eval)
{ return true;
other.sequence_shared[1] = std::max(other.sequence_shared[1], sequence::get(eval));
eval.sequence_shared[0] = sequence::get(other); if(!other.txn)
eval.txn = other.txn; return true;
return false;
} if(sequence::get(other) <= sequence::retired)
else return true; return true;
other.sequence_shared[1] = std::max(other.sequence_shared[1], sequence::get(eval));
eval.sequence_shared[0] = sequence::get(other);
eval.txn = other.txn;
return false;
}}; }};
// If we broke from the iteration then this eval is sharing a transaction // If we broke from the iteration then this eval is sharing a transaction