Skip to main content
Expanding post a bit.
Source Link
kenorb
  • 14.3k
  • 10
  • 98
  • 168

In general Drush can't corrupt your database, as it's a software which just sends the SQL queries.

However this error can be related to newer version of MySQL, as of 5.5.7, InnoDB always uses the fast truncation technique (which is equivalent to DROP TABLE and CREATE TABLE). So it no longer performs a row-by-row delete for tables with parent-child foreign key relationships, therefore TRUNCATE TABLE returns an error for such tables.

See: 2.11.1.1 Changes Affecting Upgrades to 5.5

This already has been reported in #2229013 for Drupal core.

So you should either:

  • consider using different data structures:

  • non-InnoDB,

  • use redis/memcached for your cache management (so this won't happen),

  • try clearing your caches in different way, e.g.

      echo "SHOW TABLES LIKE 'cache%'" | drush sqlc --extra=--skip-column-names | xargs -L1 -I% echo "DELETE FROM %;" | drush sqlc --extra=-v 
    
  • upgrade your Drupal to 8 and see if the same happens (drush cr),

  • use different database (maybe will work in MariaDB?),

  • downgrade your MySQL to <5.5.7,

  • patch the Drupal core by replacing TRUNCATE with DELETE statement,

    You may also consider the condition like if ($mysqlversion > 5.57 AND $cache_table_type = 'innodb') { // DELETE } else { // TRUNCATE }.

  • or wait until the fix is provided for Drupal core (#2229013).

In general Drush can't corrupt your database, as it's a software which just sends the SQL queries.

However this error can be related to newer version of MySQL, as of 5.5.7, InnoDB always uses the fast truncation technique (which is equivalent to DROP TABLE and CREATE TABLE). So it no longer performs a row-by-row delete for tables with parent-child foreign key relationships, therefore TRUNCATE TABLE returns an error for such tables.

See: 2.11.1.1 Changes Affecting Upgrades to 5.5

This already has been reported in #2229013 for Drupal core.

So you should either:

  • consider using different data structures:

  • non-InnoDB,

  • use redis/memcached for your cache management (so this won't happen),

  • try clearing your caches in different way, e.g.

      echo "SHOW TABLES LIKE 'cache%'" | drush sqlc --extra=--skip-column-names | xargs -L1 -I% echo "DELETE FROM %;" | drush sqlc --extra=-v 
    
  • upgrade your Drupal to 8 and see if the same happens (drush cr),

  • use different database (maybe will work in MariaDB?),

  • downgrade your MySQL to <5.5.7,

  • patch Drupal core,

  • or wait until the fix is provided for Drupal core (#2229013).

In general Drush can't corrupt your database, as it's a software which just sends the SQL queries.

However this error can be related to newer version of MySQL, as of 5.5.7, InnoDB always uses the fast truncation technique (which is equivalent to DROP TABLE and CREATE TABLE). So it no longer performs a row-by-row delete for tables with parent-child foreign key relationships, therefore TRUNCATE TABLE returns an error for such tables.

See: 2.11.1.1 Changes Affecting Upgrades to 5.5

This already has been reported in #2229013 for Drupal core.

So you should either:

  • consider using different data structures:

  • non-InnoDB,

  • use redis/memcached for your cache management (so this won't happen),

  • try clearing your caches in different way, e.g.

      echo "SHOW TABLES LIKE 'cache%'" | drush sqlc --extra=--skip-column-names | xargs -L1 -I% echo "DELETE FROM %;" | drush sqlc --extra=-v 
    
  • upgrade your Drupal to 8 and see if the same happens (drush cr),

  • use different database (maybe will work in MariaDB?),

  • downgrade your MySQL to <5.5.7,

  • patch the Drupal core by replacing TRUNCATE with DELETE statement,

    You may also consider the condition like if ($mysqlversion > 5.57 AND $cache_table_type = 'innodb') { // DELETE } else { // TRUNCATE }.

  • or wait until the fix is provided for Drupal core (#2229013).

added 453 characters in body
Source Link
kenorb
  • 14.3k
  • 10
  • 98
  • 168

In general Drush can't corrupt your database, as it's a software which just sends the SQL queries.

However this error can be related to newer version of MySQL, as of 5.5.7, InnoDB always uses the fast truncation technique (which is equivalent to DROP TABLE and CREATE TABLE). So it no longer performs a row-by-row delete for tables with parent-child foreign key relationships, therefore TRUNCATE TABLE returns an error for such tables.

See: 2.11.1.1 Changes Affecting Upgrades to 5.5

This already has been reported in #2229013 for Drupal core.

So you should either:

  • consider using different data structures (non-InnoDB),

    consider using different data structures:

  • use different database (maybe will work in MariaDB?),

    non-InnoDB,

  • downgrade your MySQL to <5.5.7,

    use redis/memcached for your cache management (so this won't happen),

  • patch Drupal core,

    try clearing your caches in different way, e.g.

      echo "SHOW TABLES LIKE 'cache%'" | drush sqlc --extra=--skip-column-names | xargs -L1 -I% echo "DELETE FROM %;" | drush sqlc --extra=-v 
    
  • or wait until the fix is provided for Drupal core (#2229013).

    upgrade your Drupal to 8 and see if the same happens (drush cr),

  • use different database (maybe will work in MariaDB?),

  • downgrade your MySQL to <5.5.7,

  • patch Drupal core,

  • or wait until the fix is provided for Drupal core (#2229013).

In general Drush can't corrupt your database, as it's a software which just sends the SQL queries.

However this error can be related to newer version of MySQL, as of 5.5.7, InnoDB always uses the fast truncation technique (which is equivalent to DROP TABLE and CREATE TABLE). So it no longer performs a row-by-row delete for tables with parent-child foreign key relationships, therefore TRUNCATE TABLE returns an error for such tables.

See: 2.11.1.1 Changes Affecting Upgrades to 5.5

This already has been reported in #2229013 for Drupal core.

So you should either:

  • consider using different data structures (non-InnoDB),
  • use different database (maybe will work in MariaDB?),
  • downgrade your MySQL to <5.5.7,
  • patch Drupal core,
  • or wait until the fix is provided for Drupal core (#2229013).

In general Drush can't corrupt your database, as it's a software which just sends the SQL queries.

However this error can be related to newer version of MySQL, as of 5.5.7, InnoDB always uses the fast truncation technique (which is equivalent to DROP TABLE and CREATE TABLE). So it no longer performs a row-by-row delete for tables with parent-child foreign key relationships, therefore TRUNCATE TABLE returns an error for such tables.

See: 2.11.1.1 Changes Affecting Upgrades to 5.5

This already has been reported in #2229013 for Drupal core.

So you should either:

  • consider using different data structures:

  • non-InnoDB,

  • use redis/memcached for your cache management (so this won't happen),

  • try clearing your caches in different way, e.g.

      echo "SHOW TABLES LIKE 'cache%'" | drush sqlc --extra=--skip-column-names | xargs -L1 -I% echo "DELETE FROM %;" | drush sqlc --extra=-v 
    
  • upgrade your Drupal to 8 and see if the same happens (drush cr),

  • use different database (maybe will work in MariaDB?),

  • downgrade your MySQL to <5.5.7,

  • patch Drupal core,

  • or wait until the fix is provided for Drupal core (#2229013).

Source Link
kenorb
  • 14.3k
  • 10
  • 98
  • 168

In general Drush can't corrupt your database, as it's a software which just sends the SQL queries.

However this error can be related to newer version of MySQL, as of 5.5.7, InnoDB always uses the fast truncation technique (which is equivalent to DROP TABLE and CREATE TABLE). So it no longer performs a row-by-row delete for tables with parent-child foreign key relationships, therefore TRUNCATE TABLE returns an error for such tables.

See: 2.11.1.1 Changes Affecting Upgrades to 5.5

This already has been reported in #2229013 for Drupal core.

So you should either:

  • consider using different data structures (non-InnoDB),
  • use different database (maybe will work in MariaDB?),
  • downgrade your MySQL to <5.5.7,
  • patch Drupal core,
  • or wait until the fix is provided for Drupal core (#2229013).