Modify

#11209 closed defect (fixed)

Upgrading Trac throws SQL-error

Reported by: stefan@… Owned by: seccanj
Priority: normal Component: TestManagerForTracPlugin
Severity: blocker Keywords:
Cc: Trac Release: 1.0

Description

I am using Trac 1.1.2dev-r11803 with MySQL and trying to install TestManager. The two generic plugins install fine, but when I install the actual TestManager plugin and upgrade Trac afterwards, I get the following error:
OperationalError: (1071, 'Specified key was too long; max key length is 767 bytes')
trac.log says it is the "CREATE TABLE testcase" that fails I can reproduce the error in MySQL, and I can create the table if I ommit the PRIMARY KEY part.
I created the Trac database with this:
CREATE DATABASE trac_myproject DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;

As far as I can see in the Trac documentation for MySQL, this should be all right, so what can I do to make the plugin work?

Attachments (2)

trac.log (46.5 KB) - added by anonymous 13 months ago.
sqlite.log (45.7 KB) - added by anonymous 13 months ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 13 months ago by stefan@…

Ok, I understand the error. As I'm using utf8mb4 the limit for the key is 191 characters OR setting the charset and collation for the id field to 'pure' utf8. I would prefer the later as the key probably will only contain characters that are compatible with utf8.
I have found a bunch of db[number].py files in various /upgrades directories but none that creates the testcase table. Any pointers to where this table is created?
P.s. I'm new to Ubuntu, Trac and Python so please bear with me.

comment:2 Changed 13 months ago by seccanj

Hi Stefan,
unfortunately the code that actually creates the tables is not mine... it is Trac itself's.

I just use the Trac python classes that implement the support for db backends, namely Table, Column, etc...

My corresponding code is contained in the TracGenericClass plugin (shipped with the TestManager):
testman4trac.../tracgenericclass/trunk/tracgenericclass/model.py
inside the create_db_for_realm method, if first installation, or upgrade_db_for_realm if upgrading from a previous test manager version.

And the corresponding Trac code is contained in:
Trac.../trac/db/api.py
Trac.../trac/db/mysql_backend.py
Trac.../trac/db/schema.py

Please, could you specify which test manager version you are installing and whether you made any customization to the trac.ini file related to test manager (such as custom fields, ...)?

Ciao,
Roberto

comment:3 Changed 13 months ago by anonymous

Ubuntu 12.04 64 bit, TestManager is the latest and greatest 1.6.2-Py_2.7 with no customizations yet. Just to get on with the TestManager, I changed the entire database to UTF8 and that solved the installation problem, but now I can't create testplans.
I have created a catalog with a few test cases, select the catalog and enter a name for the test plan. But when I click the "Create Test Plan" button nothing happens.
I have enabled debugging in Trac and attached the file, but there's nothing in the log from after I click the button.
I appreciate your time helping me, this seems to be a very valuable plugin.

Best regards
Stefan

Changed 13 months ago by anonymous

comment:4 Changed 13 months ago by seccanj

Hi Stefan,
I was looking for more info and found out that there are many issues for MySQL support in Trac related to unicode stuff:
http://trac.edgewall.org/wiki/DatabaseBackend#MySQL

As far as I know, you are my first user using MySQL.

Is there any chance you may reconsider you DB backend?

Ciao,
Roberto

comment:5 Changed 13 months ago by seccanj

In particular, there are some UTF-8 related tickets, and the first is about primary keys:

http://trac.edgewall.org/query?keywords=~mysql&status=!closed&order=priority

comment:6 Changed 13 months ago by anonymous

Hmm... I installed SQLite and initiated a new trac env, but I see the exact same behaviour: I can create catalogs and test cases, but nothing happens when I click the "Create Test Plan" button, not even an error indicating an sql error. This is on the same setup I used for MySQL, so I suspect foul play in the Trac installation (probably on my side).
I will try with a fresh installation and see what happens. Perhaps MySQL is not to blame (I'm not bound to MySQL in any other way that that is what I have always used for other purposes).

Changed 13 months ago by anonymous

comment:7 Changed 13 months ago by anonymous

Nope, no-go :-(
I use this guide to install Trac:
http://www.webplay.pro/linux/ubuntu/install-trac-1-1-2-dev-on-ubuntu-12-04.html
And I have tried both with MySQL as per the guide and SQLite but to no avail.
Any ideas what may be wrong?

comment:8 Changed 13 months ago by anonymous

Yay, it works on Trac 1.0.1 and MySQL - Seems like an issue with Trac 1.1?
I will take a look at the files you mentioned to see if I can get it to work with utf8mb4.
Thank you for your time, it is much appreciated.

comment:9 Changed 12 months ago by seccanj

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

Fixed with 1.7.1

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from seccanj. Next status will be '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.