Modify

Opened 6 years ago

Closed 5 years ago

#4648 closed defect (fixed)

[DiscussionPlugin] Upgrade fails after creating new project in multiproject setup

Reported by: taras Owned by: Blackhex
Priority: normal Component: DiscussionPlugin
Severity: critical Keywords: multiproject upgrade
Cc: Trac Release: 0.11

Description

Hello There,
I have trac setup in multi project configuration.

All projects inherit from one trac.ini file. The global trac.ini file activates DiscussionPlugin.

The problem occurs when I create a new project using --inherit option.

when I open the project page the first time I get the following error

Trac Error

TracError: The Trac Environment needs to be upgraded.

Run "trac-admin /var/lib/trac/sites/optego upgrade"

The log files shows the following entries

2009-02-17 14:19:37,548 Trac[loader] DEBUG: Adding plugin TracWysiwyg 0.2-r4353 from /var/lib/trac/global/plugins/TracWysiwyg-0.2_r4353-py2.5.egg
2009-02-17 14:19:37,548 Trac[loader] DEBUG: Adding plugin TracAccountManager 0.2.1dev-r3857 from /usr/lib64/python2.5/site-packages/TracAccountManager-0.2.1dev_r3857-py2.5.egg
2009-02-17 14:19:37,548 Trac[loader] DEBUG: Adding plugin TracUserManagerPlugin 0.3 from /usr/lib64/python2.5/site-packages/TracUserManagerPlugin-0.3-py2.5.egg
2009-02-17 14:19:37,549 Trac[loader] DEBUG: Adding plugin AutocompleteUsers 0.4.1 from /var/lib/trac/global/plugins/AutocompleteUsers-0.4.1-py2.5.egg
2009-02-17 14:19:37,549 Trac[loader] DEBUG: Adding plugin Genshi 0.5.1 from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,549 Trac[loader] DEBUG: Adding plugin setuptools 0.6c8 from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,549 Trac[loader] DEBUG: Adding plugin TracDiscussion 0.6 from /var/lib/trac/global/plugins/TracDiscussion-0.6-py2.5.egg
2009-02-17 14:19:37,549 Trac[loader] DEBUG: Adding plugin TicketImport 0.7b from /var/lib/trac/global/plugins/TicketImport-0.7b-py2.5.egg
2009-02-17 14:19:37,550 Trac[loader] DEBUG: Adding plugin timingandestimationplugin 0.7.3 from /var/lib/trac/global/plugins/timingandestimationplugin-0.7.3-py2.5.egg
2009-02-17 14:19:37,550 Trac[loader] DEBUG: Adding plugin AdvancedTicketWorkflowPlugin 0.10dev-r3940 from /var/lib/trac/global/plugins/AdvancedTicketWorkflowPlugin-0.10dev_r3940-py2.5.egg
2009-02-17 14:19:37,550 Trac[loader] DEBUG: Adding plugin Trac 0.11.2 from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,550 Trac[loader] DEBUG: Adding plugin TracXMLRPC 1.0.0 from /var/lib/trac/global/plugins/TracXMLRPC-1.0.0-py2.5.egg
2009-02-17 14:19:37,550 Trac[loader] DEBUG: Adding plugin TracMasterTickets 2.1.3 from /var/lib/trac/global/plugins/TracMasterTickets-2.1.3-py2.5.egg
2009-02-17 14:19:37,551 Trac[loader] DEBUG: Skipping "TracHtGroupEditor 1.0dev-r1949": ("TracWebAdmin" not found)
2009-02-17 14:19:37,551 Trac[loader] DEBUG: Loading acct_mgr.admin from /usr/lib64/python2.5/site-packages/TracAccountManager-0.2.1dev_r3857-py2.5.egg
2009-02-17 14:19:37,551 Trac[loader] DEBUG: Loading acct_mgr.db from /usr/lib64/python2.5/site-packages/TracAccountManager-0.2.1dev_r3857-py2.5.egg
2009-02-17 14:19:37,551 Trac[loader] DEBUG: Loading acct_mgr.htfile from /usr/lib64/python2.5/site-packages/TracAccountManager-0.2.1dev_r3857-py2.5.egg
2009-02-17 14:19:37,551 Trac[loader] DEBUG: Loading acct_mgr.http from /usr/lib64/python2.5/site-packages/TracAccountManager-0.2.1dev_r3857-py2.5.egg
2009-02-17 14:19:37,551 Trac[loader] DEBUG: Loading acct_mgr.notification from /usr/lib64/python2.5/site-packages/TracAccountManager-0.2.1dev_r3857-py2.5.egg
2009-02-17 14:19:37,552 Trac[loader] DEBUG: Loading acct_mgr.pwhash from /usr/lib64/python2.5/site-packages/TracAccountManager-0.2.1dev_r3857-py2.5.egg
2009-02-17 14:19:37,552 Trac[loader] DEBUG: Loading acct_mgr.svnserve from /usr/lib64/python2.5/site-packages/TracAccountManager-0.2.1dev_r3857-py2.5.egg
2009-02-17 14:19:37,552 Trac[loader] DEBUG: Loading acct_mgr.web_ui from /usr/lib64/python2.5/site-packages/TracAccountManager-0.2.1dev_r3857-py2.5.egg
2009-02-17 14:19:37,552 Trac[loader] DEBUG: Loading acct_mgr.api from /usr/lib64/python2.5/site-packages/TracAccountManager-0.2.1dev_r3857-py2.5.egg
2009-02-17 14:19:37,552 Trac[loader] DEBUG: Loading tracusermanager.account from /usr/lib64/python2.5/site-packages/TracUserManagerPlugin-0.3-py2.5.egg
2009-02-17 14:19:37,552 Trac[loader] DEBUG: Loading tracusermanager.api from /usr/lib64/python2.5/site-packages/TracUserManagerPlugin-0.3-py2.5.egg
2009-02-17 14:19:37,553 Trac[loader] DEBUG: Loading tracusermanager.profile from /usr/lib64/python2.5/site-packages/TracUserManagerPlugin-0.3-py2.5.egg
2009-02-17 14:19:37,553 Trac[loader] DEBUG: Loading tracusermanager.permissions from /usr/lib64/python2.5/site-packages/TracUserManagerPlugin-0.3-py2.5.egg
2009-02-17 14:19:37,553 Trac[loader] DEBUG: Loading tracusermanager.admin from /usr/lib64/python2.5/site-packages/TracUserManagerPlugin-0.3-py2.5.egg
2009-02-17 14:19:37,553 Trac[loader] DEBUG: Loading trac.ticket.web_ui from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,553 Trac[loader] DEBUG: Loading trac.mimeview.php from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,554 Trac[loader] DEBUG: Loading trac.ticket.query from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,554 Trac[loader] DEBUG: Loading trac.attachment from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,554 Trac[loader] DEBUG: Loading trac.versioncontrol.svn_fs from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,555 Trac[loader] DEBUG: Loading trac.mimeview.patch from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,555 Trac[loader] DEBUG: Loading trac.mimeview.txtl from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,555 Trac[loader] DEBUG: Loading trac.admin.web_ui from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,556 Trac[loader] DEBUG: Loading trac.ticket.admin from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,556 Trac[loader] DEBUG: Loading trac.mimeview.rst from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,556 Trac[loader] DEBUG: Loading trac.db.postgres from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,557 Trac[loader] DEBUG: Loading trac.versioncontrol.web_ui from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,557 Trac[loader] DEBUG: Loading trac.timeline from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,557 Trac[loader] DEBUG: Loading trac.mimeview.pygments from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,558 Trac[loader] DEBUG: Loading trac.about from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,558 Trac[loader] DEBUG: Loading trac.ticket.roadmap from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,558 Trac[loader] DEBUG: Loading trac.mimeview.silvercity from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,569 Trac[loader] DEBUG: Skipping "trac.mimeview.silvercity = trac.mimeview.silvercity [silvercity]": ("SilverCity>=0.9.4" not found)
2009-02-17 14:19:37,569 Trac[loader] DEBUG: Loading trac.wiki.macros from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,569 Trac[loader] DEBUG: Loading trac.db.sqlite from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,570 Trac[loader] DEBUG: Loading trac.wiki.web_ui from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,570 Trac[loader] DEBUG: Loading trac.mimeview.enscript from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,570 Trac[loader] DEBUG: Loading trac.web.auth from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,571 Trac[loader] DEBUG: Loading trac.admin.console from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,571 Trac[loader] DEBUG: Loading trac.db.mysql from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,571 Trac[loader] DEBUG: Loading trac.search from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,571 Trac[loader] DEBUG: Loading trac.prefs from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,572 Trac[loader] DEBUG: Loading trac.ticket.report from /usr/lib64/python2.5/site-packages
2009-02-17 14:19:37,572 Trac[loader] DEBUG: Loading tracwysiwyg from /var/lib/trac/global/plugins/TracWysiwyg-0.2_r4353-py2.5.egg
2009-02-17 14:19:37,572 Trac[loader] DEBUG: Loading autocompleteusers from /var/lib/trac/global/plugins/AutocompleteUsers-0.4.1-py2.5.egg
2009-02-17 14:19:37,572 Trac[loader] DEBUG: Loading TracDiscussion.core from /var/lib/trac/global/plugins/TracDiscussion-0.6-py2.5.egg
2009-02-17 14:19:37,573 Trac[loader] DEBUG: Loading TracDiscussion.api from /var/lib/trac/global/plugins/TracDiscussion-0.6-py2.5.egg
2009-02-17 14:19:37,573 Trac[loader] DEBUG: Loading TracDiscussion.init from /var/lib/trac/global/plugins/TracDiscussion-0.6-py2.5.egg
2009-02-17 14:19:37,573 Trac[loader] DEBUG: Loading TracDiscussion.search from /var/lib/trac/global/plugins/TracDiscussion-0.6-py2.5.egg
2009-02-17 14:19:37,573 Trac[loader] DEBUG: Loading TracDiscussion.timeline from /var/lib/trac/global/plugins/TracDiscussion-0.6-py2.5.egg
2009-02-17 14:19:37,573 Trac[loader] DEBUG: Loading TracDiscussion.wiki from /var/lib/trac/global/plugins/TracDiscussion-0.6-py2.5.egg
2009-02-17 14:19:37,574 Trac[loader] DEBUG: Loading TracDiscussion.admin from /var/lib/trac/global/plugins/TracDiscussion-0.6-py2.5.egg
2009-02-17 14:19:37,574 Trac[loader] DEBUG: Loading TracDiscussion.notification from /var/lib/trac/global/plugins/TracDiscussion-0.6-py2.5.egg
2009-02-17 14:19:37,574 Trac[loader] DEBUG: Loading TicketImport from /var/lib/trac/global/plugins/TicketImport-0.7b-py2.5.egg
2009-02-17 14:19:37,574 Trac[loader] DEBUG: Loading timingandestimationplugin from /var/lib/trac/global/plugins/timingandestimationplugin-0.7.3-py2.5.egg
2009-02-17 14:19:37,574 Trac[loader] DEBUG: Loading advancedworkflow.controller from /var/lib/trac/global/plugins/AdvancedTicketWorkflowPlugin-0.10dev_r3940-py2.5.egg
2009-02-17 14:19:37,574 Trac[loader] DEBUG: Loading TracXMLRPC from /var/lib/trac/global/plugins/TracXMLRPC-1.0.0-py2.5.egg
2009-02-17 14:19:37,575 Trac[loader] DEBUG: Loading mastertickets.web_ui from /var/lib/trac/global/plugins/TracMasterTickets-2.1.3-py2.5.egg
2009-02-17 14:19:37,575 Trac[loader] DEBUG: Loading mastertickets.api from /var/lib/trac/global/plugins/TracMasterTickets-2.1.3-py2.5.egg
2009-02-17 14:19:37,596 Trac[default_workflow] DEBUG: Workflow actions at initialization: {'resolve': {'operations': [u'set_resolution'], 'name': 'resolve', 'default': 1, 'newstate': u'testing', 'oldstates': [u'assigned', u'accepted'], 'permissions': [u'TICKET_MODIFY']}, 'close_new': {'operations': [u'set_resolution'], 'name': u'close', 'default': 0, 'newstate': u'closed', 'oldstates': [u'new', u'reopened'], 'permissions': [u'TICKET_ADMIN']}, 'accept': {'operations': [u'set_owner_to_self'], 'name': 'accept', 'default': 3, 'newstate': u'accepted', 'oldstates': [u'new', u'assigned', u'accepted', u'reopened'], 'permissions': [u'TICKET_MODIFY']}, 'leave': {'operations': [u'leave_status'], 'name': 'leave', 'default': 4, 'newstate': u'*', 'oldstates': [u'*'], 'permissions': []}, 'reopen': {'operations': [u'del_resolution'], 'name': 'reopen', 'default': 3, 'newstate': u'reopened', 'oldstates': [u'testing', u'closed'], 'permissions': [u'TICKET_CREATE']}, 'reassign': {'operations': [u'set_owner'], 'name': 'reassign', 'default': 2, 'newstate': u'assigned', 'oldstates': [u'new', u'assigned', u'accepted', u'reopened'], 'permissions': [u'TICKET_MODIFY']}, 'close': {'operations': [], 'name': 'close', 'default': 0, 'newstate': u'closed', 'oldstates': [u'testing'], 'permissions': [u'TICKET_ADMIN']}, '_reset': {'operations': ['reset_workflow'], 'name': 'reset', 'default': 0, 'newstate': 'new', 'oldstates': [], 'permissions': []}}

