Skip to content

Commit d4b5d8a

Browse files
MDBF-1103 rpm upgrade from distro default
Introduced `alternative_names_package_list` as a method to define how are the client and server packages called in different distro repos. The same steps are followed as in a major upgrade i.e.: - install previous (distro) packages - create data structures - remove the packages - install current packages - verify the data structures - verify engines old/new - see workaround
1 parent 468ba1d commit d4b5d8a

File tree

3 files changed

+30
-63
lines changed

3 files changed

+30
-63
lines changed

constants.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,7 @@
297297
builder_name_autobake + "-minor-upgrade-columnstore"
298298
)
299299
BUILDERS_UPGRADE.append(builder_name_autobake + "-major-upgrade")
300-
if "deb" in OS_INFO[os_i]["type"]:
301-
BUILDERS_UPGRADE.append(builder_name_autobake + "-distro-upgrade")
300+
BUILDERS_UPGRADE.append(builder_name_autobake + "-distro-upgrade")
302301

303302
BUILDERS_GALERA = list(
304303
map(lambda x: "gal-" + "-".join(x.split("-")[:3]), BUILDERS_AUTOBAKE)

scripts/bash_lib.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,11 @@ rpm_setup_mariadb_mirror() {
292292
bb_log_err "missing the branch variable"
293293
exit 1
294294
}
295+
[[ $1 == "N/A" ]] && {
296+
bb_log_info "performing a distribution upgrade, skipping repository setup"
297+
set +u
298+
return 0
299+
}
295300
branch=$1
296301
bb_log_info "setup MariaDB repository for $branch branch"
297302
command -v wget >/dev/null || {
@@ -616,6 +621,14 @@ check_upgraded_versions() {
616621

617622
res=0
618623
errors=""
624+
# MDBF-1103 - "federated", "archive", and "blackhole" engines are STATIC
625+
# in distro packages because they were configured with -DFEATURE_SET="community"
626+
# while our builds load them as DYNAMIC.
627+
if [[ $test_type == "distro" ]]; then
628+
for eng in FEDERATED ARCHIVE BLACKHOLE; do
629+
sed -i "/${eng}/d" ./engines.old
630+
done
631+
fi
619632
engines_disappeared_or_changed=$(comm -23 ./engines.old ./engines.new | wc -l)
620633
set +x
621634
if ((engines_disappeared_or_changed != 0)); then

scripts/rpm-upgrade.sh

Lines changed: 16 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,19 @@ case $test_mode in
4242
package_list=$(rpm_repoquery) ||
4343
bb_log_err "unable to retrieve package list from repository"
4444
package_list=$(echo "$package_list" | grep -viE 'galera|columnstore')
45+
alternative_names_package_list=$package_list
4546
bb_log_warn "Due to MCOL-4120 and other issues, Columnstore upgrade will be tested separately"
4647
;;
4748
server)
4849
package_list="MariaDB-server MariaDB-client"
50+
alternative_names_package_list=$package_list
51+
if [[ "$test_type" == "distro" ]]; then
52+
if [[ "$ID_LIKE" =~ ^suse.* ]]; then
53+
alternative_names_package_list="mariadb mariadb-client"
54+
else
55+
alternative_names_package_list="mariadb-server mariadb"
56+
fi
57+
fi
4958
;;
5059
columnstore)
5160
package_list=$(rpm_repoquery)
@@ -54,6 +63,7 @@ case $test_mode in
5463
exit
5564
fi
5665
package_list="MariaDB-server MariaDB-columnstore-engine"
66+
alternative_names_package_list=$package_list
5767
;;
5868
*)
5969
bb_log_err "unknown test mode ($test_mode)"
@@ -63,61 +73,6 @@ esac
6373

6474
bb_log_info "Package_list: $package_list"
6575

