#2016 closed defect (fixed)
hotcopy depends on PySQLite 1.x
Reported by: | Owned by: | Christopher Lenz | |
---|---|---|---|
Priority: | high | Milestone: | 0.9 |
Component: | admin/console | Version: | devel |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
I'm on the latest trunk, running on Windows 2003 Server, and get this stack trace:
Trac [<repopath>]> hotcopy \tr Traceback (most recent call last): File "trac-admin", line 26, in ? run(*sys.argv[1:]) File "C:\Program Files\Python23\Lib\site-packages\trac\scripts \admin.py", 1085, in run tracadm.run() File "C:\Program Files\Python23\Lib\site-packages\trac\scripts \admin.py", 82, in run self.cmdloop() File "C:\Program Files\Python23\lib\cmd.py", line 133, in cmdloop stop = self.onecmd(line) File "C:\Program Files\Python23\lib\cmd.py", line 210, in onecmd return func(arg) File "C:\Program Files\Python23\Lib\site-packages\trac\scripts \admin.py", 1053, in do_hotcopy cnx.db.execute("BEGIN") File "C:\Program Files\Python23\Lib\site-packages\trac\db.py", line 101, getattr__ return getattr(self.cnx, name) File "C:\Program Files\Python23\Lib\site-packages\trac\db.py", line 101, getattr__ return getattr(self.cnx, name) AttributeError: 'pysqlite2.dbapi2.Connection' object has no attribute 'db'
Other trac admin commands seem to work fine, as does normal use of the wiki etc.
FYI - the other versions I have are clearilver 0.9.14, docutils 0.3.9, pysqlite 2.0.3, sqlite 3.2.5, svn 1.2.3.
Response from the mailing list was "This is a leftover from when we only supported SQLite, and only PySQLite 1.x. ".
Attachments (0)
Change History (6)
comment:1 by , 19 years ago
Milestone: | → 0.9 |
---|---|
Priority: | normal → high |
comment:2 by , 19 years ago
Summary: | hotcopy crashes → hotcopy depends on PySQLite 1.x |
---|
comment:3 by , 19 years ago
The following patch resolves this problem:
-
trac/scripts/admin.py
1050 1050 return 1051 1051 cnx = self.db_open() 1052 1052 # Lock the database while copying files 1053 c nx.db.execute("BEGIN")1054 print 'Hotcopying %s to %s ...' % (self.__env.path, dest) ,1053 cursor = cnx.cursor() 1054 print 'Hotcopying %s to %s ...' % (self.__env.path, dest) 1055 1055 try: 1056 1056 shutil.copytree(self.__env.path, dest, symlinks=1) 1057 1057 print 'OK' 1058 1058 except Exception, err: 1059 1059 print err 1060 1060 # Unlock database 1061 cnx. db.execute("ROLLBACK")1061 cnx.rollback() 1062 1062 1063 1063 ## --------------------------------------------------------------------------- 1064 1064
However, I'm not sure whether this actually locks the database during hotcopy.
comment:4 by , 19 years ago
Simply opening a cursor to the database doesn't lock it. Executing BEGIN
in a pysqlite2 cursor doesn't seem to actually lock the database (though it confuses pysqlite2 since it tries to start transactions itself when you run a query that may update the database.
As far as I can tell the only way to lock the database with pysqlite2 is to execute an INSERT/UPDATE/DELETE
statement. I suppose that one option would be to simply run an innocuous statement that wouldn't change anything, but would force it to lock the database:
update system set name = null where name is null
comment:5 by , 19 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Yeah, that's probably the best we can do here. I'll make that change.
Better summary