From ec4c6c46ac20b961be72ed7e0f8bfb55189fd13c Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 10 Sep 2019 14:41:39 -0700 Subject: [PATCH] ircd::m::vm: Partial revert of a35328f38; remove mutex; use sequencing. --- include/ircd/m/vm.h | 1 - ircd/m.cc | 3 --- modules/m_vm.cc | 17 ++++++----------- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/include/ircd/m/vm.h b/include/ircd/m/vm.h index bfd3d6127..409b15cc1 100644 --- a/include/ircd/m/vm.h +++ b/include/ircd/m/vm.h @@ -37,7 +37,6 @@ namespace ircd::m::vm namespace ircd::m::vm::sequence { extern ctx::dock dock; - extern ctx::mutex mutex; extern uint64_t retired; // already written; always monotonic extern uint64_t committed; // pending write; usually monotonic extern uint64_t uncommitted; // evaluating; not monotonic diff --git a/ircd/m.cc b/ircd/m.cc index 6de48ff0b..eed69c294 100644 --- a/ircd/m.cc +++ b/ircd/m.cc @@ -1536,9 +1536,6 @@ ircd::m::vm::eval::operator()(const event &event) // sequence // -decltype(ircd::m::vm::sequence::mutex) -ircd::m::vm::sequence::mutex; - decltype(ircd::m::vm::sequence::dock) ircd::m::vm::sequence::dock; diff --git a/modules/m_vm.cc b/modules/m_vm.cc index 6906e51d8..73282be8c 100644 --- a/modules/m_vm.cc +++ b/modules/m_vm.cc @@ -949,6 +949,12 @@ ircd::m::vm::execute_pdu(eval &eval, assert(sequence::committed < sequence::get(eval)); assert(sequence::retired < sequence::get(eval)); sequence::committed = sequence::get(eval); + if(m::exists(event_id) && !opts.replays) + throw error + { + fault::EXISTS, "Write commit rejected :Event has already been evaluated." + }; + if(opts.write) write_prepare(eval, event); @@ -963,17 +969,6 @@ ircd::m::vm::execute_pdu(eval &eval, // Commit the transaction to database iff this eval is at the stack base. if(opts.write && !eval.sequence_shared[0]) { - const std::lock_guard lock - { - sequence::mutex - }; - - if(m::exists(event_id) && !opts.replays) - throw error - { - fault::EXISTS, "Write commit rejected :Event has already been evaluated." - }; - write_commit(eval); }