Don't trigger mariadb upgrade dump/restore when not needed
authorJiri Stransky <jistr@redhat.com>
Mon, 22 Aug 2016 16:23:35 +0000 (18:23 +0200)
committerJiri Stransky <jistr@redhat.com>
Mon, 22 Aug 2016 16:29:28 +0000 (18:29 +0200)
When upgrading from mariadb X.Y.Z to mariadb X.Y.Ž (X.Y part stays the
same), the dump/restore of mariadb shouldn't be necessary. Therefore we
now only check for up to the first 2 fields of the version string when
determining if we should trigger the dump/restore operation.

Closes-Bug: #1615721
Change-Id: Ib7af8bfb121f5c83184d51b3c6dc657108c25973

extraconfig/tasks/major_upgrade_pacemaker_migrations.sh

index 164269d..c36786a 100644 (file)
@@ -38,11 +38,11 @@ function is_mysql_upgrade_needed {
     fi
 
     local currentepoch=$(rpm -q --qf "%{epoch}" $name)
-    local currentversion=$(rpm -q --qf "%{version}" $name)
+    local currentversion=$(rpm -q --qf "%{version}" $name | cut -d. -f-2)
     local currentrelease=$(rpm -q --qf "%{release}" $name)
     local newoutput=$(repoquery -a --pkgnarrow=updates --qf "%{epoch} %{version} %{release}\n" $name)
     local newepoch=$(echo "$newoutput" | awk '{ print $1 }')
-    local newversion=$(echo "$newoutput" | awk '{ print $2 }')
+    local newversion=$(echo "$newoutput" | awk '{ print $2 }' | cut -d. -f-2)
     local newrelease=$(echo "$newoutput" | awk '{ print $3 }')
 
     # With this we trigger the dump restore/path if we change either epoch or