Changeset - 71640985d4dd
[Not reviewed]
0 1 0
Lance Edgar (lance) - 3 years ago 2022-02-05 21:39:45
lance@edbob.org
Commit (or rollback) local transaction before host, when importing

not exactly sure why it used to commit host before local, but it's
pretty dang frustrating to see a massive import fail at the very end,
which makes for a compelling reason to commit local before host.
1 file changed with 18 insertions and 2 deletions:
0 comments (0 inline, 0 general)
rattail/importing/handlers.py
Show inline comments
 
@@ -485,8 +485,16 @@ class ImportHandler(object):
 
        pass
 

	
 
    def rollback_transaction(self):
 
        self.rollback_host_transaction()
 
        # nb. it can sometimes be important to rollback the local
 
        # transaction first.  in particular when the import takes a
 
        # long time, it may be that no activity occurs on the host DB
 
        # session after the initial data read.  then at the end
 
        # rolling back the host transaction may trigger a connection
 
        # timeout error, which then prevents local transaction from
 
        # being rolled back.  so now we always rollback local first.
 
        # TODO: maybe sequence should be configurable?
 
        self.rollback_local_transaction()
 
        self.rollback_host_transaction()
 

	
 
    def rollback_host_transaction(self):
 
        pass
 
@@ -495,8 +503,16 @@ class ImportHandler(object):
 
        pass
 

	
 
    def commit_transaction(self):
 
        self.commit_host_transaction()
 
        # nb. it can sometimes be important to commit the local
 
        # transaction first.  in particular when the import takes a
 
        # long time, it may be that no activity occurs on the host DB
 
        # session after the initial data read.  then at the end
 
        # committing the host transaction may trigger a connection
 
        # timeout error, which then prevents local transaction from
 
        # committing.  so now we just commit local first instead.
 
        # TODO: maybe sequence should be configurable?
 
        self.commit_local_transaction()
 
        self.commit_host_transaction()
 

	
 
    def commit_host_transaction(self):
 
        pass
0 comments (0 inline, 0 general)