From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 6F56A42F4AE for ; Thu, 11 Jun 2020 02:51:27 +0300 (MSK) References: From: Vladislav Shpilevoy Message-ID: <221e15b9-9f59-cc49-54ae-e823fbf2d1c8@tarantool.org> Date: Thu, 11 Jun 2020 01:51:25 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH 4/8] replication: make sync transactions wait quorum List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Serge Petrenko , sergos@tarantool.org, gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org Thanks for sending the patch! > diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c > new file mode 100644 > index 000000000..d28b2a28b > --- /dev/null > +++ b/src/box/txn_limbo.c > @@ -0,0 +1,167 @@ > +#include "txn.h" > +#include "txn_limbo.h" > +#include "replication.h" > + > +struct txn_limbo txn_limbo; > + > +static inline void > +txn_limbo_create(struct txn_limbo *limbo) > +{ > + rlist_create(&limbo->queue); > + limbo->instance_id = REPLICA_ID_NIL; > + vclock_create(&limbo->vclock); > +} > + > +struct txn_limbo_entry * > +txn_limbo_append(struct txn_limbo *limbo, struct txn *txn) > +{ > + assert(txn_has_flag(txn, TXN_WAIT_ACK)); > + if (limbo->instance_id != instance_id) { > + if (limbo->instance_id == REPLICA_ID_NIL || > + rlist_empty(&limbo->queue)) { > + limbo->instance_id = instance_id; > + } else { > + diag_set(ClientError, ER_UNCOMMITTED_FOREIGN_SYNC_TXNS, > + limbo->instance_id); > + return NULL; > + } > + } > + struct txn_limbo_entry *e = (struct txn_limbo_entry *) > + region_alloc(&txn->region, sizeof(*e)); I changed that to region_alloc_object(), according to recently submitted ASAN changes about alignment.