7 | | It '''should''' still be possible to use the old SQLite 2.8.x (everything except search seems to work) |
8 | | with the Pysqlite [http://initd.org/pub/software/pysqlite/releases/1.0/1.0.1 1.0.1], |
9 | | but Trac 0.9 works best with '''SQLite 3.2.8'''. The compatible |
10 | | Python bindings are: |
| 7 | == Installation == |
| 8 | === The SQLite library === |
| 9 | |
| 10 | Trac 0.9 works best with '''[http://www.sqlite.org/version3.html SQLite 3.x]''', |
| 11 | like SQLite 3.2.8 or SQLite 3.3.x. |
| 12 | |
| 13 | Pay attention to |
| 14 | [http://www.sqlite.org/formatchng.html database format changes] |
| 15 | when upgrading the SQLite library. |
| 16 | See below how to [wiki:PySqlite#Upgradingsqlite upgrade] your database, |
| 17 | if needed. |
| 18 | |
| 19 | ''It should still be possible to use the old SQLite 2.8.x version: |
| 20 | everything seems to work (except the search, see #2960) |
| 21 | You should then use an equally old Pysqlite version, namely |
| 22 | [http://initd.org/pub/software/pysqlite/releases/1.0/1.0.1 1.0.1].'' |
| 23 | |
| 24 | ==== Downloading SQLite ==== |
| 25 | |
| 26 | The latest stable version of SQLite can be obtained on the |
| 27 | [http://www.sqlite.org/download.html SQLite download] page. |
| 28 | |
| 29 | ==== Building SQLite yourself ==== |
| 30 | '''Note:''' If you want to use Trac in a multi-threaded setup |
| 31 | by using either TracModPython or TracStandalone, be sure to build a |
| 32 | '''thread-safe version of SQLite''', by using the `--enable-threadsafe` |
| 33 | configuration switch. |
| 34 | If you use a non thread-safe library, which is unfortunately what you |
| 35 | get by default on non-windows platforms, you face the risk to get |
| 36 | persistent database locks (see #2170). |
| 37 | |
| 38 | === The Pysqlite2 bindings === |
| 39 | |
| 40 | The most stable versions are '''2.0.7''' and '''2.1.3'''. |
| 41 | |
| 42 | '''2.2.0''' is probably rock solid as well, but it's a bit too early to tell. |
| 43 | |
| 44 | Detailed release information: |
57 | | For more information see http://www.sqlite.org/version3.html |
| 92 | == Troubleshooting == |
| 93 | |
| 94 | From time to time, there are reports about problems related to |
| 95 | Pysqlite and/or SQLite. This section willl guide you through |
| 96 | understanding and fixing those issues, should those problems |
| 97 | also happen to you. |
| 98 | |
| 99 | === `OperationalError: unsupported file format` === |
| 100 | |
| 101 | ''This probably is symptomatic of a mismatch between the SQLite library and the SQLite database format.'' |
| 102 | |
| 103 | See [http://permalink.gmane.org/gmane.comp.version-control.subversion.trac.general/7540 Trac-ML:7540] |
| 104 | |
| 105 | === `OperationalError: SQL logic error or missing database` === |
| 106 | |
| 107 | ''This can indicate that the database was corrupted.'' |
| 108 | |
| 109 | A procedure similar to upgrading can be used in order to recover |
| 110 | such a database: |
| 111 | {{{ |
| 112 | sqlite3 corrupted.db .dump | sqlite3 recovered.db |
| 113 | }}} |
| 114 | |
| 115 | (see #2598, for example) |
| 116 | |
| 117 | ''This can also be the symptom of errors due to constraint violations'' |
| 118 | |
| 119 | And this ''might'' correspond to an open bug. See #2902 and #2570. |
| 120 | |
| 121 | === `OperationalError: database is locked` === |
| 122 | |
| 123 | There are numerous reasons why you can get this. |
| 124 | |
| 125 | First, if this only happens occasionally and if the Trac server |
| 126 | is still reachable after a second attempt, then it's not really |
| 127 | a problem. This simply can happen and indicates that some |
| 128 | other user was writing to the database at the same time your |
| 129 | request triggerd an attempted to write. |
| 130 | There are probably a few things that could be enhanced in the |
| 131 | future to handle this situation, like automatic retry (or improve |
| 132 | the session code). |
| 133 | |
| 134 | The lock error is also much more frequent if SQLite is used in a |
| 135 | multi-threaded environment (like TracStandalone or TracModPython) |
| 136 | but the library was not compiled to be thread-safe. |
| 137 | See above [wiki:PySqlite#Buildingsqliteyourself building from source] |
| 138 | and #2170. |
| 139 | |
| 140 | The real problem with this occurs when ''all'' requests to Trac |
| 141 | end up with this error. This indicates a permanent lock situation, |
| 142 | which is not normal. Here are the known possible reasons for this: |
| 143 | * there was a crash related to some other part of the system, |
| 144 | like due to the svn bindings, and the SQLite journal file |
| 145 | (which is the materialization of the lock), was left behind. |
| 146 | Simply removing the journal file will take care of the lock |
| 147 | situation. Of course, you'll have to fix the faulty part of |
| 148 | system in order to get rid of the crashes (e.g. see #1590). |
| 149 | * The Pysqlite version is older than 2.0.5 and/or Trac is pre0.9. |
| 150 | Upgrading Trac and Pysqlite will solve the issue (see #2345) |
| 151 | |
| 152 | === `ProgrammingError: library routine called out of sequence` === |
| 153 | |
| 154 | This happens on MacOS X, and is still an open issue (see #2969) |
| 155 | |
| 156 | === `Segmentation Fault` === |
| 157 | |
| 158 | Some old Python 2.3 versions (like on SuSE 9.0) have a bug |
| 159 | related to gc and weakrefs, which might be triggered by Trac. |
| 160 | |
| 161 | ([http://projects.edgewall.com/trac/ticket/2170#change_8 details]) |
| 162 | |
| 163 | |
| 164 | '''P.S. Note that despite of all of the above, for some (most?) users, SQLite/Pysqlite works flawlessly :)''' |