summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-09-23 08:26:08 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-09-23 08:26:08 +0300
commit44c5144943f534b9dcd8ac771955127c7e1c2146 (patch)
tree3aab34b221a165f50758cc7d8c0f21f49d57c4ee
parent1ad79c818780aafe1aaf1c25bbf975eb31a38a40 (diff)
parent896974fc3d721aabe1afbf637a566cab856a731d (diff)
downloadmariadb-git-44c5144943f534b9dcd8ac771955127c7e1c2146.tar.gz
Merge 10.1 into 10.2
-rw-r--r--debian/mariadb-server-10.2.postinst10
-rw-r--r--mysql-test/r/group_min_max.result4
-rw-r--r--mysql-test/r/order_by_innodb.result27
-rw-r--r--mysql-test/suite/maria/icp.result2
-rw-r--r--mysql-test/t/order_by_innodb.test28
-rw-r--r--scripts/mysqld_safe.sh8
-rw-r--r--sql/opt_range.cc14
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/2970.result2
-rw-r--r--support-files/mariadb@.service.in2
9 files changed, 81 insertions, 16 deletions
diff --git a/debian/mariadb-server-10.2.postinst b/debian/mariadb-server-10.2.postinst
index b68d2362387..063f0d8c58b 100644
--- a/debian/mariadb-server-10.2.postinst
+++ b/debian/mariadb-server-10.2.postinst
@@ -2,8 +2,8 @@
. /usr/share/debconf/confmodule
-# assume the filename is /path/to/mariadb-server-##.#.postinst
-VER=${0: -13:4}
+# Automatically set version to ease maintenance of this file
+MAJOR_VER="${DPKG_MAINTSCRIPT_PACKAGE#mariadb-server-}"
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
@@ -11,7 +11,7 @@ ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin
# This command can be used as pipe to syslog. With "-s" it also logs to stderr.
-ERR_LOGGER="logger -p daemon.err -t mariadb-server-$VER.postinst -i"
+ERR_LOGGER="logger -p daemon.err -t mariadb-server-$MAJOR_VER.postinst -i"
# This will make an error in a logged command immediately apparent by aborting
# the install, rather than failing silently and leaving a broken install.
set -o pipefail
@@ -149,8 +149,8 @@ EOF
# To avoid downgrades.
- touch $mysql_statedir/debian-$VER.flag
-
+ touch $mysql_statedir/debian-$MAJOR_VER.flag
+
## On every reconfiguration the maintenance user is recreated.
#
# - It is easier to regenerate the password every time but as people
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result
index f200f70dd8b..344526cbfe7 100644
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@ -2119,12 +2119,12 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using index
explain extended select a1,a2,count(a2) from t1 where (a1 > 'a') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index
+1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 65 NULL 102 94.12 Using where; Using index
Warnings:
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,count(`test`.`t1`.`a2`) AS `count(a2)` from `test`.`t1` where `test`.`t1`.`a1` > 'a' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
explain extended select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index
+1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 65 NULL 102 94.12 Using where; Using index
Warnings:
Note 1003 select sum(ord(`test`.`t1`.`a1`)) AS `sum(ord(a1))` from `test`.`t1` where `test`.`t1`.`a1` > 'a' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
create table t4 as select distinct a1, a2, b, c from t1;
diff --git a/mysql-test/r/order_by_innodb.result b/mysql-test/r/order_by_innodb.result
index 3ff1f92e94a..9cdf9800cee 100644
--- a/mysql-test/r/order_by_innodb.result
+++ b/mysql-test/r/order_by_innodb.result
@@ -49,6 +49,32 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL # Using sort_union(key1,key2); Using where
drop table t0, t1;
#
+# MDEV-18094: Query with order by limit picking index scan over filesort
+#
+create table t0 (a int);
+INSERT INTO t0 VALUES (0),(0),(0),(0),(2),(0),(0),(1),(1),(0);
+CREATE TABLE t1 (
+a int(11),
+b int(11),
+c int(11),
+KEY a_c (a,c),
+KEY a_b (a,b)
+) ENGINE=InnoDB;
+insert into t1 select A.a , B.a, C.a from t0 A, t0 B, t0 C;
+# should use ref access
+explain select a,b,c from t1 where a=1 and c=2 order by b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a_c,a_b a_c 10 const,const 20 Using where; Using filesort
+# both should use range access
+explain select a,b,c from t1 where a=1 and c=2 order by b limit 1000;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a_c,a_b a_b 5 NULL 200 Using where
+explain select a,b,c from t1 where a=1 and c=2 order by b limit 2000;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a_c,a_b a_b 5 NULL 200 Using where
+drop table t1,t0;
+# Start of 10.2 tests
+#
# MDEV-14071: wrong results with orderby_uses_equalities=on
# (duplicate of MDEV-13994)
#
@@ -121,3 +147,4 @@ i n
656 eight
set optimizer_switch= @save_optimizer_switch;
DROP TABLE t1,t2,t3;
+# End of 10.2 tests
diff --git a/mysql-test/suite/maria/icp.result b/mysql-test/suite/maria/icp.result
index 8fc93e861a7..b3b8efc745a 100644
--- a/mysql-test/suite/maria/icp.result
+++ b/mysql-test/suite/maria/icp.result
@@ -167,7 +167,7 @@ WHERE ts BETWEEN '0000-00-00' AND '2010-00-01 00:00:00'
ORDER BY ts DESC
LIMIT 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 2 Using where
+1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using where
DROP TABLE t1;
#
diff --git a/mysql-test/t/order_by_innodb.test b/mysql-test/t/order_by_innodb.test
index 0debb777749..f4c738263ae 100644
--- a/mysql-test/t/order_by_innodb.test
+++ b/mysql-test/t/order_by_innodb.test
@@ -63,6 +63,32 @@ where key1<3 or key2<3;
drop table t0, t1;
--echo #
+--echo # MDEV-18094: Query with order by limit picking index scan over filesort
+--echo #
+
+create table t0 (a int);
+INSERT INTO t0 VALUES (0),(0),(0),(0),(2),(0),(0),(1),(1),(0);
+
+CREATE TABLE t1 (
+a int(11),
+b int(11),
+c int(11),
+KEY a_c (a,c),
+KEY a_b (a,b)
+) ENGINE=InnoDB;
+insert into t1 select A.a , B.a, C.a from t0 A, t0 B, t0 C;
+
+--echo # should use ref access
+explain select a,b,c from t1 where a=1 and c=2 order by b;
+
+--echo # both should use range access
+explain select a,b,c from t1 where a=1 and c=2 order by b limit 1000;
+explain select a,b,c from t1 where a=1 and c=2 order by b limit 2000;
+drop table t1,t0;
+
+--echo # Start of 10.2 tests
+
+--echo #
--echo # MDEV-14071: wrong results with orderby_uses_equalities=on
--echo # (duplicate of MDEV-13994)
--echo #
@@ -108,3 +134,5 @@ eval $q2;
set optimizer_switch= @save_optimizer_switch;
DROP TABLE t1,t2,t3;
+
+--echo # End of 10.2 tests
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index d4f13eadf4b..f33592a09f0 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -958,7 +958,13 @@ do
cmd="$cmd "`shell_quote_string "$i"`
done
cmd="$cmd $args"
-[ $dry_run -eq 1 ] && return
+
+if [ $dry_run -eq 1 ]
+then
+ # RETURN or EXIT depending if the script is being sourced or not.
+ (return 2> /dev/null) && return || exit
+fi
+
# Avoid 'nohup: ignoring input' warning
test -n "$NOHUP_NICENESS" && cmd="$cmd < /dev/null"
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 5cdcb3159a1..99508cf0b50 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -2408,12 +2408,16 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
records= head->stat_records();
if (!records)
records++; /* purecov: inspected */
- scan_time= (double) records / TIME_FOR_COMPARE + 1;
- read_time= (double) head->file->scan_time() + scan_time + 1.1;
- if (head->force_index)
+
+ if (head->force_index || force_quick_range)
scan_time= read_time= DBL_MAX;
- if (limit < records)
- read_time= (double) records + scan_time + 1; // Force to use index
+ else
+ {
+ scan_time= (double) records / TIME_FOR_COMPARE + 1;
+ read_time= (double) head->file->scan_time() + scan_time + 1.1;
+ if (limit < records)
+ read_time= (double) records + scan_time + 1; // Force to use index
+ }
possible_keys.clear_all();
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/2970.result b/storage/tokudb/mysql-test/tokudb_bugs/r/2970.result
index 83ba8821f27..c322865b09d 100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/r/2970.result
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/2970.result
@@ -6,5 +6,5 @@ create table t2970 (a int, b int, c int, d int, key(a), key(a,b));
insert into t2970 values (1,1,1,1),(1,2,3,4);
explain select a,count(b),max(b) from t2970 where a > 0 group by a order by a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2970 index a,a_2 a_2 10 NULL 2 Using where; Using index
+1 SIMPLE t2970 range a,a_2 a_2 5 NULL 2 Using where; Using index
drop table t2970;
diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in
index 3d18daba491..7a79a143778 100644
--- a/support-files/mariadb@.service.in
+++ b/support-files/mariadb@.service.in
@@ -26,7 +26,7 @@
# (at your option) any later version.
[Unit]
-Description=MariaDB @VERSION@ database server (multi-instance)
+Description=MariaDB @VERSION@ database server (multi-instance %I)
Documentation=man:mysqld(8)
Documentation=https://mariadb.com/kb/en/library/systemd/
After=network.target