From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <kostja.osipov@gmail.com>
Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com
 [209.85.208.196])
 (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 4CC0F469719
 for <tarantool-patches@dev.tarantool.org>;
 Thu, 19 Mar 2020 14:12:08 +0300 (MSK)
Received: by mail-lj1-f196.google.com with SMTP id u15so1672442lji.10
 for <tarantool-patches@dev.tarantool.org>;
 Thu, 19 Mar 2020 04:12:08 -0700 (PDT)
Date: Thu, 19 Mar 2020 14:12:06 +0300
From: Konstantin Osipov <kostja.osipov@gmail.com>
Message-ID: <20200319111206.GA14895@atlas>
References: <20200319090537.5613-1-gorcunov@gmail.com>
 <20200319090537.5613-12-gorcunov@gmail.com>
 <20200319103749.GC11867@atlas> <20200319104951.GV27301@uranus>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20200319104951.GV27301@uranus>
Subject: Re: [Tarantool-patches] [PATCH v13 11/11] box/journal: redesign
	journal operations
List-Id: Tarantool development patches <tarantool-patches.dev.tarantool.org>
List-Unsubscribe: <https://lists.tarantool.org/mailman/options/tarantool-patches>, 
 <mailto:tarantool-patches-request@dev.tarantool.org?subject=unsubscribe>
List-Archive: <https://lists.tarantool.org/pipermail/tarantool-patches/>
List-Post: <mailto:tarantool-patches@dev.tarantool.org>
List-Help: <mailto:tarantool-patches-request@dev.tarantool.org?subject=help>
List-Subscribe: <https://lists.tarantool.org/mailman/listinfo/tarantool-patches>, 
 <mailto:tarantool-patches-request@dev.tarantool.org?subject=subscribe>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: tml <tarantool-patches@dev.tarantool.org>

* Cyrill Gorcunov <gorcunov@gmail.com> [20/03/19 13:51]:

I really it's not worth it, adding a cicrular dependency.

you can declare struct txn in wal.cc, and pass it around by
pointer without using the header.

The whole goal of this refactoring was to move fiber_set_txn() 
outside wal.cc, to txn.cc.

Is it still impossible? let's discuss.

Module boundaries are really important long term. You add it for a
valid reason, and some other patch will begin using txn inside wal
for a silly reason.

> On Thu, Mar 19, 2020 at 01:37:49PM +0300, Konstantin Osipov wrote:
> > * Cyrill Gorcunov <gorcunov@gmail.com> [20/03/19 12:12]:
> > > --- a/src/box/wal.c
> > > +++ b/src/box/wal.c
> > > @@ -32,6 +32,7 @@
> > >  
> > >  #include "vclock.h"
> > >  #include "fiber.h"
> > > +#include "txn.h"
> > 
> > Please try to avoid including txn.h here.
> > 
> > You can do it, I'm pretty sure.
> 
> I use fiber_set_txn and in_txn helpers, they
> are declared in txn.h.
> 
> The base idea is that setting fiber->storage.txn
> to NULL is done inside the wal engine and should
> be transparent to the caller (which implies that
> fiber->storage.txn is preserved in case of error
> and txn_rollback call is allowed).
> 
> Also the sync write in wal engine uses async write
> internally, so I fetch the current txn via in_txn
> and pass it as a completion data.

-- 
Konstantin Osipov, Moscow, Russia