2009-02-17 14:19:37,604 Trac[init] DEBUG: SELECT value FROM system WHERE name='discussion_version'
2009-02-17 14:19:37,604 Trac[env] WARNING: Component <tracdiscussion.init.DiscussionInit object at 0x4e91850> requires environment upgrade

If I run trac-admin project upgrade, I get the following error

trac-admin ../sites/optego/ upgrade  
Traceback (most 
recent call last):
  File "/usr/bin/trac-admin", line 8, in <module>
    load_entry_point('Trac==0.11.2', 'console_scripts', 
'trac-admin')()
  File 
"/usr/lib64/python2.5/site-packages/trac/admin/console.py", 
line 1294, in run
    return admin.onecmd(command)
  File 
"/usr/lib64/python2.5/site-packages/trac/admin/console.py", 
line 123, in onecmd
    rv = cmd.Cmd.onecmd(self, line) or 0
  File "/usr/lib64/python2.5/cmd.py", line 219, in onecmd
    return func(arg)
  File 
"/usr/lib64/python2.5/site-packages/trac/admin/console.py", 
line 1144, in do_upgrade
    self.__env.upgrade(backup=do_backup)
  File "/usr/lib64/python2.5/site-packages/trac/env.py", line 
449, in upgrade
    participant.upgrade_environment(db)
  File "build/bdist.linux-x86_64/egg/tracdiscussion/init.py", 
