From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp37.i.mail.ru (smtp37.i.mail.ru [94.100.177.97]) (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 CB3974696C0 for ; Fri, 29 May 2020 01:54:06 +0300 (MSK) References: From: Vladislav Shpilevoy Message-ID: Date: Fri, 29 May 2020 00:54:04 +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 v2 2/2] wal: reorder tx rows so that a tx ends on a global row List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Serge Petrenko , gorcunov@gmail.com, kostja.osipov@gmail.com Cc: tarantool-patches@dev.tarantool.org Thanks for the patch, But I have a comment! It is a nice crutch, Yet we need one more moment. The patch basically sacrifices transaction rows order and WAL correctness for the sake of replication. It does not look right. Why can't we leave WAL as is, and tweak all these things in relay? It looks really wrong to change statements order. Especially taking into account this is needed *only* for replication. For example, consider FKs. A local space has a FOREIGN KEY reference to a global space. To make it work, we need to insert into the global space first, and then into the local space. When you change the order, the local insert goes first, and violates the foreign key. So if we will check FKs on recovery (when we will have FKs in box), this patch will break them. Alternative to relay - append a dummy NOP statement in the end of the transaction, which would be global. But this is also a crutch. I think the TSNs figuring out should be done in relay. It could keep track of the current transaction, change TSNs and is_commit when necessary.