Dangerous storage engine change on installation
-
CRP version 2.4.1 has a dangerous “feature” and a bug on top of it. In tools.php there is a function crp_create_index(), which does an unannounced change to the storage engine of wp_posts. This is at least surprising, because it never says so before, and in our case brought down an entire cluster of mysql servers which did not handle the newly set MyISAM engine well.
If it is absolutely neccessary to change the storage engine, please ask the user for permission first. Or just tell the user that his storage engine does not support the plug-in.
And then there is the bug. We are running MySQL 5.6.X, table was in InnoDB format. Yet the following code got the version check almost completely wrong, and therefore mistakenly “updated” the storage engine.
// If we’re running mySQL v5.6, convert the WPDB posts table to InnoDB, since InnoDB supports FULLTEXT from v5.6 onwards.
if ( version_compare( 5.6, $wpdb->db_version(), ‘<=’ ) ) {
$table_engine = ‘InnoDB’;
} else {
$table_engine = ‘MyISAM’;
}$current_engine = $wpdb->get_row( ”
SELECT engine FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema=DATABASE()
AND table_name = ‘{$wpdb->posts}’
” );if ( $current_engine->engine !== $table_engine ) {
$wpdb->query( “ALTER TABLE {$wpdb->posts} ENGINE = {$table_engine};” ); // WPCS: unprepared SQL OK.
}I would recommend just removing these lines, and adding a short information about requiring InnoDB to the documentation. Maybe leave a check for InnoDB in the code, if you want to be extra nice. MyISAM is pretty much dead.
The topic ‘Dangerous storage engine change on installation’ is closed to new replies.