• Resolved toenges

    (@toenges)


    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter toenges

    (@toenges)

    Let me correct the last paragraph:

    I would recommend just removing these lines, and adding a short information about requiring a storage engine with fulltext support to the documentation. Maybe include a check for successful creation of the fulltext index in the code, if you want to be extra nice. MyISAM is pretty much dead, and there are several other storage engines with fulltext support.

    Plugin Author Ajay

    (@ajay)

    @toenges,

    I will implement what you said above in the next version of the plugin. I agree that myISAM is pretty much dead so no need to make any changes to the table. The warnings should definitely work well.

    Plugin Author Ajay

    (@ajay)

    Also, for now, can you edit out the mysql from that version of the plugin on your sites?

    Plugin Author Ajay

    (@ajay)

    This code is now removed in the beta in Github and will be in v2.5.0 of the plugin.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Dangerous storage engine change on installation’ is closed to new replies.