[Tarantool-patches] [PATCH 4/8] replication: make sync transactions wait quorum

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Thu Jun 11 02:51:25 MSK 2020


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.


More information about the Tarantool-patches mailing list