# transactional btree



## balaji18 (Jan 30, 2011)

Hi,

FreeBSD provides btree/hash/recno algorithms through its DB interface. Are these transactional? On seeing the code, i can find a flag(DB_TXN) but that doesn't seem to be used at all. 

Transactional - i mean supporting ACID properties(Atomic, Consistent, Isolate, Durable). Is there a plan to implement this if not already implemented? or does it need to be achieved indirectly. Indirectly i mean splitting ACID like taking advantage of the durability provided by the file system and the application implementing the rest(ACI). I understand its easier said than done. But if its possible, can i get some directions? I have already read through the docs of sqlite to understand how atomic commit is implemented there.

Thanks,
Balaji.


----------



## nakal (Jan 30, 2011)

I am not completely sure about what I say now. Perhaps someone with more experience can correct me.

I've been looking once at the code and the API. It seems that FreeBSD uses an old BDB version with an older API. It fits nicer into Unix/C-concepts but does not have advanced features like transactions and many others. I think the most control is being done simply with file locking. This is of course not very good, but for the tools on FreeBSD that use BDB it's all they really need.

You can take a look at the newer versions of BDB (which is owned by Oracle now). They have license restrictions though.


----------



## balaji18 (Jan 30, 2011)

Hi Nakal,

Thanks for the response. I totally agree with you. The main reason i am looking is an alternative to Oracle BDB mainly because of license and cost. I am not looking at an exact replacement for Oracle BDB. All i want is something at the base level with ACID and whether its feasible. 

Thanks,
Balaji.


----------



## expl (Jan 30, 2011)

Same methods apply as to a simple atomic file I/O,  BDB interface is not an exception as every action you do WILL cause BDB to call pwrite/pread for the pages on the file. Inter process file locks or mutexes for threaded program is the common solution.


----------



## gordon@ (Jan 30, 2011)

If you want a lightweight transactional database, install databases/sqlite.


----------

