I've been having a hell of a time deploying one of my sites running panelizer-7.x-3.0-rc1. The module is working great on @dev (in fact, it's awesome), I just can't deploy the site to my production server — specifically I can't deploy the DB.

I get the following error when I try to run drush sql-sync @dev @prod

ERROR 1071 (42000) at line 7185: Specified key was too long; max key length is 1000 bytes

When I try to manually import the DB from @dev, I get the following slightly more informative error:

SQL query:

CREATE TABLE `panelizer_entity` ( `entity_type` varchar(255) NOT NULL COMMENT 'The type of the entity this panel is attached to.', `entity_id` int(11) NOT NULL DEFAULT '0' COMMENT 'The entity ID this panel is attached to.', `revision_id` int(10) unsigned NOT NULL COMMENT 'The revision id of the entity.', `name` varchar(255) DEFAULT NULL COMMENT 'The name of the default being used if there is one.', `no_blocks` tinyint(4) DEFAULT '0' COMMENT 'Whether or not the node disable sidebar blocks.', `css_id` varchar(255) DEFAULT '' COMMENT 'The CSS ID this panel should use.', `css` longtext COMMENT 'Any CSS the author provided for the panel.', `pipeline` varchar(255) DEFAULT 'standard' COMMENT 'The render pipeline this panel uses.', `contexts` longtext COMMENT 'The contexts configured by the node author.', `relationships` longtext COMMENT 'The relationship contexts configured by the node author.', `did` int(11) NOT NULL COMMENT 'The display ID of the panel.', `view_mode[...]

MySQL said:

#1071 - Specified key was too long; max key length is 1000 bytes

If I drush pm-disable panelizer, then drush pm-uninstall panelizer, then remove the entire panelizer directory and clear the caches, then drush sql-sync works. It also works if I re-install panelizer-7.x-2.x. But when I go back and try panelizer-7.x-3.0-rc1 it breaks again.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

patrickd’s picture

Have the same issue on http://simplytest.me/

This bug also makes it impossible to install Dupal Commons on MyISAM as panelizer is a dependency
#1818788: Installer errors without InnoDB enabled

merlinofchaos’s picture

This is weird. Does anyone have any insight into which key is failing? In just looking at this, I don't see any keys that are as big as innodb is saying.

merlinofchaos’s picture

My best guess is that something isn't quite right during an upgrade process. Can you give me the entire create table query that it's trying to run when you import your table? Maybe that will help identify what is broken here.

patrickd’s picture

FileSize
439 bytes

This is the full error:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes: CREATE TABLE {panelizer_entity} ( `entity_type` VARCHAR(255) NOT NULL COMMENT 'The type of the entity this panel is attached to.', `entity_id` INT NOT NULL DEFAULT 0 COMMENT 'The entity ID this panel is attached to.', `revision_id` INT unsigned NOT NULL COMMENT 'The revision id of the entity.', `name` VARCHAR(255) DEFAULT NULL COMMENT 'The name of the default being used if there is one.', `no_blocks` TINYINT DEFAULT 0 COMMENT 'Whether or not the node disable sidebar blocks.', `css_id` VARCHAR(255) DEFAULT '' COMMENT 'The CSS ID this panel should use.', `css` LONGTEXT DEFAULT NULL COMMENT 'Any CSS the author provided for the panel.', `pipeline` VARCHAR(255) DEFAULT 'standard' COMMENT 'The render pipeline this panel uses.', `contexts` LONGTEXT DEFAULT NULL COMMENT 'The contexts configured by the node author.', `relationships` LONGTEXT DEFAULT NULL COMMENT 'The relationship contexts configured by the node author.', `did` INT NOT NULL COMMENT 'The display ID of the panel.', `view_mode` VARCHAR(128) DEFAULT NULL COMMENT 'Contains the view mode this panelizer is for.', `css_class` VARCHAR(255) DEFAULT '' COMMENT 'The CSS class this panel should use.', `title_element` VARCHAR(255) DEFAULT 'H2' COMMENT 'The HTML element the title should use.', `link_to_entity` TINYINT DEFAULT 1 COMMENT 'Whether or not the title should link to the entity.', PRIMARY KEY (`entity_type`, `entity_id`, `revision_id`, `view_mode`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'Node panelizer references.'; Array ( ) in db_create_table() (line 2688 of /home/sb0d09bae91c9f4b/www/includes/database/database.inc).

If I comment all the keys of panelizer_entity out
//'primary key' => array('entity_type', 'entity_id', 'revision_id', 'view_mode'),
Then it works!

If I comment the 'entity_type' key out
It works!

Commenting out any of the other keys still produces the error.

So it's 'entity_type' which makes trouble...
If I change the 'size' of 'entity_type' from 255 to 50 - it works!
100 - still works
128 - works
150 - still works
200 - still works
250 - fails with key too long error

Solution is simple:
Change 'entity_type' size to varchar(128) (the same size as for tables in core)

Patch attached - earl, you will get free beer in prague if this gets committed quickly ;-)

patrickd’s picture

Version: 7.x-3.0-rc1 » 7.x-3.x-dev
Status: Active » Needs review
DamienMcKenna’s picture

Status: Needs review » Needs work

This needs a hook_update_N() implementation to modify the existing column.

Ciraxis’s picture

Status: Needs work » Needs review
FileSize
970 bytes

patch attached -- add hook_update_7110() to update the entity_type field length.

patrickd’s picture

Status: Needs review » Needs work

Patch unfortunately fails
Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT NULL, ADD PRIMARY KEY (`entity_type`, `entity_id`, `revision_id`, `view_' at line 1: ALTER TABLE {panelizer_entity} CHANGE `entity_type` `entity_type` DEFAULT NULL, ADD PRIMARY KEY (`entity_type`, `entity_id`, `revision_id`, `view_mode`); Array ( ) in db_change_field() (line 2988 of /home/patrickd/www/drupal7/includes/database/database.inc).

Ciraxis’s picture

Status: Needs work » Needs review
FileSize
1.09 KB

whoops

patrickd’s picture

Status: Needs review » Reviewed & tested by the community

Awesome, thanks that one works! :)

merlinofchaos’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed.

patrickd’s picture

Thanks!
This is a pretty critical bug for people using MyISAM, could we make a new release with this?

merlinofchaos’s picture

Yes, I plan on making a new release pretty soon.

patrickd’s picture

uhm how soon? panelizer, panopoly and many others are submitted quite often on simplytest.me, it's a pitty they still don't work as there's no release yet :/

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

P2790’s picture

Status: Closed (fixed) » Active

Just reopening as I had the same issue but luckily for me I could just uninstall the module then reinstall.

merlinofchaos’s picture

Status: Active » Closed (fixed)

There is no point in re-opening an issue that had a patch committed and pushed already, on 11/29.