summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/maintainer.cmake9
-rw-r--r--mysql-test/r/join_cache.result10
-rwxr-xr-xmysql-test/suite/innodb/r/innodb_bug60196.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_mysql.result6
-rwxr-xr-xmysql-test/suite/innodb/t/innodb_bug60196.test1
-rw-r--r--mysql-test/t/join_cache.test2
-rw-r--r--sql/handler.cc2
-rw-r--r--sql/sql_select.cc6
8 files changed, 26 insertions, 12 deletions
diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake
index cf9b1882715..9c9ab8cca3b 100644
--- a/cmake/maintainer.cmake
+++ b/cmake/maintainer.cmake
@@ -19,6 +19,15 @@ INCLUDE(CheckCCompilerFlag)
MACRO(SET_MYSQL_MAINTAINER_GNU_C_OPTIONS)
SET(MY_MAINTAINER_WARNINGS
"-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing")
+
+ CHECK_C_COMPILER_FLAG("-Wno-missing-field-initializers"
+ HAVE_NO_MISSING_FIELD_INITIALIZERS)
+
+ IF (HAVE_NO_MISSING_FIELD_INITIALIZERS)
+ SET(MY_MAINTAINER_WARNINGS
+ "${MY_MAINTAINER_WARNINGS} -Wno-missing-field-initializers")
+ ENDIF()
+
CHECK_C_COMPILER_FLAG("-Wdeclaration-after-statement"
HAVE_DECLARATION_AFTER_STATEMENT)
IF(HAVE_DECLARATION_AFTER_STATEMENT)
diff --git a/mysql-test/r/join_cache.result b/mysql-test/r/join_cache.result
index 0892ce7794a..6471a2f8bbd 100644
--- a/mysql-test/r/join_cache.result
+++ b/mysql-test/r/join_cache.result
@@ -3221,7 +3221,7 @@ explain
select t1.a, count(t2.p) as count
from t1 left join t2 on t1.a=t2.a and t2.p % 2 = 1 group by t1.a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 8 Using index; Using temporary; Using filesort
1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
select t1.a, count(t2.p) as count
from t1 left join t2 on t1.a=t2.a and t2.p % 2 = 1 group by t1.a;
@@ -4274,7 +4274,7 @@ pk int NOT NULL, i int NOT NULL, v varchar(1) NOT NULL,
PRIMARY KEY (pk), INDEX idx1(i), INDEX idx2 (v,i)
) COLLATE latin1_bin;
INSERT INTO t1 VALUES
-(10,8,'v'), (11,8,'f'), (12,5,'v'), (13,8,'s'), (14,8,'a'),
+(10,8,'v'), (11,8,'f'), (13,8,'s'), (14,8,'a'),
(15,6,'p'), (16,7,'z'), (17,2,'a'), (18,5,'h'), (19,7,'h'),
(25,3,'m'), (26,5,'a'), (27,9,'n'), (28,1,'d'), (29,107,'a');
INSERT INTO t1 VALUES
@@ -4327,7 +4327,7 @@ SELECT t2.v FROM t1, t2, t3
WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL idx1 NULL NULL NULL 20 Using temporary; Using filesort
+1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort
1 SIMPLE t3 eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
1 SIMPLE t1 ref idx2 idx2 3 test.t3.v 5 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
SELECT t2.v FROM t1, t2, t3
@@ -4345,9 +4345,9 @@ SELECT t2.v FROM t1, t2, t3
WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ALL idx1 NULL NULL NULL 20 Using temporary; Using filesort
+1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort
1 SIMPLE t3 hash_ALL PRIMARY,idx2 #hash#PRIMARY 4 test.t2.i 20 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE t1 hash_ALL idx2 #hash#idx2 3 test.t3.v 45 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE t1 hash_ALL idx2 #hash#idx2 3 test.t3.v 44 Using where; Using join buffer (incremental, BNLH join)
SELECT t2.v FROM t1, t2, t3
WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
diff --git a/mysql-test/suite/innodb/r/innodb_bug60196.result b/mysql-test/suite/innodb/r/innodb_bug60196.result
index 411950b49dd..2a0af9257d3 100755
--- a/mysql-test/suite/innodb/r/innodb_bug60196.result
+++ b/mysql-test/suite/innodb/r/innodb_bug60196.result
@@ -58,7 +58,7 @@ FK1_Key FK2_Key
INSERT INTO Bug_60196 VALUES (2, 1);
INSERT INTO Bug_60196 VALUES (2, 2);
INSERT INTO Bug_60196 VALUES (2, 3);
-SELECT * FROM Bug_60196;
+SELECT * FROM Bug_60196 ORDER BY FK1_Key, FK2_Key;
FK1_Key FK2_Key
1 1
1 2
diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result
index a1782ea5f6e..2b3d24551c7 100644
--- a/mysql-test/suite/innodb/r/innodb_mysql.result
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result
@@ -2365,8 +2365,8 @@ select_type SIMPLE
table t1
type index
possible_keys NULL
-key PRIMARY
-key_len 4
+key b
+key_len 10
ref NULL
rows 10
Extra Using index
@@ -2652,7 +2652,7 @@ select_type SIMPLE
table t1
type index
possible_keys NULL
-key PRIMARY
+key b
key_len 8
ref NULL
rows 3
diff --git a/mysql-test/suite/innodb/t/innodb_bug60196.test b/mysql-test/suite/innodb/t/innodb_bug60196.test
index 423b6d3403e..e479b8d6b82 100755
--- a/mysql-test/suite/innodb/t/innodb_bug60196.test
+++ b/mysql-test/suite/innodb/t/innodb_bug60196.test
@@ -41,6 +41,7 @@ INSERT INTO Bug_60196 VALUES (99, 1);
SELECT * FROM bug_60196_FK1;
SELECT * FROM bug_60196_FK2;
+--sorted_result
SELECT * FROM bug_60196;
--echo # Stop server
diff --git a/mysql-test/t/join_cache.test b/mysql-test/t/join_cache.test
index 7ef1c0da14d..003ffc8ff19 100644
--- a/mysql-test/t/join_cache.test
+++ b/mysql-test/t/join_cache.test
@@ -2464,7 +2464,7 @@ CREATE TABLE t1 (
PRIMARY KEY (pk), INDEX idx1(i), INDEX idx2 (v,i)
) COLLATE latin1_bin;
INSERT INTO t1 VALUES
- (10,8,'v'), (11,8,'f'), (12,5,'v'), (13,8,'s'), (14,8,'a'),
+ (10,8,'v'), (11,8,'f'), (13,8,'s'), (14,8,'a'),
(15,6,'p'), (16,7,'z'), (17,2,'a'), (18,5,'h'), (19,7,'h'),
(25,3,'m'), (26,5,'a'), (27,9,'n'), (28,1,'d'), (29,107,'a');
INSERT INTO t1 VALUES
diff --git a/sql/handler.cc b/sql/handler.cc
index cdc367bbb18..546491c2f32 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -2194,6 +2194,8 @@ double handler::keyread_time(uint index, uint ranges, ha_rows rows)
The model counts in the time to read index entries from cache.
*/
ulong len= table->key_info[index].key_length + ref_length;
+ if (index == table->s->primary_key && table->file->primary_key_is_clustered())
+ len= table->s->stored_rec_length;
double keys_per_block= (stats.block_size/2.0/len+1);
return (rows + keys_per_block-1)/ keys_per_block +
len*rows/(stats.block_size+1)/TIME_FOR_COMPARE ;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 916e521d3b9..2f8e3a8d97b 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -10080,12 +10080,14 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after)
{
join->need_tmp= 1;
join->simple_order= join->simple_group= 0;
- if (sort_by_tab->type == JT_NEXT)
+ if (sort_by_tab->type == JT_NEXT &&
+ !sort_by_tab->table->covering_keys.is_set(sort_by_tab->index))
{
sort_by_tab->type= JT_ALL;
sort_by_tab->read_first_record= join_init_read_record;
}
- else if (sort_by_tab->type == JT_HASH_NEXT)
+ else if (sort_by_tab->type == JT_HASH_NEXT &&
+ !sort_by_tab->table->covering_keys.is_set(sort_by_tab->index))
{
sort_by_tab->type= JT_HASH;
sort_by_tab->read_first_record= join_init_read_record;