Bug #36528 MEM upgrade installer overwrite the MEM's my.cnf file
Submitted: 6 May 2008 12:43 Modified: 22 May 2009 8:40
Reporter: Alexander Rubin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Enterprise Monitor: Installing Severity:S3 (Non-critical)
Version:1.2, 1.3, 2.0.4.7141 OS:Any
Assigned to: BitRock Merlin CPU Architecture:Any
Tags: mem, upgrade

[6 May 2008 12:43] Alexander Rubin
Description:
MEM upgrade installer overwrite the MEM's my.cnf file

If something was changed in MEM's my.cnf and then upgraded to the new version, upgrade installer will overwrite the my.cnf file, so all old changed will be lost. If, for example, InnoDB log files settings was changed, after upgrade (when my.cnf file will be overwritten) MEM will not start, as mysql will not start InnoDB.

How to repeat:
1. Change some my.cnf setting in MEM my.cnf
2. Upgrade MEM
3. Check the new my.cnf file and see that all changes were lost

Suggested fix:
1. Merge changes in the my.cnf
or if this is not possible
2. Perform diff on the old and new file and notify the user after upgrade, that some changes were lost
[18 Jul 2008 10:24] Simon Mudd
Still broken in mysqlmonitor-1.3.2.9126
[11 Dec 2008 15:12] MC Brown
A note has been added to the 1.3 and 2.0 documentation.
[19 Dec 2008 9:38] BitRock Merlin
It is not currently possible to detect whether the file has changed. The uninstaller stores size information of the original file, but it gets changed during installation (to include installation-specific information such as the location of the socket file). For the future, we could store an md5 of the substituted file, in order to do comparisons.

If you have some other heuristic to check if the file changed, we can use that. The logic to modify variables, etc. is a bit complex and since this is something that is likely going to continue to change from release to release, the installer if probably not the best container for this logic. I noticed you have a Lua interpreter embedded in your application. Would it be possible to expose that interpreter or somehow run a upgrade.lua that you provide and that does exactly the steps you want it to do?
[19 Dec 2008 12:34] Simon Mudd
I've no idea how the bitrock installer works. You could generate the "default my.cnf" file with a temporary filename.

If no "old file" exists, the newly created file can be installed in place.
If the "old file" and the "new file" are different then something has changed. The solution seems to be to decide which of the 2 versions you want to use. I'd go for the "old file" which may cause problems, but leave the new file and also record an error or warning.

This is pretty much what rpm does with the file.rpmnew or file.rpmsave files in a similar situation.

You are right that any upgrade may cause problems and a script to look at the contents and decide what to do would be useful. On unix only platforms that would probably be a shell script but I guess with Windows you can't do that, so maybe lua would be the only option.

In any case saving the old or new file and issuing a warning about the content change should be enough to at least provide a clue that some action needs taking.
[5 Mar 2009 18:02] BitRock Merlin
Patch sent to Keith.
[9 Mar 2009 15:46] Keith Russell
Patch installed in versions => 2.1.0.1014.
[10 Mar 2009 16:09] Marcos Palacios
Verified fixed in build 2.1.0.1014.
[10 Mar 2009 16:44] Marcos Palacios
The "MySQL Repository Configuration Report" (which we see when done on Windows XP) is not seen on the Mac OSX update via the GUI, this update was tested both from 2.0.5 and 1.3.2 updating to 2.1.0.1014.

Attached is the "my.ini_comparison_report.txt" file which is shown on XP but not on OSX.
[10 Mar 2009 16:49] Marcos Palacios
"my.ini_comparison_report.txt" file which is shown on XP

Attachment: my.ini_comparison_report.txt (text/plain), 2.79 KiB.

[10 Mar 2009 17:49] BitRock Merlin
Patch for OS X platforms sent to Keith.
[10 Mar 2009 18:50] Andy Bang
This doesn't appear to be fully implemented on Linux.  We're supposed to see two things: (1) a "MySQL Repository Configuration Report", and (2) a checkbox on the last screen asking if the services should be started even though differences were found between the actual and recommended cnf files.  I see both of those on Windows, but I don't see the final checkbox on Linux.

See the attached console log for what shows up during a Linux text-mode installation.  At the end you only see the "View Readme File" checkbox (or at least the text-mode equivalent of that).
[10 Mar 2009 18:50] Andy Bang
Linux Installation Console Output

Attachment: linux_install.log (application/octet-stream, text), 3.51 KiB.

[10 Mar 2009 19:28] BitRock Merlin
We have followed the same approach that if the "cnf-comparer.jar" tool does not find any difference. Currently, the check box option to start the servers and to launch the browser only appears on graphical mode, not in text mode. Please let us know if this option should be also showed in text mode.
[10 Mar 2009 20:29] Andy Bang
I don't fully understand your comment.  As you can see from the log, the cnf-comparer DID find some differences and reports them in the repository report page.  Because of that I would expect it to ask the question about restarting the services or not.  Why would text mode be different than GUI mode in this case?

If it did NOT find any differences then I would not expect it to ask the question and just go ahead and start the services.

But the point is that it DID find differences.  And again, why would text mode be different than GUI mode in this case?
[11 Mar 2009 16:03] BitRock Merlin
Patch sent to Keith.
[13 Mar 2009 5:11] Keith Russell
Patch installed in versions => 2.1.0.1015.
[13 Mar 2009 19:49] Marcos Palacios
Tested with build 2.1.0.1015 on Mac OSX.
The installer dialog shows the comparison report of the two cnf files and advises the user to be sure whether they want to start the svc mgr. It also stores the comparison report as a txt file.

Testing on linux next.
[13 Mar 2009 21:04] Marcos Palacios
Tested with build 2.1.0.1015 on Linux using text mode.

The installer dialog shows the comparison report of the two cnf files and it also provides a [yes|no] question asking if the services should be started even though differences were found between the actual and recommended cnf files. It also stores the comparison report as a txt file.
[14 Mar 2009 0:14] Marcos Palacios
Verified fixed in build 2.1.0.1015.
[22 May 2009 8:40] Tony Bedford
An entry was added to the 2.1.0 changelog:

The MySQL Enterprise Monitor upgrade installer replaced the my.cnf file. This resulted in the loss of any changes that had been made to the configuration file.