diff roundup/backends/rdbms_common.py @ 7665:6f841a55eabf

fix: database error handling during import of a non-user item The code to handle the case of retired and active users causing errors during import can get called on other db errors as well (e.g. out of memory in postgresql). The code that trys to detect/repair the out of order user case hard coded the db.user class. This crashed when a db error occurred when loading another data object (e.g. msg). Fix the crash by using the proper db object class for the object class being loaded. Credit to Norbert Schlemmer for finding this.
author John Rouillard <rouilj@ieee.org>
date Wed, 18 Oct 2023 15:49:53 -0400
parents 506c86823abb
children 78585199552a 4af0d235b570
line wrap: on
line diff
--- a/roundup/backends/rdbms_common.py	Wed Oct 18 12:34:23 2023 -0400
+++ b/roundup/backends/rdbms_common.py	Wed Oct 18 15:49:53 2023 -0400
@@ -3298,11 +3298,12 @@
             logger.info('Attempting to handle import exception '
                         'for id %s: %s' % (newid, e))
 
-            keyname = self.db.user.getkey()
+            classdb = self.db.getclass(self.classname)
+            keyname = classdb.getkey()
             if has_node or not keyname:  # Not an integrity error
                 raise
             self.db.restore_connection_on_error()
-            activeid = self.db.user.lookup(d[keyname])
+            activeid = classdb.lookup(d[keyname])
             self.db.sql(retired_sql, (-1, activeid))  # clear the active node
             # this can only happen on an addnode, so retry
             try:

Roundup Issue Tracker: http://roundup-tracker.org/