[PATCH 4/7] dbwrap: allow transactions on non-persistent non-clustered dbs.

Volker Lendecke Volker.Lendecke at SerNet.DE
Thu Mar 28 00:23:21 MDT 2013


On Thu, Mar 28, 2013 at 10:51:57AM +1030, Rusty Russell wrote:
> "Stefan (metze) Metzmacher" <metze at samba.org> writes:
> > Hi Rusty,
> >
> >> Otherwise we can't use dbwrap for schannel_store:
> >> 
> >> 	transactions not supported on non-persistent database /home/rusty/samba/st/dc/private/schannel_store.tdb
> >> 
> >> Note that the source3/lib/dbwrap/dbwrap_ctdb.c transaction start will
> >> return an error with the same message anyway.
> >
> > I think we should avoid using transactions instead of removing the check!
> 
> I was told to use dbwrap for the ntdb switch, but that means making
> dbwrap a generic wrapper, used for non-clustered databases.  So I think
> we'll hit the same issue as the other databases are converted to dbwrap.
> 
> (Volker pointed out on IRC that I should have checked git annotate
> before looking at this change... indeed!  My mistake.)
> 
> Basically, if it comes from db_open() w/ CLEAR_IF_FIRST, we should make
> sure they don't try to do transactions (which would fail if they *were*
> using ctdb).  But direct calls to dbwrap_local_open() are OK.
> 
> Something like this (untested)?

Seems ok. Although I think for dbwrap_cache the variable
needs to match what the underlying database provides. So
maybe you need a proper callback function.

I still wonder what the use case for transactions in
clear_if_first databases is. Yes, this is part of the tdb
API, but dbwrap as such is much more restricted than tdb is
anyway, and I hope we don't have to expose all of tdb in
dbwrap in the future. I had to find out quite some nasty
details in ctdb's use of the raw tdb API while working on
transactions, and I would hesitate exposing them all.

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de


More information about the samba-technical mailing list