[Tarantool-patches] [PATCH v3 2/2] replication: append NOP as the last tx row

Cyrill Gorcunov gorcunov at gmail.com
Thu Jul 2 17:35:21 MSK 2020


On Thu, Jul 02, 2020 at 04:39:51PM +0300, Serge Petrenko wrote:
...
> +	/*
> +	 * Append a dummy NOP statement to preserve replication tx
> +	 * boundaries when the last tx row is a local one.
> +	 */
> +	if (txn->n_local_rows > 0 && txn->n_local_rows != txn->n_new_rows &&
> +	    (*(local_row - 1))->group_id == GROUP_LOCAL) {
> +		size_t size;
> +		*local_row = region_alloc_object(&txn->region,
> +						 typeof(**local_row), &size);
> +		if (*local_row == NULL) {
> +			diag_set(OutOfMemory, size, "region_alloc_object", "row");
> +			return NULL;
> +		}
> +		memset(*local_row, 0, sizeof(**local_row));
> +		(*local_row)->type = IPROTO_NOP;
> +		(*local_row)->group_id = GROUP_DEFAULT;
> +	} else
> +		--req->n_rows;

Serge, do we really need to allocate _new_ xheader here? Can't we simply
create static one and reuse it all the time?


More information about the Tarantool-patches mailing list