line 35, in upgrade_environment
  File 
"build/bdist.linux-x86_64/egg/tracdiscussion/db/db2.py", line 
31, in do_upgrade
  File "/usr/lib64/python2.5/site-packages/trac/db/util.py", 
line 51, in execute
    return self.cursor.execute(sql)
  File 
"/usr/lib64/python2.5/site-packages/trac/db/sqlite_backend.py", 
line 58, in execute
    args or [])
  File 
"/usr/lib64/python2.5/site-packages/trac/db/sqlite_backend.py", 
line 50, in _rollback_on_error
    return function(self, *args, **kwargs)
sqlite3.OperationalError: table forum_group already exists

This is the only component that exhibits this kind of problem after installation.

Thank you,
Taras

Attachments (1)

discussion-upgrade.patch (5.7 KB) - added by mixedpuppy 5 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 6 years ago by taras

Forgot to mention,
that I'm using the latest version of code from the trunk.
I rebuilt it today, after Radek restructured the repository.
Thank you,
Taras

comment:2 Changed 6 years ago by taras

To get my project to work I do the following:

  1. delete discussion_version = 1 from system table
  2. drop tables forum, forum_group, topic, message

Now I need to figure out what's causing this problem.

comment:3 Changed 6 years ago by Blackhex

  • Status changed from new to assigned

