[PATCHES] Convert gencache to dbwrap to enable mutexes

Michael Adam obnox at samba.org
Wed Jun 25 05:26:03 MDT 2014


On 2014-06-25 at 13:21 +0200, Stefan (metze) Metzmacher wrote:
> Am 25.06.2014 13:18, schrieb Michael Adam:
> > On 2014-06-25 at 08:45 +0200, Stefan (metze) Metzmacher wrote:
> >> Am 24.06.2014 22:22, schrieb Christof Schmitt:
> >>>
> >>> Sorry for the confusion. CLEAR_IF_FIRST has to be set for mutexes. The
> >>> main issue is that transactions are not allowed in dbwrap if
> >>> CLEAR_IF_FIRST is set. My idea here is to adapt dwrap to only warn if
> >>> the database has been opened through db_open which allows the clustered
> >>> usage. Databases opened directly with dbwrap_local_open should still
> >>> allow transactions and CLEAR_IF_FIRST.
> >>
> >> Transactions are not allowed with mutexes if I remember correctly.
> > 
> > Generally, we try to implement the pattern that a
> > database with CLEAR_IF_FIRST does not use transactions.
> > For the gencache case, a transaction is used on gencache_notrans
> > (despite the name...:-) only in the stabilize operation that
> > stabilizes the contents throught to the persistent gencache.tdb.
> > It currently works like this:
> > 
> > transaction_start(cache)
> > transaction_start(cache_notrans)
> > traverse(stabilize_fn)
> > transaction_commit(cache)
> > transaction_commit(cache_notrans)
> > 
> > where stabilize_fn does this on a record:
> > 
> > 1. store it to or delete it from cache
> >    (depending on the timeout)
> > 2. delete it from the cache_notrans
> > 
> > I'll think we should avoid the transaction here on
> > gencache_notrans, too, and I will provide a patch that
> > does it like this:
> > 
> > tdb_allrecord_lock(cache_notrans)
> > transaction_start(cache)
> > traverse(stabilize_fn_mod)
> > tdb_wipe_all(cache_notrans)
> > transaction_commit(cache)
> 
> I think we should do the commit before wipe_all

Oh yes, right.

Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140625/30f59146/attachment.pgp>


More information about the samba-technical mailing list