Incompatible upgrade - Is this workaround ok? (mysql-mmm)

BJ Dierkes wdierkes at 5dollarwhitebox.org
Mon Mar 1 23:19:13 UTC 2010


On Feb 26, 2010, at 11:11 AM, Kevin Fenzi wrote:

> On Wed, 24 Feb 2010 12:36:31 -0600
> BJ Dierkes <wdierkes at 5dollarwhitebox.org> wrote:
> 
>> Hello all,
>> 
>> I maintain Multi-Master Replication Manager for MySQL in both Fedora
>> and EPEL.  With changes from 2.0.11 -> 2.1.0 there was an
>> incompatible change in that the daemon scripts were renamed:
>> 
>> mmmd_agent -> mmm_agentd
>> mmmd_mon -> mmm_mond
>> 
>> 
>> Upgrades obviously break because the INIT scripts and configuration
>> files reference the path to the files.  Would a sufficient
>> work-around be a symlink to the old path, or would that not be kosher
>> for any reason?
>> 
>> Thank you for your feedback.
> 
> Well, I would suggest if you can get it setup so it continues to work
> as expected on upgrade it should be fine. If thats a symlink or
> whatever it should be ok. 
> 
> Perhaps make and test a version, then post the spec diff for
> comment/feedback if you like?
> 
> kevin


I have a working upgrade from mysql-mmm-2.0.x -> mysql-mmm-2.1.  I verified that all expected changes happen, and that the running processes are gracefully condrestart'd. 

The changes are pretty straight forward.  Because this is the first release of mysql-mmm >= 2.1 I am touching a file at '%{_datadir}/mysql-mmm/.pre-2.1.0-upgrade-check' in the install.  From %pre, if this file does *not* exist then the current install is < 2.1 (meaning modifications need to be done for 2.1 compatibility).  I then touch '%{_localstatedir}/run/mysql-mmm/.post-2.1.0-upgrade-do_mods' (in %pre) allowing me to verify that modifications are needed in %post.  

The modifications are simple sed changes for pid/status file and sbin daemon paths.  I suppose I'm looking for another set of eyes to point out anything that is not obvious to me.  The following are the [snipped] spec changes:

# --------------------------------------------------
%install
# … snipped
# Specific for upgrading from 2.0.x -> 2.1
touch %{buildroot}%{_datadir}/mysql-mmm/.pre-2.1.0-upgrade-check-do-not-delete


%pre
# This is to facilitate the upgradability of 2.0.x -> 2.1
DO_MOD_CHECK="%{_datadir}/mysql-mmm/.pre-2.1.0-upgrade-check-do-not-delete"
DO_MOD_VERIFY="%{_localstatedir}/run/mysql-mmm/.post-2.1.0-upgrade-do_mods"

rm -f $DO_MOD_VERIFY 2>/dev/null

if [ ! -f "$DO_MOD_CHECK" ]; then
    # the 'check' file does *not* exist (only installed as of 2.1.0)
    # modifications are necessary.
    touch $DO_MOD_VERIFY

    # copy paths for new configs (if replaced on upgrade)
    cp -a %{_localstatedir}/run/mysql-mmm/mmmd_mon.pid \
      %{_localstatedir}/run/mysql-mmm/mmm_mond.pid 2>/dev/null ||:
    cp -a %{_localstatedir}/lib/mysql-mmm/mmmd_mon.status \
      %{_localstatedir}/lib/mysql-mmm/mmm_mond.status 2>/dev/null ||:
    cp -a %{_localstatedir}/run/mysql-mmm/mmmd_agent.pid \
      %{_localstatedir}/run/mysql-mmm/mmm_agentd.pid 2>/dev/null ||:
fi


%post
# This is to facilitate the upgradability of 2.0.x -> 2.1
DO_MOD_VERIFY="%{_localstatedir}/run/mysql-mmm/.post-2.1.0-upgrade-do_mods"

if [ -f "$DO_MOD_VERIFY" ]; then
    # system was upgraded from < 2.1, need to modify config files/paths
    if [ -f %{_sysconfdir}/mysql-mmm/mmm_mon.conf ]; then
        cp -a %{_sysconfdir}/mysql-mmm/mmm_mon.conf %{_sysconfdir}/mysql-mmm/mmm_mon.conf-pre2.1
        sed -i "s|/var/run/mysql-mmm/mmmd_mon.pid|/var/run/mysql-mmm/mmm_mond.pid|g" \
               %{_sysconfdir}/mysql-mmm/mmm_mon.conf
        sed -i "s|/var/lib/mysql-mmm/mmmd_mon.status|/var/lib/mysql-mmm/mmm_mond.status|g" \
               %{_sysconfdir}/mysql-mmm/mmm_mon.conf
    fi
    if [ -f %{_sysconfdir}/mysql-mmm/mmm_common.conf ]; then
        cp -a %{_sysconfdir}/mysql-mmm/mmm_common.conf %{_sysconfdir}/mysql-mmm/mmm_common.conf-pre2.1
        sed -i "s|/var/run/mysql-mmm/mmmd_agent.pid|/var/run/mysql-mmm/mmm_agentd.pid|g" \
               %{_sysconfdir}/mysql-mmm/mmm_common.conf
    fi
fi


%post agent
# … snipped
# This is to facilitate the upgradability of 2.0.x -> 2.1
DO_MOD_VERIFY="%{_localstatedir}/run/mysql-mmm/.post-2.1.0-upgrade-do_mods"
if [ -f "$DO_MOD_VERIFY" ]; then
    # remove old files
    rm -f %{_localstatedir}/run/mysql-mmm/mmmd_agent.pid 2>/dev/null ||:
fi


%post monitor
# … snipped
# This is to facilitate the upgradability of 2.0.x -> 2.1
DO_MOD_VERIFY="%{_localstatedir}/run/mysql-mmm/.post-2.1.0-upgrade-do_mods"
if [ -f "$DO_MOD_VERIFY" ]; then
    # remove old files
    rm -f %{_localstatedir}/run/mysql-mmm/mmmd_mon.pid 2>/dev/null ||:
    rm -f %{_localstatedir}/lib/mysql-mmm/mmmd_mon.status 2>/dev/null ||:
fi
# --------------------------------------------------


Thanks.

---
derks





More information about the epel-devel-list mailing list