* src/GrampsDb/_GrampsBSDDB.py (transaction_begin,
transaction_commit): disable secondary index removal/rebuilding due to bugs in bsddb; (_update_reference_map): explicitly check for addition versus update. svn: r5808
This commit is contained in:
parent
8ff4bce687
commit
85cb930006
@ -1,3 +1,9 @@
|
|||||||
|
2006-01-20 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/GrampsDb/_GrampsBSDDB.py (transaction_begin,
|
||||||
|
transaction_commit): disable secondary index removal/rebuilding
|
||||||
|
due to bugs in bsddb; (_update_reference_map): explicitly check
|
||||||
|
for addition versus update.
|
||||||
|
|
||||||
2006-01-20 Don Allingham <don@gramps-project.org>
|
2006-01-20 Don Allingham <don@gramps-project.org>
|
||||||
* src/PageView.py: add ellipsize, better dirty/clean management,
|
* src/PageView.py: add ellipsize, better dirty/clean management,
|
||||||
set fixed column width and fixed height
|
set fixed column width and fixed height
|
||||||
|
@ -612,12 +612,14 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
# Add references to the reference_map for all primary object referenced
|
# Add references to the reference_map for all primary object referenced
|
||||||
# from the primary object 'obj' or any of its secondary objects.
|
# from the primary object 'obj' or any of its secondary objects.
|
||||||
|
|
||||||
if update:
|
handle = obj.get_handle()
|
||||||
|
do_update = self.reference_map_primary_map.has_key(str(handle))
|
||||||
|
|
||||||
|
if do_update:
|
||||||
# FIXME: this needs to be properly integrated into the transaction
|
# FIXME: this needs to be properly integrated into the transaction
|
||||||
# framework so that the reference_map changes are part of the
|
# framework so that the reference_map changes are part of the
|
||||||
# transaction
|
# transaction
|
||||||
|
|
||||||
handle = obj.get_handle()
|
|
||||||
|
|
||||||
# First thing to do is get hold of all rows in the reference_map
|
# First thing to do is get hold of all rows in the reference_map
|
||||||
# table that hold a reference from this primary obj. This means finding
|
# table that hold a reference from this primary obj. This means finding
|
||||||
@ -674,7 +676,7 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
(CLASS_TO_KEY_MAP[ref_class_name],ref_handle),)
|
(CLASS_TO_KEY_MAP[ref_class_name],ref_handle),)
|
||||||
self._add_reference((handle,ref_handle),data,transaction)
|
self._add_reference((handle,ref_handle),data,transaction)
|
||||||
|
|
||||||
if update:
|
if do_update:
|
||||||
# handle deletion of old references
|
# handle deletion of old references
|
||||||
if len(no_longer_required_references) > 0:
|
if len(no_longer_required_references) > 0:
|
||||||
for (ref_class_name,ref_handle) in no_longer_required_references:
|
for (ref_class_name,ref_handle) in no_longer_required_references:
|
||||||
@ -1077,15 +1079,20 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
if transaction.batch:
|
if transaction.batch:
|
||||||
self.env.txn_checkpoint()
|
self.env.txn_checkpoint()
|
||||||
self.env.set_flags(db.DB_TXN_NOSYNC,1) # async txn
|
self.env.set_flags(db.DB_TXN_NOSYNC,1) # async txn
|
||||||
|
# FIXME: There appears to have a bug in bsddb
|
||||||
|
# preventing us from rebuilding the secondary indices.
|
||||||
|
# In particular, the rebuild_secondary will also fail,
|
||||||
|
# but we can't help it. Disabling the secondary index
|
||||||
|
# removal/rebuilding for batch transactions for now.
|
||||||
|
|
||||||
# Disconnect unneeded secondary indices
|
## # Disconnect unneeded secondary indices
|
||||||
self.surnames.close()
|
## self.surnames.close()
|
||||||
junk = db.DB(self.env)
|
## junk = db.DB(self.env)
|
||||||
junk.remove(self.full_name,"surnames")
|
## junk.remove(self.full_name,"surnames")
|
||||||
|
|
||||||
self.reference_map_referenced_map.close()
|
## self.reference_map_referenced_map.close()
|
||||||
junk = db.DB(self.env)
|
## junk = db.DB(self.env)
|
||||||
junk.remove(self.full_name,"reference_map_referenced_map")
|
## junk.remove(self.full_name,"reference_map_referenced_map")
|
||||||
|
|
||||||
return transaction
|
return transaction
|
||||||
|
|
||||||
@ -1108,23 +1115,30 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
self.env.txn_checkpoint()
|
self.env.txn_checkpoint()
|
||||||
self.env.set_flags(db.DB_TXN_NOSYNC,0) # sync txn
|
self.env.set_flags(db.DB_TXN_NOSYNC,0) # sync txn
|
||||||
|
|
||||||
table_flags = db.DB_CREATE|db.DB_AUTO_COMMIT
|
# FIXME: There appears to have a bug in bsddb
|
||||||
# create new secondary indices to replace the ones removed
|
# preventing us from rebuilding the secondary indices.
|
||||||
self.surnames = db.DB(self.env)
|
# In particular, the rebuild_secondary will also fail,
|
||||||
self.surnames.set_flags(db.DB_DUP|db.DB_DUPSORT)
|
# but we can't help it. Disabling the secondary index
|
||||||
self.surnames.open(self.full_name, "surnames", db.DB_BTREE,
|
# removal/rebuilding for batch transactions for now.
|
||||||
flags=table_flags)
|
|
||||||
self.person_map.associate(self.surnames,find_surname,table_flags)
|
|
||||||
|
|
||||||
self.reference_map_referenced_map = db.DB(self.env)
|
## table_flags = db.DB_CREATE|db.DB_AUTO_COMMIT
|
||||||
self.reference_map_referenced_map.set_flags(
|
## # create new secondary indices to replace the ones removed
|
||||||
db.DB_DUP|db.DB_DUPSORT)
|
## self.surnames = db.DB(self.env)
|
||||||
self.reference_map_referenced_map.open(
|
## self.surnames.set_flags(db.DB_DUP)
|
||||||
self.full_name,
|
## self.surnames.open(self.full_name, "surnames", db.DB_BTREE,
|
||||||
"reference_map_referenced_map",
|
## flags=table_flags)
|
||||||
db.DB_BTREE,
|
## self.person_map.associate(self.surnames,find_surname,table_flags)
|
||||||
flags=table_flags)
|
|
||||||
|
|
||||||
|
## self.reference_map_referenced_map = db.DB(self.env)
|
||||||
|
## self.reference_map_referenced_map.set_flags(
|
||||||
|
## db.DB_DUP)
|
||||||
|
## self.reference_map_referenced_map.open(
|
||||||
|
## self.full_name,
|
||||||
|
## "reference_map_referenced_map",
|
||||||
|
## db.DB_BTREE,
|
||||||
|
## flags=table_flags)
|
||||||
|
## self.reference_map.associate(self.reference_map_referenced_map,
|
||||||
|
## find_referenced_handle,table_flags)
|
||||||
self.txn = None
|
self.txn = None
|
||||||
|
|
||||||
def undo(self):
|
def undo(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user