Commit 094b0f86 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.2 into bb-10.2-ext

parents 38908aaf bf963106
--echo #
--echo # MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
--echo #
CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('111', '111');
INSERT INTO t1 VALUES ('222', '222');
INSERT INTO t1 VALUES ('333', '333');
INSERT INTO t1 VALUES ('444', '444');
SELECT * FROM t1 WHERE a LIKE '111%';
SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
DROP TABLE t1;
......@@ -8804,6 +8804,31 @@ DROP TABLE t1;
# End of ctype_pad.inc
#
SET STORAGE_ENGINE=Default;
SET NAMES latin1;
#
# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
#
CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(50) DEFAULT NULL,
`b` varchar(50) DEFAULT NULL,
KEY `a` (`a`),
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('111', '111');
INSERT INTO t1 VALUES ('222', '222');
INSERT INTO t1 VALUES ('333', '333');
INSERT INTO t1 VALUES ('444', '444');
SELECT * FROM t1 WHERE a LIKE '111%';
a b
111 111
SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
a b
111 111
DROP TABLE t1;
#
# End of 10.2 tests
#
......@@ -4430,5 +4430,50 @@ a_ 6100 61FF
a% 61000000000000000000 61FFFFFFFFFFFFFFFFFF
DROP TABLE t1;
#
# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
#
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_swedish_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
a HEX(LIKE_RANGE_MIN(a,200))
111% 313131
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
a HEX(LIKE_RANGE_MIN(a,200))
111% 313131
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
a HEX(LIKE_RANGE_MIN(a,200))
111% 313131
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
a HEX(LIKE_RANGE_MIN(a,200))
111% 313131
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ucs2 COLLATE ucs2_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
a HEX(LIKE_RANGE_MIN(a,200))
111% 003100310031
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf16 COLLATE utf16_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
a HEX(LIKE_RANGE_MIN(a,200))
111% 003100310031
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf32 COLLATE utf32_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
a HEX(LIKE_RANGE_MIN(a,200))
111% 000000310000003100000031
DROP TABLE t1;
#
# End of 10.2 tests
#
......@@ -559,6 +559,32 @@ DROP TABLE t1;
# End of ctype_pad.inc
#
SET STORAGE_ENGINE=Default;
SET NAMES utf8, collation_connection=ucs2_unicode_520_nopad_ci;
#
# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
#
CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(50) CHARACTER SET ucs2 COLLATE ucs2_unicode_520_nopad_ci DEFAULT NULL,
`b` varchar(50) CHARACTER SET ucs2 COLLATE ucs2_unicode_520_nopad_ci DEFAULT NULL,
KEY `a` (`a`),
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('111', '111');
INSERT INTO t1 VALUES ('222', '222');
INSERT INTO t1 VALUES ('333', '333');
INSERT INTO t1 VALUES ('444', '444');
SELECT * FROM t1 WHERE a LIKE '111%';
a b
111 111
SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
a b
111 111
DROP TABLE t1;
SET NAMES utf8;
#
# End of 10.2 tests
#
......@@ -7866,6 +7866,32 @@ DROP TABLE t1;
# End of ctype_pad.inc
#
SET STORAGE_ENGINE=Default;
SET NAMES utf8, collation_connection=utf16_unicode_520_nopad_ci;
#
# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
#
CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(50) CHARACTER SET utf16 COLLATE utf16_unicode_520_nopad_ci DEFAULT NULL,
`b` varchar(50) CHARACTER SET utf16 COLLATE utf16_unicode_520_nopad_ci DEFAULT NULL,
KEY `a` (`a`),
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('111', '111');
INSERT INTO t1 VALUES ('222', '222');
INSERT INTO t1 VALUES ('333', '333');
INSERT INTO t1 VALUES ('444', '444');
SELECT * FROM t1 WHERE a LIKE '111%';
a b
111 111
SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
a b
111 111
DROP TABLE t1;
SET NAMES utf8;
#
# End of 10.2 tests
#
......@@ -7886,6 +7886,32 @@ DROP TABLE t1;
# End of ctype_pad.inc
#
SET STORAGE_ENGINE=Default;
SET NAMES utf8, collation_connection=utf32_unicode_520_nopad_ci;
#
# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
#
CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(50) CHARACTER SET utf32 COLLATE utf32_unicode_520_nopad_ci DEFAULT NULL,
`b` varchar(50) CHARACTER SET utf32 COLLATE utf32_unicode_520_nopad_ci DEFAULT NULL,
KEY `a` (`a`),
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('111', '111');
INSERT INTO t1 VALUES ('222', '222');
INSERT INTO t1 VALUES ('333', '333');
INSERT INTO t1 VALUES ('444', '444');
SELECT * FROM t1 WHERE a LIKE '111%';
a b
111 111
SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
a b
111 111
DROP TABLE t1;
SET NAMES utf8;
#
# End of 10.2 tests
#
......@@ -559,6 +559,31 @@ DROP TABLE t1;
# End of ctype_pad.inc
#
SET STORAGE_ENGINE=Default;
SET NAMES utf8 COLLATE utf8_unicode_nopad_ci;
#
# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
#
CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci DEFAULT NULL,
`b` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci DEFAULT NULL,
KEY `a` (`a`),
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('111', '111');
INSERT INTO t1 VALUES ('222', '222');
INSERT INTO t1 VALUES ('333', '333');
INSERT INTO t1 VALUES ('444', '444');
SELECT * FROM t1 WHERE a LIKE '111%';
a b
111 111
SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
a b
111 111
DROP TABLE t1;
#
# End of 10.2 tests
#
......@@ -6576,6 +6576,32 @@ DROP TABLE t1;
# End of ctype_pad.inc
#
SET STORAGE_ENGINE=Default;
SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci;
#
# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
#
CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci DEFAULT NULL,
`b` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci DEFAULT NULL,
KEY `a` (`a`),
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('111', '111');
INSERT INTO t1 VALUES ('222', '222');
INSERT INTO t1 VALUES ('333', '333');
INSERT INTO t1 VALUES ('444', '444');
SELECT * FROM t1 WHERE a LIKE '111%';
a b
111 111
SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
a b
111 111
DROP TABLE t1;
SET NAMES utf8mb4;
#
# End of 10.2 tests
#
......@@ -1614,7 +1614,7 @@ NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST fcfs,vats
READ_ONLY NO
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_LOCK_WAIT_TIMEOUT
SESSION_VALUE 50
......
--innodb-lock-schedule-algorithm=FCFS
......@@ -411,6 +411,9 @@ let $coll='latin1_nopad_bin';
let $coll_pad='latin1_bin';
--source include/ctype_pad_all_engines.inc
SET NAMES latin1;
--source include/ctype_like_range_mdev14350.inc
--echo #
--echo # End of 10.2 tests
--echo #
......@@ -154,6 +154,46 @@ INSERT INTO t1 (a) VALUES ('a'),('a_'),('a%');
SELECT a, HEX(mn), HEX(mx) FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
--echo #
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_swedish_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ucs2 COLLATE ucs2_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf16 COLLATE utf16_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf32 COLLATE utf32_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 10.2 tests
--echo #
......@@ -16,6 +16,10 @@ let $coll='ucs2_unicode_520_nopad_ci';
let $coll_pad='ucs2_unicode_520_ci';
--source include/ctype_pad_all_engines.inc
SET NAMES utf8, collation_connection=ucs2_unicode_520_nopad_ci;
--source include/ctype_like_range_mdev14350.inc
SET NAMES utf8;
--echo #
--echo # End of 10.2 tests
--echo #
......@@ -238,6 +238,11 @@ let $coll='utf16_unicode_520_nopad_ci';
let $coll_pad='utf16_unicode_520_ci';
--source include/ctype_pad_all_engines.inc
SET NAMES utf8, collation_connection=utf16_unicode_520_nopad_ci;
--source include/ctype_like_range_mdev14350.inc
SET NAMES utf8;
--echo #
--echo # End of 10.2 tests
--echo #
......@@ -260,6 +260,11 @@ let $coll='utf32_unicode_520_nopad_ci';
let $coll_pad='utf32_unicode_520_ci';
--source include/ctype_pad_all_engines.inc
SET NAMES utf8, collation_connection=utf32_unicode_520_nopad_ci;
--source include/ctype_like_range_mdev14350.inc
SET NAMES utf8;
--echo #
--echo # End of 10.2 tests
--echo #
......@@ -14,6 +14,9 @@ let $coll='utf8_unicode_520_nopad_ci';
let $coll_pad='utf8_unicode_520_ci';
--source include/ctype_pad_all_engines.inc
SET NAMES utf8 COLLATE utf8_unicode_nopad_ci;
--source include/ctype_like_range_mdev14350.inc
--echo #
--echo # End of 10.2 tests
......
......@@ -100,6 +100,11 @@ let $coll='utf8mb4_unicode_520_nopad_ci';
let $coll_pad='utf8mb4_unicode_520_ci';
--source include/ctype_pad_all_engines.inc
SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci;
--source include/ctype_like_range_mdev14350.inc
SET NAMES utf8mb4;
--echo #
--echo # End of 10.2 tests
--echo #
......@@ -318,7 +318,7 @@ dict_stats_save_defrag_stats(dict_index_t* index, trx_t* trx)
return DB_SUCCESS;
}
lint now = ut_time();
ib_time_t now = ut_time();
dberr_t err = dict_stats_save_index_stat(
index, now, "n_page_split",
index->stat_defrag_n_page_split,
......
......@@ -2256,7 +2256,7 @@ storage.
dberr_t
dict_stats_save_index_stat(
dict_index_t* index,
lint last_update,
ib_time_t last_update,
const char* stat_name,
ib_uint64_t stat_value,
ib_uint64_t* sample_size,
......@@ -2278,7 +2278,7 @@ dict_stats_save_index_stat(
pars_info_add_str_literal(pinfo, "table_name", table_utf8);
pars_info_add_str_literal(pinfo, "index_name", index->name);
UNIV_MEM_ASSERT_RW_ABORT(&last_update, 4);
pars_info_add_int4_literal(pinfo, "last_update", last_update);
pars_info_add_int4_literal(pinfo, "last_update", (lint)last_update);
UNIV_MEM_ASSERT_RW_ABORT(stat_name, strlen(stat_name));
pars_info_add_str_literal(pinfo, "stat_name", stat_name);
UNIV_MEM_ASSERT_RW_ABORT(&stat_value, 8);
......@@ -2389,7 +2389,7 @@ dict_stats_save(
const index_id_t* only_for_index = NULL)
{
pars_info_t* pinfo;
lint now;
ib_time_t now;
dberr_t ret;
dict_table_t* table;
char db_utf8[MAX_DB_UTF8_LEN];
......@@ -2407,16 +2407,14 @@ dict_stats_save(
dict_fs2utf8(table->name.m_name, db_utf8, sizeof(db_utf8),
table_utf8, sizeof(table_utf8));
/* MySQL's timestamp is 4 byte, so we use
pars_info_add_int4_literal() which takes a lint arg, so "now" is
lint */
now = (lint) ut_time();
now = ut_time();
pinfo = pars_info_create();
pars_info_add_str_literal(pinfo, "database_name", db_utf8);
pars_info_add_str_literal(pinfo, "table_name", table_utf8);
pars_info_add_int4_literal(pinfo, "last_update", now);
pars_info_add_int4_literal(pinfo, "last_update", (lint)now);
pars_info_add_ull_literal(pinfo, "n_rows", table->stat_n_rows);
pars_info_add_ull_literal(pinfo, "clustered_index_size",
table->stat_clustered_index_size);
......
......@@ -212,7 +212,7 @@ storage.
dberr_t
dict_stats_save_index_stat(
dict_index_t* index,
lint last_update,
ib_time_t last_update,
const char* stat_name,
ib_uint64_t stat_value,
ib_uint64_t* sample_size,
......
......@@ -799,9 +799,9 @@ my_bool my_like_range_mb(CHARSET_INFO *cs,
'a\0\0... is the smallest possible string when we have space expand
a\ff\ff... is the biggest possible string
*/
*min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) :
res_length);
*max_length= res_length;
*min_length= (cs->state & (MY_CS_BINSORT | MY_CS_NOPAD)) ?
(size_t) (min_str - min_org) :
res_length;
/* Create min key */
do
{
......@@ -1002,9 +1002,9 @@ my_like_range_generic(CHARSET_INFO *cs,
a\min\min... is the smallest possible string
a\max\max... is the biggest possible string
*/
*min_length= ((cs->state & MY_CS_BINSORT) ?
*min_length= (cs->state & (MY_CS_BINSORT | MY_CS_NOPAD)) ?
(size_t) (min_str - min_org) :
res_length);
res_length;
*max_length= res_length;
goto pad_min_max;
}
......
......@@ -1059,9 +1059,9 @@ my_bool my_like_range_simple(CHARSET_INFO *cs,
if (*ptr == w_many) /* '%' in SQL */
{
/* Calculate length of keys */
*min_length= ((cs->state & MY_CS_BINSORT) ?
*min_length= (cs->state & (MY_CS_BINSORT | MY_CS_NOPAD)) ?
(size_t) (min_str - min_org) :
res_length);
res_length;
*max_length= res_length;
do
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment