The column size of the varchar fields (cas_login_data.cas_session_id, cas_server_tickets.ticket) exceeds the maximum key length when using InnoDB tables and the utf8 character set.
Trying to convert the cas_login_data table to InnoDB manually results in a key-length error as shown below:
mysql> alter table cas_login_data engine=InnoDB;
ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes
mysql> desc cas_login_data;
+----------------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+------------------+------+-----+---------+-------+
| cas_session_id | varchar(256) | NO | PRI | | |
| uid | int(10) unsigned | NO | | NULL | |
+----------------+------------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
mysql>
Innodb will only allow a key of 767 bytes. Since we are using a utf8 character set and MySQL uses 3 bytes per character, you get a limit of 255.67 characters, which in practice means a maximum of 255 characters.
Shortening the column size of the varchar fields by 1 character to 255 characters will allow the CAS module to operate with both MyISAM and InnoDB tables.
I have attached a patch that changes the default column size to 255 characters and provides a schema update function to shrink the columns by 1 character. For consistency, I have also shortened the cas_server_tickets.service column to 255 characters even though it is not currently used in a key.
Comment | File | Size | Author |
---|---|---|---|
cas-InnoDB_key_length.patch | 3.52 KB | adamfranco | |
Comments
Comment #1
metzlerd CreditAttribution: metzlerd commentedThanks. I'll definitely get this in.
Comment #2
metzlerd CreditAttribution: metzlerd commentedImplemented in HEAD.