tdb API issues

simo idra at
Thu Apr 2 01:04:43 GMT 2009

On Wed, 2009-04-01 at 17:20 -0700, Howard Chu wrote:
> I'd thought of that at first, but it seems that a separate context per
> thread 
> would also multiply the address space consumed per DB, since they
> would each 
> have their own complete mmap of the data. Doesn't sound too practical.

You should be able to change the tdb_context init code so that all
contexts will actually use the same mmap space.
You must open the file just once anyway otherwise you loose all locks if
any thread closes the file. 

> Yeah, coordinating the fcntl locks across multiple tdb_context's would
> also be 
> a pain. 

It would require careful thought, but given you already need to make
threads talk to each other to make internal process locking it shouldn't
be that bad.

> Pretty sure that splitting to a separate context per thread is the 
> wrong level of granularity... ;)

To be honest, I think Tridge is right in proposing to have a context per
thread. It's probably a very good way to achieve what's needed without
having to change the API (may require linking in pthreads), or with
minimal additions (additional API used just by threaded processes to set
up per thread access).


Simo Sorce
Samba Team GPL Compliance Officer <simo at>
Principal Software Engineer at Red Hat, Inc. <simo at>

More information about the samba-technical mailing list