Edgewall Software
Modify

Opened 8 years ago

Closed 8 years ago

#12618 closed defect (fixed)

EnvironmentStub.upgrade fails for in-memory SQLite database

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.2.1
Component: general Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:

Fixed Environment.upgrade failure for in-memory SQLite database, due to closing the database connection.

Internal Changes:

Description (last modified by Ryan J Ollos)

Discussed in gmessage:trac-dev:Ri1Xj1HBNms/2gME805cCQAJ. I didn't explore the issue in detail, but it appears that an effective workaround is to not close the database for in-memory SQLite:

  • trac/env.py

    diff --git a/trac/env.py b/trac/env.py
    index 8790e49..8f37b12 100644
    a b class Environment(Component, ComponentManager):  
    822822            with self.db_transaction as db:
    823823                participant.upgrade_environment(db)
    824824            # Database schema may have changed, so close all connections
    825             DatabaseManager(self).shutdown()
     825            dbm = DatabaseManager(self)
     826            if dbm.connection_uri != 'sqlite::memory:':
     827                dbm.shutdown()
    826828        del self.database_version
    827829        return True

However, it needs to be explored further before any definite conclusions are drawn.

Attachments (0)

Change History (4)

comment:1 by Ryan J Ollos, 8 years ago

Milestone: next-stable-1.2.x1.2.1
Owner: set to Ryan J Ollos
Status: newassigned

comment:2 by Ryan J Ollos, 8 years ago

Description: modified (diff)

comment:3 by Ryan J Ollos, 8 years ago

Proposed changes in log:rjollos.git:t12618. I had hoped to avoid putting the comparison dbm.connection_uri != 'sqlite::memory:' directly in env.py, but I don't see another good way.

comment:4 by Ryan J Ollos, 8 years ago

API Changes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to 1.2-stable in r15288, merged to trunk in r15289.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.