Description:
Connector MXJ Corrupts the Existing Database when a new packaging with an updated database is created and the old database is still uncompressed in the system.
How to repeat:
An application with an embedded MySQL database (using Connector MXJ) is distributed to the public. The first time the user runs the application, the MXJ Connector unzips the MySQL database, including the datafiles that contain a database with, let's say 7 tables.
At a later date, an update to the application is implemented and the Connector MXJ is repacked with a new database that is the old one (7 tables) plus 1 new table. The updated application, first time when it runs, is verifying the existing database version (uncompressed by the first release) and issues a CREATE TABLE statement to create the new table. The problem is, that the Connector MXJ corrupts the existing database by uncompressing the new data files that were included in the new packaging when first the new release is started. This is a problem when using InnoDB, because only the new .frm files are created, while the index and data file for InnoDB remains the old one.
Suggested fix:
Do not uncompress ANY files from the MXJ packaging IF the database folder is already present. Currently, only new files in the MXJ packaging are created in the old uncompressed database folder, which leads to existing database corruption.