Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 May 2008 11:48:41 -0400
From:      "Kurt J. Lidl" <lidl@pix.net>
To:        Anthony Pankov <ap00@mail.ru>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: BDB corrupt
Message-ID:  <20080513154840.GB28842@pix.net>
In-Reply-To: <2117635718.20080513154406@mail.ru>
References:  <op.uavxx8ip2n4ijf@duckjen.nextgentel.no> <9FC19AC2-DAD8-418C-8B9C-F129DEC58CEF@gmail.com> <15336578.20080512123806@mail.ru> <200805121153.00809.jonathan%2Bfreebsd-hackers@hst.org.za> <1663320218.20080512223531@mail.ru> <20080512152430.3720683e@mbook.local> <2117635718.20080513154406@mail.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, May 13, 2008 at 03:44:06PM +0400, Anthony Pankov wrote:
> My requirements is
> 1. there is no need for SQL
> 2. processes are sharing db file in concurrent mode
> 3. reading/writing = 60%/40%
> 
> With BDB
> clause 1 - satisfied
> clause 3 - satisfied (databases of relatively small items that are
> changed infrequently).
> 
> Is there a problem with concurrent access? And, most important, is
> this the ONLY problem? (I still don't understand because of blurred
> mention of "data corruption".)
> 
> If concurrency is the only problem then:
> 1. Can data corruption be avoided? Or this is impossible?
> 2. How?
> 
> If all BDB readers would use O_SHLOCK and all writers O_EXLOCK is it
> guarantee for data integrity?

This is probably good enough, if your writers also do a fflush()
before releasing the lock.  If the writing process ever dies
horribly, you can still have database corruption.

You could turn the thing that does the actual I/O into the database
into daemon that fullfils read/write requests from a unix domain socket.
In fact, there is a sample application that does exactly that for
the newer Sleepycat BDB code.  It could probably be adapted or
re-written for the 1.8x series code.

If it were me, I'd just punt on using the 1.8x code, drop straight into
using the BDB 4.6 codebase, and use their transactioning code.  It's
mature, robust, etc, etc, for a much large set of operations than
the 1.8x code ever was.  But there's still that licensing issue.

-Kurt



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080513154840.GB28842>