66-
# # //TEMP this needs to be implemented once we have SLES VM in new BB
67-
# # Prepare yum/zypper configuration for installation of the last release
68-
# if which zypper; then
69-
# repo_location=/etc/zypp/repos.d
70-
# install_command="zypper --no-gpg-checks install --from mariadb -y"
71-
# cleanup_command="zypper clean --all"
72-
# remove_command="zypper remove -y"
73-
# # Since there is no reasonable "upgrade" command in zypper which would
74-
# # pick up RPM files needed to upgrade existing packages, we have to use "install".
75-
# # However, if we run "install *.rpm", it will install all packages, regardless
76-
# # the test mode, and we will get a lot of differences in contents after upgrade
77-
# # (more plugins, etc.). So, instead for each package that we are going to install,
78-
# # we'll also find an RPM file which provides it, and will use its name in
79-
# # in the "upgrade" (second install) command
80-
# if [[ $test_mode == "all" ]]; then
81-
# rm -f rpms/*columnstore*.rpm
82-
# rpms_for_upgrade="rpms/*.rpm"
83-
# else
84-
# rpms_for_upgrade=""
85-
# for p in $package_list; do
86-
# for f in rpms/*.rpm; do
87-
# if rpm -qp "$f" --provides | grep -i "^$p ="; then
88-
# rpms_for_upgrade="$rpms_for_upgrade $f"
89-
# break
90-
# fi
91-
# done
92-
# done
93-
# fi
94-
# upgrade_command="zypper --no-gpg-checks install -y $rpms_for_upgrade"
95-
96-
# As of now (February 2018), RPM packages do not support major upgrade.
97-
# To imitate it, we will remove previous packages and install new ones.
98-
# //TEMP is this still true??
99-
#else
100-
#
101-
# repo_location=/etc/yum.repos.d
102-
# install_command="sudo $pkg_cmd -y --nogpgcheck install"
103-
# cleanup_command="sudo $pkg_cmd clean all"
104-
# upgrade_command="sudo $pkg_cmd -y --nogpgcheck upgrade"
105-
# if [[ $test_type == "major" ]]; then
106-
# upgrade_command="sudo $pkg_cmd -y --nogpgcheck install"
107-
# fi
108-
# # //TEMP not sure about the reason of this
109-
# # if $pkg_cmd autoremove 2>&1 | grep -q 'need to be root'; then
110-
# # remove_command="sudo $pkg_cmd -y autoremove"
111-
# # else
112-
# # remove_command="sudo $pkg_cmd -y remove"
113-
# # fi
114-
# remove_command="sudo $pkg_cmd -y autoremove"
115-
116-
# Workaround for TODO-1479 (errors upon reading from SUSE repos):
117-
# sudo rm -rf
118-
# /etc/zypp/repos.d/SUSE_Linux_Enterprise_Server_12_SP3_x86_64:SLES12-SP3-Updates.repo
119-
# /etc/zypp/repos.d/SUSE_Linux_Enterprise_Server_12_SP3_x86_64:SLES12-SP3-Pool.repo
120-
12176
# ID_LIKE may not exist
12277
set +u
12378
if [[ $ID_LIKE =~ ^suse* ]]; then
@@ -132,7 +87,7 @@ fi
13287
set -u
13388

13489
# Install previous release
135-
echo "$package_list" | xargs sudo "$pkg_cmd" "$pkg_cmd_options" install ||
90+
echo "$alternative_names_package_list" | xargs sudo "$pkg_cmd" "$pkg_cmd_options" install ||
13691
bb_log_err "installation of a previous release failed, see the output above"
13792
#fi
13893

@@ -184,16 +139,16 @@ if [[ $package_version == "$old_version" ]]; then
184139
fi
185140

186141
# //TEMP upgrade does not work without this but why? Can't we fix it?
187-
if [[ $test_type == "major" ]]; then
142+
if [[ "$test_type" =~ ^(major|distro)$ ]]; then
188143
bb_log_info "remove old packages for major upgrade"
189-
packages_to_remove=$(rpm -qa | grep 'MariaDB-' | awk -F'-' '{print $1"-"$2}')
144+
packages_to_remove=$(rpm -qa | grep -E '^(MariaDB|mariadb)-' | awk -F'-' '{print $1"-"$2}')
190145
echo "$packages_to_remove" | xargs sudo "$pkg_cmd" "$pkg_cmd_options" remove
191146
rpm -qa | grep -iE 'maria|mysql' || true
192147
fi
193148

194149
rpm_setup_bb_galera_artifacts_mirror
195150
rpm_setup_bb_artifacts_mirror
196-
if [[ $test_type == "major" ]]; then
151+
if [[ "$test_type" =~ ^(major|distro)$ ]]; then
197152
# major upgrade (remove then install)
198153
echo "$package_list" | xargs sudo "$pkg_cmd" "$pkg_cmd_options" install
199154
else
@@ -220,7 +175,7 @@ fi
220175

221176
# Optionally (re)start the server
222177
set -e
223-
if [[ $test_type == "major" ]] || [[ $test_mode == "columnstore" ]]; then
178+
if [[ "$test_type" =~ ^(major|distro)$ ]] || [[ $test_mode == "columnstore" ]]; then
224179
control_mariadb_server restart
225180
fi
226181

@@ -232,7 +187,7 @@ fi
232187

233188
# Run mariadb-upgrade for non-GA branches (minor upgrades in GA branches
234189
# shouldn't need it)
235-
if [[ $major_version == "$development_branch" ]] || [[ $test_type == "major" ]]; then
190+
if [[ $major_version == "$development_branch" ]] || [[ "$test_type" =~ ^(major|distro)$ ]]; then
236191
sudo mariadb-upgrade
237192
fi
238193

0 commit comments

Comments
 (0)