On Jun 18, 8:58 pm, Don Anderson <don.ander...@[EMAIL PROTECTED]
> wrote:
> On Jun 11, 9:20 pm, rohithr...@[EMAIL PROTECTED]
wrote:
>
>
>
> > On Jun 12, 4:33 am, Florian Weimer <f...@[EMAIL PROTECTED]
> wrote:
>
> > > > Am a fresher in BerkeleyDB. If i open a database file(using
> > > > transaction) for put(adding to DB) and if i tried to open the same
> > > > file in different transaction the put is hanging. It seems a
deadlock
> > > > is occuring. Is it not allowed, the same database file to be
opened in
> > > > more than one transactions?
>
> > > It's allowed, but only if the threads or processes executing the
open
> > > and the put are ordered in some way unknown to Berkeley DB. If
you've
> > > got a single process that tries to do these things, they are
trivially
> > > ordered, so it's not allowed. Another source of orderings is IPC.
>
> > Thanks. My concern is in a single process.
>
> > The number of database files in not defined in my work.
> > So i think I need to use a single transaction in my process. Will it
> > be OK to open more than 1 database files in a single transaction?
>
> It's okay, but probably not your best bet. Why not open each database
> in
> its own transaction (use autocommit flag so you don't even have to
> manage
> the transaction). The only reasons I know to keep a transaction going
> past the end of the open would be 1) you are creating your set of
> databases atomically and you want the behavior where either all your
> databases were created or none. or 2) performance - you are opening
> 1000 databases, I'd guess you'd see an open using a single transaction
> to be faster then separate transactions. Same advice goes for your
> original question if I understand it. Open the database in its own
> separate transaction (use autocommit), and then do puts in their own
> transaction. That's the typical approach anyway.
So you are saying that explicit transaction is not necessary, simply
auto-commit may be needed. So the implicit transaction which we get by
auto-commit will work, am I right?
I have one more doubt. Hope if the database count is less, then there
is no problem(even for performance) in creating multiple transaction
under the same environment, am i right?


|