Roundup Tracker - Issues

Issue 2550533

classification
upgrade to 1.4.8 + roundup-admin reindex -> crash (postgresql backend)
Type: crash Severity: normal
Components: Installation, Database Versions: 1.4
process
Status: closed fixed
:
: : ThomasAH, rouilj, stephen
Priority: :

Created on 2009-03-20 19:28 by stephen, last changed 2016-07-07 22:45 by rouilj.

Messages
msg3667 Author: [hidden] (stephen) Date: 2009-03-20 19:28
I upgraded from about 1.4.1 + local patches that shouldn't be relevant (I added a "bulkimport" method to the mailgw, 
similar to mbox, but aware of message-ids so you can import the same message multiple times and it will be ignored if 
redundant).

Then I stopped the server and ran "roundup-admin -i `pwd` migrate" and "roundup-admin -i `pwd` reindex" in the 
instance directory.  I assume the problem is the reindex because migrate said nothing needed to be done.

After that all attempts to access the server gave a traceback as follows:

steve@tleeps1:/var/www/trackers/xemacs$ roundup-admin -i `pwd`
Roundup 1.4.8 ready for input.
Type "help" for help.
roundup> table priority
Traceback (most recent call last):
  File "/usr/local/bin/roundup-admin", line 6, in ?
    run()
  File "/usr/local/lib/python2.4/site-packages/roundup/scripts/roundup_admin.py", line 38, in run
    sys.exit(tool.main())
  File "/usr/local/lib/python2.4/site-packages/roundup/admin.py", line 1524, in main
    self.interactive()
  File "/usr/local/lib/python2.4/site-packages/roundup/admin.py", line 1462, in interactive
    self.run_command(args)
  File "/usr/local/lib/python2.4/site-packages/roundup/admin.py", line 1425, in run_command
    self.db = tracker.open('admin')
  File "/usr/local/lib/python2.4/site-packages/roundup/instance.py", line 131, in open
    db.post_init()
  File "/usr/local/lib/python2.4/site-packages/roundup/backends/rdbms_common.py", line 230, in post_init
    save = save | self.upgrade_db()
  File "/usr/local/lib/python2.4/site-packages/roundup/backends/rdbms_common.py", line 281, in upgrade_db
    self.fix_version_4_tables()
  File "/usr/local/lib/python2.4/site-packages/roundup/backends/rdbms_common.py", line 308, in fix_version_4_tables
    self.add_class_key_required_unique_constraint(cn, klass.key)
  File "/usr/local/lib/python2.4/site-packages/roundup/backends/rdbms_common.py", line 577, in
    add_class_key_required_unique_constraint
    self.sql(sql)
  File "/usr/local/lib/python2.4/site-packages/roundup/backends/rdbms_common.py", line 161, in sql
    self.cursor.execute(sql)
psycopg2.ProgrammingError: relation "_status_key_retired_idx" already exists

(similar tracebacks would result from attempts to access the web interface, this is nice and compact, though).

The workaround was to fire up psql, connect to the postgresql database, and execute "DROP INDEX 
_status_key_retired_idx;".  This needed to be run for most of the properties that an issue has.  My tracker is now running 
normally as far as I can tell.
msg3858 Author: [hidden] (ThomasAH) Date: 2009-08-20 14:07
I ran into this problem when upgrading from 0.7.12 to 1.4.9.
The index gets created during one of the upgrade steps so I could not
manually drop it.

My workaround was to ignore errors when creating the index in
add_class_key_required_unique_constraint() in rdbms_common.py:

        try:
            self.sql(sql)
        except Exception:
            pass
msg5776 Author: [hidden] (rouilj) Date: 2016-07-07 22:45
Looking at the current function:

 def add_class_key_required_unique_constraint(self, cn, key):
        sql = '''create unique index _%s_key_retired_idx
            on _%s(__retired__, _%s)'''%(cn, cn, key)
        try:
            self.sql(sql)
        except StandardError:
            # XXX catch e.g.:
            # _sqlite.DatabaseError: index _status_key_retired_idx
already exists
            pass

it looks like it will catch and ignore that error if an exception
is raised. The checkin that added that says:

changeset:   4774:3adff0fb0207
user:        Thomas Arendsen Hein
date:        Fri Mar 22 15:53:27 2013 +0100
files:       CHANGES.txt roundup/backends/back_sqlite.py
roundup/backends/rdbms_common.py
description:
Fixed issue2550595: Allow migrating from roundup 0.x to 1.4

All changes were required to make an upgrade from 0.6 to 1.4,
The changes affecting "retired" were required for an upgrade from 0.8 to
1.4.

So I am closing this.
History
Date User Action Args
2016-07-07 22:45:10rouiljsetstatus: new -> closed
resolution: fixed
messages: + msg5776
nosy: + rouilj
2009-08-20 14:07:09ThomasAHsetnosy: + ThomasAH
messages: + msg3858
2009-03-20 19:28:25stephencreate