Bug #06459 : change the lock strategy and split transactions in Merge citation.
svn: r21504
This commit is contained in:
parent
e8bad4d4c8
commit
7541dd5b2e
@ -148,8 +148,8 @@ class CLIDbManager(object):
|
|||||||
from gramps.gen.db import META, PERSON_TBL
|
from gramps.gen.db import META, PERSON_TBL
|
||||||
env = db.DBEnv()
|
env = db.DBEnv()
|
||||||
flags = db.DB_CREATE | db.DB_PRIVATE |\
|
flags = db.DB_CREATE | db.DB_PRIVATE |\
|
||||||
db.DB_INIT_MPOOL | db.DB_INIT_LOCK |\
|
db.DB_INIT_MPOOL |\
|
||||||
db.DB_INIT_LOG | db.DB_INIT_TXN | db.DB_THREAD
|
db.DB_INIT_LOG | db.DB_INIT_TXN
|
||||||
try:
|
try:
|
||||||
env.open(file_name, flags)
|
env.open(file_name, flags)
|
||||||
except:
|
except:
|
||||||
|
@ -198,8 +198,8 @@ if __name__ == "__main__":
|
|||||||
x = db.DBEnv()
|
x = db.DBEnv()
|
||||||
print("3")
|
print("3")
|
||||||
x.open('/tmp', db.DB_CREATE | db.DB_PRIVATE |\
|
x.open('/tmp', db.DB_CREATE | db.DB_PRIVATE |\
|
||||||
db.DB_INIT_MPOOL | db.DB_INIT_LOCK |\
|
db.DB_INIT_MPOOL |\
|
||||||
db.DB_INIT_LOG | db.DB_INIT_TXN | db.DB_THREAD)
|
db.DB_INIT_LOG | db.DB_INIT_TXN)
|
||||||
print("4")
|
print("4")
|
||||||
d = dbshelve.DBShelf(x)
|
d = dbshelve.DBShelf(x)
|
||||||
print("5")
|
print("5")
|
||||||
|
@ -495,8 +495,8 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
|
|
||||||
# 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_LOG | db.DB_INIT_TXN | db.DB_THREAD
|
db.DB_INIT_LOG | db.DB_INIT_TXN
|
||||||
|
|
||||||
# As opposed to before, we always try recovery on databases
|
# As opposed to before, we always try recovery on databases
|
||||||
env_flags |= db.DB_RECOVER
|
env_flags |= db.DB_RECOVER
|
||||||
@ -1135,11 +1135,6 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
self.transaction_abort(self.transaction)
|
self.transaction_abort(self.transaction)
|
||||||
self.env.txn_checkpoint()
|
self.env.txn_checkpoint()
|
||||||
|
|
||||||
lockstats = self.env.lock_stat()
|
|
||||||
_LOG.debug("lock occupancy: %d%%, locked object occupancy: %d%%" % (
|
|
||||||
round(lockstats['maxnlocks']*100/lockstats['maxlocks']),
|
|
||||||
round(lockstats['maxnobjects']*100/lockstats['maxobjects'])))
|
|
||||||
|
|
||||||
self.__close_metadata()
|
self.__close_metadata()
|
||||||
self.name_group.close()
|
self.name_group.close()
|
||||||
self.surnames.close()
|
self.surnames.close()
|
||||||
@ -2055,8 +2050,8 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
|
|
||||||
# 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_LOG | db.DB_INIT_TXN | db.DB_THREAD
|
db.DB_INIT_LOG | db.DB_INIT_TXN
|
||||||
|
|
||||||
# As opposed to before, we always try recovery on databases
|
# As opposed to before, we always try recovery on databases
|
||||||
env_flags |= db.DB_RECOVER
|
env_flags |= db.DB_RECOVER
|
||||||
|
@ -188,8 +188,8 @@ class MergeCitations(tool.BatchTool,ManagedWindow):
|
|||||||
|
|
||||||
db.disable_signals()
|
db.disable_signals()
|
||||||
num_merges = 0
|
num_merges = 0
|
||||||
with DbTxn(_("Merge Citation"), db) as trans:
|
for handle in db.iter_source_handles():
|
||||||
for handle in db.iter_source_handles():
|
with DbTxn(_("Merge Citation"), db) as trans:
|
||||||
dict = {}
|
dict = {}
|
||||||
citation_handle_list = list(db.find_backlink_handles(handle))
|
citation_handle_list = list(db.find_backlink_handles(handle))
|
||||||
for (class_name, citation_handle) in citation_handle_list:
|
for (class_name, citation_handle) in citation_handle_list:
|
||||||
|
Loading…
Reference in New Issue
Block a user