欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2, C++/F#/Lisp
TwinDB
第26行: | 第26行: | ||
==相关链接== | ==相关链接== | ||
*官方网站 http://www.dekorte.com/projects/opensource/TwinDB/ | *官方网站 http://www.dekorte.com/projects/opensource/TwinDB/ | ||
+ | |||
+ | [[Category:Database]] |
2010年8月14日 (六) 11:57的版本
简介
TwinDB is an embedded key/value database based on BerkeleyDB. It basically adds security from database corruption on top of the non-transactional version of BerkeleyDB. I wrote it because the transactional version of Berkeley DB is expensive ($100,000 for a commercial license).
It accomplishes this by maintaining twin BerkeleyDB databases and using "lock" files to indicate when a set of writes are in progress.
Put and delete entries are cached in memory until TwinDB_sync() is called or a read occurs (by calling TwinDB_get()). Then, it:
1. locks the first database 2. writes to it 3. unlocks it
and repeats this process for the backup database. Upon startup, it checks to see if a lock is on either file. If so, it assumes that database file is corrupt and replaces it with the other.
Cons:
* writes are 1/2 as fast * database is 2x as big
Pros:
* the database cannot be corrupted * it's still *very* fast * it's free for commercial use * the size difference might not matter (current hard disks are typically over 100G, so a 500M database will still only take up less than 1% of the drive if doubled)