From 87a37dd2ad5cdfc1ca1cd7d6d8a63085e8db82826295571e5fc734b201497607 Mon Sep 17 00:00:00 2001 From: Kristyna Streitova Date: Tue, 26 Jan 2021 23:22:48 +0000 Subject: [PATCH] Accepting request 866424 from home:darix:branches:server:database - revert the permission change, we will revisit it at a later point - we give the config files and directory the permissions u=rwx,go=rx root:mysql, if we give the mysql group permissions we should not need to leave the permissions open for others. change permissions to u=rwx,g=rx,o= - exclude galera files if we build without this feature. - instead of setting the permissions in the files section inherit what ever we set during installation. This simplifies the code for the file section a lot. and we have a lot more flexiblity to fix permissions in %install - added fix-lock-rollback-assert-abort.patch fix an abort when a transaction is rolled back - track all patches in a series so we can easily set up a quilt tree without requiring all the devel packages OBS-URL: https://build.opensuse.org/request/show/866424 OBS-URL: https://build.opensuse.org/package/show/server:database/mariadb?expand=0&rev=264 --- fix-lock-rollback-assert-abort.patch | 83 ++++++++++++++++++++++++++++ mariadb.changes | 34 ++++++++++++ mariadb.spec | 43 ++++++++++++-- series | 8 +++ 4 files changed, 162 insertions(+), 6 deletions(-) create mode 100644 fix-lock-rollback-assert-abort.patch create mode 100644 series diff --git a/fix-lock-rollback-assert-abort.patch b/fix-lock-rollback-assert-abort.patch new file mode 100644 index 0000000..ac81022 --- /dev/null +++ b/fix-lock-rollback-assert-abort.patch @@ -0,0 +1,83 @@ +commit 8e3e87d2fc1e63d287f203d441dcb9360775c6b7 +Author: sjaakola +Date: Tue Dec 8 18:02:42 2020 +0200 + + MDEV-23851 MDEV-24229 BF-BF conflict issues + + Issues MDEV-23851 and MDEV-24229 are probably duplicates and are caused by the new self-asserting function lock0lock.cc:wsrep_assert_no_bf_bf_wait(). + The criteria for asserting is too strict and does not take in consideration scenarios of "false positive" lock conflicts, which are resolved by replaying the local transaction. + As a fix, this PR is relaxing the assert criteria by two conditions, which skip assert if high priority transactions are locking in correct order or if conflicting high priority lock holder is aborting and has just not yet released the lock. + + Alternative fix would be to remove wsrep_assert_no_bf_bf_wait() altogether, or remove the assert in this function and let it only print warnings in error log. + But in my high conflict rate multi-master test scenario, this relaxed asserting appears to be safe. + + This PR also removes two wsrep_report_bf_lock_wait() calls in innodb lock manager, which cause mutex access assert in debug builds. + + Foreign key appending missed handling of data types of float and double in INSERT execution. This is not directly related to the actual issue here but is fixed in this PR nevertheless. Missing these foreign keys values in certification could cause problems in some multi-master load scenarios. + + Finally, some problem reports suggest that some of the issues reported in MDEV-23851 might relate to false positive lock conflicts over unique secondary index gaps. There is separate work for relaxing UK index gap locking of replication appliers, and separate PR will be submitted for it, with a related mtr test as well. + +Index: mariadb-10.5.8/storage/innobase/lock/lock0lock.cc +=================================================================== +--- mariadb-10.5.8.orig/storage/innobase/lock/lock0lock.cc ++++ mariadb-10.5.8/storage/innobase/lock/lock0lock.cc +@@ -627,6 +627,20 @@ static void wsrep_assert_no_bf_bf_wait( + if (UNIV_LIKELY(!wsrep_thd_is_BF(lock_rec2->trx->mysql_thd, FALSE))) + return; + ++ /* if BF - BF order is honored, we can keep trx1 waiting for the lock */ ++ if (wsrep_thd_order_before(trx1->mysql_thd, lock_rec2->trx->mysql_thd)) ++ return; ++ ++ /* avoiding BF-BF conflict assert, if victim is already aborting ++ or rolling back for replaying ++ */ ++ wsrep_thd_LOCK(lock_rec2->trx->mysql_thd); ++ if (wsrep_thd_is_aborting(lock_rec2->trx->mysql_thd)) { ++ wsrep_thd_UNLOCK(lock_rec2->trx->mysql_thd); ++ return; ++ } ++ wsrep_thd_UNLOCK(lock_rec2->trx->mysql_thd); ++ + mtr_t mtr; + + if (lock_rec1) { +@@ -1385,11 +1399,6 @@ lock_rec_create_low( + + trx_mutex_exit(c_lock->trx); + +- if (UNIV_UNLIKELY(wsrep_debug)) { +- wsrep_report_bf_lock_wait(trx->mysql_thd, trx->id); +- wsrep_report_bf_lock_wait(c_lock->trx->mysql_thd, c_lock->trx->id); +- } +- + /* have to bail out here to avoid lock_set_lock... */ + return(lock); + } +Index: mariadb-10.5.8/storage/innobase/rem/rem0rec.cc +=================================================================== +--- mariadb-10.5.8.orig/storage/innobase/rem/rem0rec.cc ++++ mariadb-10.5.8/storage/innobase/rem/rem0rec.cc +@@ -2735,8 +2735,22 @@ wsrep_rec_get_foreign_key( + break; + case DATA_BLOB: + case DATA_BINARY: ++ case DATA_FIXBINARY: ++ case DATA_GEOMETRY: + memcpy(buf, data, len); + break; ++ case DATA_FLOAT: ++ { ++ float f = mach_float_read(data); ++ memcpy(buf, &f, sizeof(float)); ++ } ++ break; ++ case DATA_DOUBLE: ++ { ++ double d = mach_double_read(data); ++ memcpy(buf, &d, sizeof(double)); ++ } ++ break; + default: + break; + } diff --git a/mariadb.changes b/mariadb.changes index cfc4761..689b317 100644 --- a/mariadb.changes +++ b/mariadb.changes @@ -1,3 +1,37 @@ +------------------------------------------------------------------- +Thu Jan 21 12:20:09 UTC 2021 - Marcus Rueckert + +- revert the permission change, we will revisit it at a later point + +------------------------------------------------------------------- +Wed Jan 20 19:39:21 UTC 2021 - Marcus Rueckert + +- we give the config files and directory the permissions + u=rwx,go=rx root:mysql, if we give the mysql group permissions we + should not need to leave the permissions open for others. + change permissions to u=rwx,g=rx,o= + +------------------------------------------------------------------- +Wed Jan 20 19:37:46 UTC 2021 - Marcus Rueckert + +- exclude galera files if we build without this feature. + +------------------------------------------------------------------- +Wed Jan 20 17:44:44 UTC 2021 - Marcus Rueckert + +- instead of setting the permissions in the files section inherit + what ever we set during installation. This simplifies the code + for the file section a lot. and we have a lot more flexiblity to + fix permissions in %install + +------------------------------------------------------------------- +Wed Jan 20 15:49:47 UTC 2021 - Marcus Rueckert + +- added fix-lock-rollback-assert-abort.patch + fix an abort when a transaction is rolled back +- track all patches in a series so we can easily set up a quilt + tree without requiring all the devel packages + ------------------------------------------------------------------- Wed Dec 2 17:27:43 UTC 2020 - Marcus Rueckert diff --git a/mariadb.spec b/mariadb.spec index ad8f1de..c41e6b7 100644 --- a/mariadb.spec +++ b/mariadb.spec @@ -77,6 +77,7 @@ Source18: mariadb@.service.in Source19: macros.mariadb-test Source50: suse_skipped_tests.list Source51: mariadb-rpmlintrc +Source52: series Patch1: mariadb-10.2.4-logrotate.patch Patch2: mariadb-10.1.1-mysqld_multi-features.patch Patch3: mariadb-10.0.15-logrotate-su.patch @@ -84,6 +85,7 @@ Patch4: mariadb-10.2.4-fortify-and-O.patch Patch5: mariadb-10.2.19-link-and-enable-c++11-atomics.patch Patch6: mariadb-10.4.12-harden_setuid.patch Patch7: mariadb-10.4.12-fix-install-db.patch +Patch8: fix-lock-rollback-assert-abort.patch # needed for bison SQL parser and wsrep API BuildRequires: bison BuildRequires: cmake @@ -372,6 +374,7 @@ find . -name "*.jar" -type f -exec rm --verbose -f {} \; %patch5 -p1 %patch6 -p1 %patch7 -p1 +%patch8 -p1 cp %{_sourcedir}/suse-test-run . @@ -508,6 +511,30 @@ filelist() popd >/dev/null } +filelist_excludes() +{ + echo '%%defattr(-, root, root)' + pushd %{buildroot} >/dev/null + for i; do + if test -e usr/sbin/"$i"; then + echo "%exclude %{_sbindir}/$i" + fi + if test -e usr/bin/"$i"; then + echo "%exclude %{_bindir}/$i" + fi + if test -d usr/share/*/"$i"; then + echo "%exclude /$(echo usr/share/*/"$i")" + fi + if test -n "$(ls -1 %{buildroot}$i 2> /dev/null)"; then + echo "%exclude $i" + fi + if ls usr/share/man/*/"$i".[1-9]* >/dev/null 2>&1; then + echo "%exclude %{_mandir}/*/$i.[1-9]*" + fi + done + popd >/dev/null +} + # Install the package itself %cmake_install benchdir_root=%{_datadir}/ @@ -599,6 +626,11 @@ fi %if %{with galera} # mariadb-galera.files filelist galera_new_cluster galera_recovery wsrep_sst_common wsrep_sst_mariabackup wsrep_sst_mysqldump wsrep_sst_rsync wsrep_sst_rsync_wan >mariadb-galera.files +touch mariadb-galera-exclude.files +%else +filelist_excludes galera_new_cluster galera_recovery wsrep_sst_common wsrep_sst_mariabackup wsrep_sst_mysqldump wsrep_sst_rsync wsrep_sst_rsync_wan >mariadb-galera-exclude.files +echo /usr/share/mysql/systemd/use_galera_new_cluster.conf >>mariadb-galera-exclude.files +echo /usr/share/mysql/wsrep_notify >>mariadb-galera-exclude.files %endif # mariadb-bench.files @@ -635,7 +667,7 @@ for i in "${DOCS[@]}"; do done # Install default configuration file -install -m 664 %{SOURCE14} %{buildroot}%{_sysconfdir}/my.cnf +install -m 644 %{SOURCE14} %{buildroot}%{_sysconfdir}/my.cnf # Systemd/initscript install -D -m 755 %{_sourcedir}/mysql-systemd-helper '%{buildroot}'%{_libexecdir}/mysql/mysql-systemd-helper @@ -822,10 +854,9 @@ exit 0 %post -n libmariadbd%{soname} -p /sbin/ldconfig %postun -n libmariadbd%{soname} -p /sbin/ldconfig -%files -f mariadb.files -%config(noreplace) %attr(0644, root, mysql) %{_sysconfdir}/my.cnf -%dir %attr(0755, root, mysql) %{_sysconfdir}/my.cnf.d -%config(noreplace) %attr(0644, root, mysql) %{_sysconfdir}/my.cnf.d/* +%files -f mariadb.files -f mariadb-galera-exclude.files +%config(noreplace) %attr(-, root, mysql) %{_sysconfdir}/my.cnf +%config(noreplace) %attr(-, root, mysql) %{_sysconfdir}/my.cnf.d/ %if %{with galera} %exclude %{_sysconfdir}/my.cnf.d/50-galera.cnf %endif @@ -902,7 +933,7 @@ exit 0 %if %{with galera} %files galera -f mariadb-galera.files %doc Docs/README.wsrep -%config(noreplace) %{_sysconfdir}/my.cnf.d/50-galera.cnf +%config(noreplace) %attr(-, root, mysql) %{_sysconfdir}/my.cnf.d/50-galera.cnf %{_datadir}/mysql/systemd/use_galera_new_cluster.conf %{_datadir}/mysql/wsrep_notify %endif diff --git a/series b/series new file mode 100644 index 0000000..f7df3c7 --- /dev/null +++ b/series @@ -0,0 +1,8 @@ +mariadb-10.2.4-logrotate.patch -p0 +mariadb-10.1.1-mysqld_multi-features.patch -p0 +mariadb-10.0.15-logrotate-su.patch -p0 +mariadb-10.2.4-fortify-and-O.patch -p0 +mariadb-10.2.19-link-and-enable-c++11-atomics.patch -p1 +mariadb-10.4.12-harden_setuid.patch -p1 +mariadb-10.4.12-fix-install-db.patch -p1 +fix-lock-rollback-assert-abort.patch