Modify

Opened 6 years ago

Closed 6 years ago

#3415 closed defect (worksforme)

Sqlite database not upgraded with trac-admin

Reported by: risto.kankkunen@… Owned by: coling
Priority: normal Component: WorkLogPlugin
Severity: critical Keywords:
Cc: Trac Release: 0.11

Description

After upgrading to Trac 0.11 and the latest WorkLogPlugin, Trac tells to upgrade the database with trac-admin. However, after the upgrade Trac tells the database is still in need of an upgrade:

$ trac-admin trac-env upgrade
Worklog needs an upgrade
Upgrading Database
Updating work_log table (v2)
Updating work_log table (v3)
Done upgrading Worklog
Upgrade done.
$ trac-admin trac-env upgrade
Worklog needs an upgrade
Upgrading Database
Updating work_log table (v2)
Done upgrading Worklog
Upgrade done.
$

Etc.

I pin-pointed the problem to what seems to be a statement caching bug in python2.4-pysqlite2-2.3.2-0bpo1 on Debian Etch. Using the attached script I get the following results:

$ dpkg -s python2.4|grep ^Version:
Version: 2.4.4-3
$ python2.4 pysqlitebug.py
Using pysqlite version 2.3.2 sqlite version 3.3.8
Don't trigger the bug
Done.
Trigger the bug
Traceback (most recent call last):
  File "pysqlitebug.py", line 54, in ?
    pysqlite_bug(True)
  File "pysqlitebug.py", line 41, in pysqlite_bug
    assert result == [(1, 'first'), (2, 'second')], result
AssertionError: [(1, u'first'), (2, u'two')]
$ dpkg -s python2.5|grep ^Version:
Version: 2.5-5
$ python2.5 pysqlitebug.py
Using pysqlite version 2.3.2 sqlite version 3.3.8
Don't trigger the bug
Done.
Trigger the bug
Done.

I would be interested to know whether other people using Trac on Debian with SQLite have or don't have the same problem to understand where the problem actually lies.

Attachments (2)

pysqlitebug.py (1.4 KB) - added by risto.kankkunen@… 6 years ago.
Script to demonstrate a bug in pysqlite
upgrade-fix.patch (752 bytes) - added by risto.kankkunen@… 6 years ago.
Patch to work around the pysqlite bug

Download all attachments as: .zip

Change History (4)

Changed 6 years ago by risto.kankkunen@…

Script to demonstrate a bug in pysqlite

comment:1 Changed 6 years ago by risto.kankkunen@…

I made the attached patch to work around the pysqlite bug:

$ trac-admin trac-env upgrade
Worklog needs an upgrade
Upgrading Database
Updating work_log table (v2)
Updating work_log table (v3)
Done upgrading Worklog
Upgrade done.
$ trac-admin trac-env upgrade
Database is up to date, no upgrade necessary.
$

Changed 6 years ago by risto.kankkunen@…

Patch to work around the pysqlite bug

comment:2 Changed 6 years ago by coling

  • Resolution set to worksforme
  • Status changed from new to closed

Hi,

Running your test script on my system doesn't seem to trigger the bug:

Using pysqlite version 2.4.1 sqlite version 3.6.6.2
Don't trigger the bug
Done.
Trigger the bug
Done.

So I think I can close this ticket without applying the patch. I don't like to leave code with odd workarounds in it like this when the real bug should be fixed elsewhere. If you think it's still a problem for people let me know and I'll perhaps reconsider.

I am sorry I didn't notice this bug earlier tho'.. I didn't seem to get email notification for it for whatever reason :(

Add Comment

Modify Ticket

Action
as closed The owner will remain coling.
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.