Set engine = 'InnoDB' for newly created tables?

Hello,

When I was upgrading OJS from 3.2.1.1 to 3.3.0.7 I encountered the same problem as many others with my tables using old storage engine MyISAM. I changed my tables to InnoDB but was not able to change the default_storage_engine to InnoDB. My university IT department said they are running many websites on their CPanel and they would have to change it globaly for everyone which is not acceptable. I was also not able to change it for my session only. As a result the upgrade was failing because there are new tables created which inherit the default storage engine.

Solution: I adjusted the upgrade script creating new tables in lib\pkp\classes\migration\upgrade\PKPv3_3_0UpgradeMigration.inc.php by specifying the engine:

$table->engine = 'InnoDB';

Question: Would it be possible somewhere in the upgrade script or database classes to globally specify the use of InnoDB engine for new tables?

Thank you for consideration.

Best regards,
Dominik

Hi Dominik,

I don’t know if this is a good idea.

Even InnoDB is the recommended engine, is still possible to run OJS over mariaDB/mysql with myISAM.

If PKP forces innoDB at upgrade level it could be an issue in some installations as far it could be disabled in some places or will drive to a “mix of engines” (that will break your DB performance).

As far as I remmeber, OJS is taking the engine from the DB.
Is it possible your engine is myISAM even you moved your tables to innoDB?

Cheers,
m.

Cheers,
m.

Hello @marc,
yes, my provider does not want to change the default engine so I had to find a workaround.
Since the upgrade does not work if the new tables are in myISAM, it would be useful to be able to configure the default engine somewhere in the script. But I understand I’m probably a minority with this problem and it might not be ideal to duplicate the db default engine functionality in the code.

Best regards,
Dominik

1 Like

Hi @Domek, thanks for the report and the helpful recommendation on a solution. I’ve filed an issue to add a new config option that could force the database engine. You can follow progress here: Add a config option to set the database engine to InnoDB · Issue #7311 · pkp/pkp-lib · GitHub

1 Like