tdb questions

Daniele Dario d.dario76 at gmail.com
Fri May 24 06:47:17 MDT 2013


On Fri, 2013-05-24 at 14:11 +0200, Volker Lendecke wrote:
> On Thu, May 23, 2013 at 10:03:41PM +0200, Daniele wrote:
> > Which is the difference between using or not mmap? Is it
> > suggested the use of mmap and if not available there is
> > the fallback or are there other things to take in account
> > when making the choice?
> 
> The default is mmap, and should be used where possible. A
> few operating systems like HP/UX and OpenBSD (not sure about
> current OpenBSD) do not support coherent mmap and
> read/write. On a sane OS mmap should be no problem.
> 
> > From what I know, tdb is a persistent db. The application
> 
> Yes, it is file-backed, but with default operation we can
> lose data when the machine just crashes. Samba uses the
> TDB_CLEAR_IF_FIRST flag for the databases that don't need to
> persist across restarts.
> 
> > I'working on would work on a system which can loose power
> > so which would be the best practices to avoid corruptions?
> 
> Use tdb_transaction_start/cancel/commit to be safe. It will
> slow down write operations significantly, mainly due to
> msync/fsync calls, but the database will remain intact even
> under crashes (assuming the file system below does not
> cheat). Make sure you have write barriers (barrier=1)
> activated in the file system mount and also make sure your
> storage stack (LVM around?) properly supports these
> barriers.
> 
> Volker
> 

Hi Volker,
thanks so much for the response.

The system power has a battery backup which gives us 3 min of power and
notify the application that line power has gone so I'm able to close all
handles but I can't perform a clean shut down to the system because if
power comes on again while it is shutting down I'm not able to restart
it. I need to completely remove power to terminate the shut down in
order to allow a (re)start. If line power comes up within the 3 min of
battery power, the application would be notified and re-open files.

Said this, would it be enough to use tdb_close when we loose line power
to keep tdbs safe?

About the FS actually it is an ext2 partition on a DiskOnModule so to
enable write barriers have to move to (at least) ext3 so I'll start
looking on that.

Again thanks,
Daniele.



More information about the samba-technical mailing list