From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 7FA8E42F4AD for ; Thu, 2 Jul 2020 17:35:25 +0300 (MSK) Received: by mail-lj1-f193.google.com with SMTP id n23so32508739ljh.7 for ; Thu, 02 Jul 2020 07:35:25 -0700 (PDT) Date: Thu, 2 Jul 2020 17:35:21 +0300 From: Cyrill Gorcunov Message-ID: <20200702143521.GG2256@grain> References: <106b9cbcf8577d6e3afbde57b15bc11d366c108e.1593696889.git.sergepetrenko@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <106b9cbcf8577d6e3afbde57b15bc11d366c108e.1593696889.git.sergepetrenko@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v3 2/2] replication: append NOP as the last tx row List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Serge Petrenko Cc: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org 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?