svn: r5770
This commit is contained in:
Alex Roitman 2006-01-17 03:50:55 +00:00
parent 0096bbfa5f
commit ac4e672470

View File

@ -125,6 +125,7 @@ class GrampsBSDDB(GrampsDbBase):
def open_table(self,name,dbname,no_txn=False): def open_table(self,name,dbname,no_txn=False):
dbmap = dbshelve.DBShelf(self.env) dbmap = dbshelve.DBShelf(self.env)
dbmap.db.set_pagesize(16384) dbmap.db.set_pagesize(16384)
dbmap.set_flags(db.DB_TXN_NOT_DURABLE)
if self.readonly: if self.readonly:
dbmap.open(name, dbname, db.DB_HASH, db.DB_RDONLY) dbmap.open(name, dbname, db.DB_HASH, db.DB_RDONLY)
elif no_txn: elif no_txn:
@ -255,13 +256,13 @@ class GrampsBSDDB(GrampsDbBase):
callback(0.25) callback(0.25)
self.env = db.DBEnv() self.env = db.DBEnv()
self.env.set_cachesize(0,0x2000000) # 2MB self.env.set_cachesize(0,0x2000000) # 2MB
self.env.set_flags(db.DB_TXN_NOSYNC,1) # async txn self.env.set_flags(db.DB_TXN_NOSYNC,1) # async txn
self.env.set_flags(db.DB_LOG_AUTOREMOVE,1) # clean up unused logs #self.env.set_flags(db.DB_LOG_AUTOREMOVE,1) # clean up unused logs
# The DB_PRIVATE flag must go if we ever move to multi-user setup # The DB_PRIVATE flag must go if we ever move to multi-user setup
env_flags = db.DB_CREATE|db.DB_PRIVATE|\ env_flags = db.DB_CREATE|db.DB_PRIVATE|\
db.DB_INIT_MPOOL|db.DB_INIT_LOCK|\ db.DB_INIT_MPOOL|db.DB_INIT_LOCK|\
db.DB_INIT_LOG|db.DB_INIT_TXN|db.DB_RECOVER db.DB_INIT_LOG|db.DB_INIT_TXN
self.undolog = "%s.undo" % name self.undolog = "%s.undo" % name
env_name = os.path.expanduser(const.bsddbenv_dir) env_name = os.path.expanduser(const.bsddbenv_dir)
@ -290,69 +291,69 @@ class GrampsBSDDB(GrampsDbBase):
table_flags = db.DB_CREATE|db.DB_AUTO_COMMIT table_flags = db.DB_CREATE|db.DB_AUTO_COMMIT
self.surnames = db.DB(self.env) self.surnames = db.DB(self.env)
self.surnames.set_flags(db.DB_DUP) self.surnames.set_flags(db.DB_DUP|db.DB_TXN_NOT_DURABLE)
self.surnames.open(self.full_name, "surnames", self.surnames.open(self.full_name, "surnames",
db.DB_HASH, flags=table_flags) db.DB_HASH, flags=table_flags)
self.name_group = db.DB(self.env) self.name_group = db.DB(self.env)
self.name_group.set_flags(db.DB_DUP) self.name_group.set_flags(db.DB_DUP|db.DB_TXN_NOT_DURABLE)
self.name_group.open(self.full_name, "name_group", self.name_group.open(self.full_name, "name_group",
db.DB_HASH, flags=table_flags) db.DB_HASH, flags=table_flags)
self.id_trans = db.DB(self.env) self.id_trans = db.DB(self.env)
self.id_trans.set_flags(db.DB_DUP) self.id_trans.set_flags(db.DB_DUP|db.DB_TXN_NOT_DURABLE)
self.id_trans.open(self.full_name, "idtrans", self.id_trans.open(self.full_name, "idtrans",
db.DB_HASH, flags=table_flags) db.DB_HASH, flags=table_flags)
self.fid_trans = db.DB(self.env) self.fid_trans = db.DB(self.env)
self.fid_trans.set_flags(db.DB_DUP) self.fid_trans.set_flags(db.DB_DUP|db.DB_TXN_NOT_DURABLE)
self.fid_trans.open(self.full_name, "fidtrans", self.fid_trans.open(self.full_name, "fidtrans",
db.DB_HASH, flags=table_flags) db.DB_HASH, flags=table_flags)
self.eid_trans = db.DB(self.env) self.eid_trans = db.DB(self.env)
self.eid_trans.set_flags(db.DB_DUP) self.eid_trans.set_flags(db.DB_DUP|db.DB_TXN_NOT_DURABLE)
self.eid_trans.open(self.full_name, "eidtrans", self.eid_trans.open(self.full_name, "eidtrans",
db.DB_HASH, flags=table_flags) db.DB_HASH, flags=table_flags)
self.pid_trans = db.DB(self.env) self.pid_trans = db.DB(self.env)
self.pid_trans.set_flags(db.DB_DUP) self.pid_trans.set_flags(db.DB_DUP|db.DB_TXN_NOT_DURABLE)
self.pid_trans.open(self.full_name, "pidtrans", self.pid_trans.open(self.full_name, "pidtrans",
db.DB_HASH, flags=table_flags) db.DB_HASH, flags=table_flags)
self.sid_trans = db.DB(self.env) self.sid_trans = db.DB(self.env)
self.sid_trans.set_flags(db.DB_DUP) self.sid_trans.set_flags(db.DB_DUP|db.DB_TXN_NOT_DURABLE)
self.sid_trans.open(self.full_name, "sidtrans", self.sid_trans.open(self.full_name, "sidtrans",
db.DB_HASH, flags=table_flags) db.DB_HASH, flags=table_flags)
self.oid_trans = db.DB(self.env) self.oid_trans = db.DB(self.env)
self.oid_trans.set_flags(db.DB_DUP) self.oid_trans.set_flags(db.DB_DUP|db.DB_TXN_NOT_DURABLE)
self.oid_trans.open(self.full_name, "oidtrans", self.oid_trans.open(self.full_name, "oidtrans",
db.DB_HASH, flags=table_flags) db.DB_HASH, flags=table_flags)
self.rid_trans = db.DB(self.env) self.rid_trans = db.DB(self.env)
self.rid_trans.set_flags(db.DB_DUP) self.rid_trans.set_flags(db.DB_DUP|db.DB_TXN_NOT_DURABLE)
self.rid_trans.open(self.full_name, "ridtrans", self.rid_trans.open(self.full_name, "ridtrans",
db.DB_HASH, flags=table_flags) db.DB_HASH, flags=table_flags)
self.eventnames = db.DB(self.env) self.eventnames = db.DB(self.env)
self.eventnames.set_flags(db.DB_DUP) self.eventnames.set_flags(db.DB_DUP|db.DB_TXN_NOT_DURABLE)
self.eventnames.open(self.full_name, "eventnames", self.eventnames.open(self.full_name, "eventnames",
db.DB_HASH, flags=table_flags) db.DB_HASH, flags=table_flags)
self.repository_types = db.DB(self.env) self.repository_types = db.DB(self.env)
self.repository_types.set_flags(db.DB_DUP) self.repository_types.set_flags(db.DB_DUP|db.DB_TXN_NOT_DURABLE)
self.repository_types.open(self.full_name, "repostypes", self.repository_types.open(self.full_name, "repostypes",
db.DB_HASH, flags=table_flags) db.DB_HASH, flags=table_flags)
self.reference_map_primary_map = db.DB(self.env) self.reference_map_primary_map = db.DB(self.env)
self.reference_map_primary_map.set_flags(db.DB_DUP) self.reference_map_primary_map.set_flags(db.DB_DUP|db.DB_TXN_NOT_DURABLE)
self.reference_map_primary_map.open(self.full_name, self.reference_map_primary_map.open(self.full_name,
"reference_map_primary_map", "reference_map_primary_map",
db.DB_BTREE, flags=table_flags) db.DB_BTREE, flags=table_flags)
self.reference_map_referenced_map = db.DB(self.env) self.reference_map_referenced_map = db.DB(self.env)
self.reference_map_referenced_map.set_flags(db.DB_DUP) self.reference_map_referenced_map.set_flags(db.DB_DUP|db.DB_TXN_NOT_DURABLE)
self.reference_map_referenced_map.open(self.full_name, self.reference_map_referenced_map.open(self.full_name,
"reference_map_referenced_map", "reference_map_referenced_map",
db.DB_BTREE, flags=table_flags) db.DB_BTREE, flags=table_flags)