I tried to evoke this on my system but I didn't. I think that only way this may happen is that you have specified same database file for your parent and child environment. Is that true? I'm not sure that this is intended use of Trac but I'm sure this will bring this kind of error since DiscussionPlugin does not expect that tables aleady exists.

comment:4 Changed 6 years ago by taras

I don't have a parent database. Each of the projects has it's own separate database.
The database is created using --inherit, which inherits a predefined trac.ini file. The trac.ini file on the instance is very bear.

is there any other I can provide to you to make it easier?

comment:5 Changed 6 years ago by Blackhex

trac-admin --inherit only creates dependent environment but you have to supply database connection string manually every time. Didn't happen that you have passed same DB connection string to two or more of your environments? In other words, do your environments use different trac.db files?

comment:6 Changed 6 years ago by taras

yes, each has a separate db inside located in $project/db/trac.db

comment:7 Changed 6 years ago by Blackhex

OK, then. Now I need to know if it happend only once or if this is evokable every time? Try to create new parent environment and few dependent from scratch using same procedure and if you encounter the error send me, please, trac.db files and debug logs (from the environment creation and upgrade) from each environment. Sorry that I have to bother you but since I cannot reproduce this on my machine, I have to exploit you.

Changed 5 years ago by mixedpuppy

comment:8 Changed 5 years ago by mixedpuppy

I had upgrade issues as well (perhaps not exactly the same), attached a patch. With postgres and persistent connections pooled by trac, you need to cleanup your temp tables. temp tables are deleted when the db session ends.

comment:9 Changed 5 years ago by Blackhex

Thank you for investigating cause of the problem and for the patch. In r6308 I tried simpler solution that should work too. Can you test it and give me a report plese?

comment:10 Changed 5 years ago by mixedpuppy

that works fine. I prefer a bit more error handling, as I often have to deal with failed upgrades due to the lack of that.

comment:11 Changed 5 years ago by Blackhex

  • Resolution set to fixed
  • Status changed from assigned to closed

OK, I'm closing it.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.