[arch-commits] Commit in mariadb/trunk (0007-MDEV-20646.patch PKGBUILD)

Christian Hesse eworm at archlinux.org
Mon Nov 25 11:30:34 UTC 2019


    Date: Monday, November 25, 2019 @ 11:30:34
  Author: eworm
Revision: 369749

upgpkg: mariadb 10.4.10-2

fix performance regression (MDEV-20646)

Added:
  mariadb/trunk/0007-MDEV-20646.patch
Modified:
  mariadb/trunk/PKGBUILD

-----------------------+
 0007-MDEV-20646.patch |   45 +++++++++++++++++++++++++++++++++++++++++++++
 PKGBUILD              |   11 ++++++++---
 2 files changed, 53 insertions(+), 3 deletions(-)

Added: 0007-MDEV-20646.patch
===================================================================
--- 0007-MDEV-20646.patch	                        (rev 0)
+++ 0007-MDEV-20646.patch	2019-11-25 11:30:34 UTC (rev 369749)
@@ -0,0 +1,45 @@
+commit d4edb0510ec1189f65850bb47977e94ed98b1f71
+Author: Sergei Petrunia <psergey at askmonty.org>
+Date:   Wed Nov 13 18:53:59 2019 +0300
+
+    MDEV-20646: 10.3.18 is slower than 10.3.17
+    
+    Fix incorrect change introduced in the fix for MDEV-20109.
+    
+    The patch tried to compute a more precise estimate for the record_count
+    value in SJ-Materialization-Scan strategy (in
+    Sj_materialization_picker::check_qep).  However the new formula is worse
+    as it produces extremely optimistic results in common cases where
+    SJ-Materialization-Scan should be used)
+    
+    The old formula produces pessimistic results in cases when Sj-Materialization-
+    Scan is unlikely to be a good choice anyway. So, the old behavior is better.
+
+diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
+index aeafc13998a..a8afd952a4d 100644
+--- a/sql/opt_subselect.cc
++++ b/sql/opt_subselect.cc
+@@ -3029,7 +3029,22 @@ bool Sj_materialization_picker::check_qep(JOIN *join,
+ 
+     *strategy= SJ_OPT_MATERIALIZE_SCAN;
+     *read_time=    prefix_cost;
+-    *record_count= prefix_rec_count / mat_info->rows_with_duplicates;
++    /*
++      Note: the next line means we did not remove the subquery's fanout from
++      *record_count. It needs to be removed, as the join prefix is
++
++        ntX  SJM-SCAN(it1 ... itN) | (ot1 ... otN) ...
++
++      here, the SJM-SCAN may have introduced subquery's fanout (duplicate rows,
++      rows that don't have matches in ot1_i). All this fanout is gone after
++      table otN (or earlier) but taking it into account is hard.
++
++      Some consolation here is that SJM-Scan strategy is applicable when the
++      subquery is smaller than tables otX. If the subquery has large cardinality,
++      we can greatly overestimate *record_count here, but it doesn't matter as
++      SJ-Materialization-Lookup is a better strategy anyway.
++    */
++    *record_count= prefix_rec_count;
+     *handled_fanout= mat_nest->sj_inner_tables;
+     return TRUE;
+   }

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2019-11-25 11:10:10 UTC (rev 369748)
+++ PKGBUILD	2019-11-25 11:30:34 UTC (rev 369749)
@@ -5,7 +5,7 @@
 pkgname=('mariadb-libs' 'mariadb-clients' 'mariadb' 'mytop')
 pkgdesc='Fast SQL database server, derived from MySQL'
 pkgver=10.4.10
-pkgrel=1
+pkgrel=2
 arch=('x86_64')
 license=('GPL')
 url='https://mariadb.org/'
@@ -15,12 +15,14 @@
 source=("https://downloads.mariadb.org/interstitial/mariadb-${pkgver}/source/mariadb-${pkgver}.tar.gz"{,.asc}
         '0001-arch-specific.patch'
         '0002-systemd-sysusers-tmpfiles.patch'
-        '0005-fix-galera_recovery-with-fs.protected_regular-enabled.patch')
+        '0005-fix-galera_recovery-with-fs.protected_regular-enabled.patch'
+        '0007-MDEV-20646.patch')
 sha256sums=('cd50fddf86c2a47405737e342f78ebd40d5716f0fb32b976245de713bed01421'
             'SKIP'
             'ce72ea1563ad773e00e8b1c299babea176abae1102827c2f743921e9de615041'
             '3e83467af80fbd53400a201a34fc858b88509ea8e88b10709947eb66545f9457'
-            'c8c801f80924ccb97b499552fe1c532b3ebf8f86cdfc0d23715d4adb1a8810f0')
+            'c8c801f80924ccb97b499552fe1c532b3ebf8f86cdfc0d23715d4adb1a8810f0'
+            '825d4ab1601c9e97bf24857bcfd8bed2b6d8ad15a4c2411c7867bff2333b09d8')
 
 prepare() {
   cd $pkgbase-$pkgver/
@@ -40,6 +42,9 @@
   # fix galera_recovery with fs.protected_regular enabled
   # https://github.com/MariaDB/server/pull/1137
   patch -Np1 < ../0005-fix-galera_recovery-with-fs.protected_regular-enabled.patch
+
+  # MDEV-20646: 10.3.18 is slower than 10.3.17
+  patch -Np1 < ../0007-MDEV-20646.patch
 }
 
 build() {



More information about the arch-commits mailing list