[PATCH] lib/tdb: TDB_ALLOW_NESTING flag (port from ctdb)

Rusty Russell rusty at rustcorp.com.au
Mon Aug 17 21:09:19 MDT 2009


On Mon, 17 Aug 2009 06:38:15 pm Stefan (metze) Metzmacher wrote:
> Rusty Russell schrieb:
> > Ported from ctdb change 3e49e41c21eb8c53084aa8cc7fd3557bdd8eb7b6
> > ("New attempt at TDB transaction nesting allow/disallow").
> > 
> > Unfortunately, this is an API change if you were using nested transactions.
> > I've added the flag where needed to make quicktest (source4) and test
> > (source3) pass again.
> > 
> > As a general rule, nested transactions are dangerous: if you don't know you're
> > nesting, you can do a tdb_transaction_commit() which "succeeds", then gets
> > wiped by a crash, close, or outer tdb_transaction_cancel().
> > 
> > Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
> 
> The real problem is that this causes problems with existing applications
> and we need to change the tdb library version...

In practice, only if they use nested transactions, and they're probably buggy if they do so unintentionally.  Yet this feature has been there since transactional tdb was imported into source3, so it's possible people do rely on it.

It's not impossible to use it correctly in special cases, and SAMBA does this.  I think it's lazy programming, but it's there.

OTOH, introducing a TDB_NO_NESTING flag penalizes future users, since that
should really be the default.

> Also the patch should be split up into a tdb patch and multiple patches
> for the callers.

I was trying to avoid breaking bisection.  I can still do so by adding the
flag, then fixing the users, then adding the semantic.

Thanks,
Rusty.


More information about the samba-technical mailing list