Skip to content
Permalink
Browse files
MDEV-27691: make working view-protocol
Tests with checking metadata or that cannot be run with
the view-protocol are excluded from --view-protocol.
For tests that do not allow the use of an additional connection,
the util connection is disabled with "--disable_service_connection".
Also cases with bugs for --view-protocol are disabled.
  • Loading branch information
mariadb-lenastartseva committed Sep 23, 2022
1 parent 1dd6255 commit 72ba96a
Show file tree
Hide file tree
Showing 273 changed files with 1,867 additions and 158 deletions.
@@ -64,6 +64,7 @@ drop table if exists t1;
--echo **
--echo ** two UPDATE's running and both changing distinct result sets
--echo **
--disable_view_protocol
connect (thread1, localhost, mysqltest,,);
connection thread1;
--echo ** Set up table
@@ -149,7 +150,6 @@ drop table if exists t1;
connection default;
drop table t1;


--echo
--echo **
--echo ** two UPDATE's running and one changing result set
@@ -237,7 +237,7 @@ drop table t1;
connection default;
drop table t1;
--enable_view_protocol
--echo
--echo **
@@ -315,8 +315,9 @@ drop table t1;
--echo ** Begin a new transaction on thread 2
begin;
--echo ** Select a range for update.
--disable_view_protocol
select * from t1 where tipo=2 FOR UPDATE;

--enable_view_protocol
connection thread1;
--echo ** Begin a new transaction on thread 1
begin;
@@ -355,6 +356,7 @@ drop table t1;
--echo **
--echo ** one UPDATE not changing result set and SELECT ... FOR UPDATE
--echo **
--disable_view_protocol
#connect (thread1, localhost, mysqltest,,);
connection thread1;
--echo ** Set up table
@@ -378,7 +380,6 @@ drop table t1;
begin;
--echo ** Starting SELECT .. FOR UPDATE
select * from t1 where tipo=2 FOR UPDATE;

connection thread1;
--echo
--echo ** Starting new transaction on thread 1
@@ -448,14 +449,15 @@ drop table t1;
--echo ** Begin a new transaction on thread 2
begin;
select * from t1 where tipo=2 FOR UPDATE;

connection thread1;
--echo ** Begin a new transaction on thread 1
begin;
--echo ** Selecting a range for update by table scan will be blocked
--echo ** because of on-going transaction on thread 2.
--disable_view_protocol
--error ER_LOCK_WAIT_TIMEOUT
select * from t1 where tipo=1 FOR UPDATE;
select * from t1 where tipo=1 FOR UPDATE;
--enable_view_protocol

connection thread2;
--echo ** Table will be unchanged and the select command will not be
@@ -478,7 +480,7 @@ drop table t1;

connection default;
drop table t1;

--enable_view_protocol

--echo
--echo **
@@ -564,7 +566,7 @@ drop table t1;
# succeding update in the following thread. Also the used status variables '%lock%' and
# 'innodb_deleted_rows' and infos in processlist where not sucessful.
sleep 1;

--disable_view_protocol
connection thread1;
begin;
--echo ** Update on t1 will cause a table scan which will be blocked because
@@ -587,7 +589,7 @@ drop table t1;
reap;
select * from t1;
send commit;

--enable_view_protocol
connection thread1;
commit;

@@ -18,4 +18,8 @@
# Created: 2009-01-14 mleich
#

# Tests will be skipped for the view protocol because the view protocol creates
# an additional util connection and other statistics data
-- source include/no_view_protocol.inc

let $count_sessions= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1);
@@ -81,6 +81,8 @@ DROP TABLE t1;
# even if character_set_connection is big5/cp932/gbk/sjis.
# Note, the other 0x5C which is before 0xE05C is also treated as escape.
#
#check after fix MDEV-29290
--disable_view_protocol
SET character_set_client=binary, character_set_results=binary;
SELECT @@character_set_client, @@character_set_connection, @@character_set_results;
SELECT HEX('à\['), HEX('\à\[');
@@ -105,7 +107,7 @@ SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('à\['),('\à\[');
SELECT HEX(a) FROM t1;
DROP TABLE t1;
--enable_view_protocol
--echo # Start of ctype_E05C.inc
@@ -67,10 +67,12 @@ drop table t1;
--echo #
--echo # MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
--echo #
--disable_service_connection
SET character_set_client=latin1;
SET character_set_connection= @test_character_set;
SET collation_connection= @test_collation;
SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1;
--enable_service_connection

#
# Bug#27580 SPACE() function collation bug?
@@ -18,6 +18,8 @@ SET time_zone=default;

# TODO: remove "--disable_ps_protocol" when MDEV-5444 is fixed
--disable_ps_protocol
#remove "--disable_view_protocol" in 10.6 version
--disable_view_protocol
SELECT CHARSET('2013-11-15 00:41:28' - INTERVAL 7 DAY);
SELECT COERCIBILITY('2013-11-15 00:41:28' - INTERVAL 7 DAY);
SELECT CHARSET(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY);
@@ -55,3 +57,4 @@ SELECT * FROM t1 WHERE t = CONCAT('2001-01-08 00:00:00',LEFT(RAND(),0)) - INTERV
SELECT * FROM t1 WHERE t < TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY;
SELECT * FROM t1 WHERE t = TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY;
DROP TABLE t1;
--enable_view_protocol
@@ -46,14 +46,16 @@ INSERT INTO t1 VALUES (_latin1 0x9C), (_latin1 0x8C);
#
# Check order
#
#enable after fix MDEV-29290
--disable_view_protocol
select s1, hex(s1) from t1 order by s1, binary s1;
select group_concat(s1 order by binary s1) from t1 group by s1;

SELECT s1, hex(s1), hex(weight_string(s1)) FROM t1 ORDER BY s1, BINARY(s1);
SELECT s1, hex(s1) FROM t1 WHERE s1='ae' ORDER BY s1, BINARY(s1);

drop table t1;

--enable_view_protocol

#
# Check filesort for 'S' and "U+00DF SHARP S",
@@ -17,9 +17,12 @@ INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));

#check after fix MDEV-29290
--disable_view_protocol
# Check pattern (important for ucs2, utf16, utf32)
SELECT hex(concat(repeat(0xF1F2, 10), '%'));

--echo 3 rows expected
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
DROP TABLE t1;
--enable_view_protocol
@@ -1293,7 +1293,11 @@ INSERT INTO t1 (s1) VALUES
(_ucs2 0x101C1000103A10181000103A),
(_ucs2 0x101C103910181000103A /* tea */);

# enable view-protocol after fix MDEV-27871
--disable_view_protocol

SELECT id, IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) FROM t1 ORDER BY id;
--enable_view_protocol

DROP TABLE t1;

@@ -1,3 +1,7 @@
#remove this include after fix MDEV-27871
# maybe some tests need to be excluded separately after fix
--source include/no_view_protocol.inc

SET TIME_ZONE = _latin1 '+03:00';

--echo #
@@ -1631,6 +1635,7 @@ SELECT charset(@x), collation(@x);
--echo #
--echo # Bug#54916 GROUP_CONCAT + IFNULL truncates output
--echo #

SELECT @@collation_connection;
# ENGINE=MYISAM is very important to make sure "SYSTEM" join type
# is in use, which will create instances of Item_copy.
@@ -52,13 +52,14 @@ DROP TABLE t1;
--echo #
--echo # IF, CASE, LEAST
--echo #

#enable after fix MDEV-27871
--disable_view_protocol
eval SELECT IF('abc' COLLATE $coll = 'abc ', 'pad', 'nopad');
eval SELECT CASE 'abc' COLLATE $coll WHEN 'abc ' THEN 'pad' ELSE 'nopad' END;
eval SELECT CASE WHEN 'abc' COLLATE $coll = 'abc ' THEN 'pad' ELSE 'nopad' END;
eval SELECT HEX(LEAST('abc ' COLLATE $coll, 'abc '));
eval SELECT HEX(GREATEST('abc ' COLLATE $coll, 'abc '));

--enable_view_protocol
--echo #
--echo # Collation mix
--echo #
@@ -3,7 +3,10 @@
--echo #

SELECT @@character_set_connection, HEX(CAST(_utf8'÷' AS CHAR));
# enable view-protocol after fix MDEV-27871
--disable_view_protocol
SELECT STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR));
--enable_view_protocol
CREATE TABLE t1 AS SELECT REPEAT(' ', 64) AS subject, REPEAT(' ',64) AS pattern LIMIT 0;
SHOW COLUMNS FROM t1;
INSERT INTO t1 VALUES (_utf8'2001÷01÷01',_utf8'%Y÷%m÷%d');
@@ -309,12 +309,15 @@ CALL p2();
--disable_warnings
# All records marked with '[BAD]' mean that the string was unescaped
# in a unexpected way, that means there is a bug in UNESCAPE() above.
#check after fix MDEV-29290
--disable_view_protocol
SELECT HEX(a),HEX(b),
CONCAT(unescape_type(a,b),
wellformedness(a,b),
mysql_real_escape_string_generated(a),
IF(UNESCAPE(a)<>b,CONCAT('[BAD',HEX(UNESCAPE(a)),']'),'')) AS comment
FROM t1 ORDER BY LENGTH(a),a;
--enable_view_protocol
--enable_warnings
DROP TABLE t1;
DROP PROCEDURE p1;
@@ -1,6 +1,12 @@
#
# Tests with the utf8mb4 character set
#

# Tests will be skipped for the view protocol because the view protocol uses
# an additional util connection and don't use for this nessesary configurations
# Also need to resolve MDEV-27871
-- source include/no_view_protocol.inc

--source include/default_optimizer_switch.inc
--disable_warnings
drop table if exists t1,t2;
@@ -9,7 +9,7 @@
# old name was t/innodb-deadlock.test
# main code went into include/deadlock.inc
#

--disable_service_connection
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);

@@ -20,7 +20,7 @@ drop table if exists t1,t2;
#
# Testing of FOR UPDATE
#

--disable_view_protocol
connection con1;
eval create table t1 (id integer, x integer) engine = $engine_type;
insert into t1 values(0, 0);
@@ -49,10 +49,11 @@ select * from t1;
commit;

drop table t1;
--enable_view_protocol
#
# Testing of FOR UPDATE
#

--disable_view_protocol
connection con1;
eval create table t1 (id integer, x integer) engine = $engine_type;
eval create table t2 (b integer, a integer) engine = $engine_type;
@@ -125,7 +126,7 @@ connection default;
disconnect con1;
disconnect con2;
drop table t1, t2;

--enable_view_protocol
--echo End of 4.1 tests

#
@@ -152,3 +153,4 @@ drop table if exists a;
set storage_engine=default;

--echo End of 5.0 tests.
--enable_service_connection
@@ -4,6 +4,12 @@ SET SESSION character_set_client=cp1250;
--echo #
--echo # Test litteral
--echo #

#enable view protocol after fix MDEV-27871 and
# it is necessary that the view protocol uses the same connection,
# not util connection
--disable_view_protocol

SET sql_mode=@mode;
select @@sql_mode;
SELECT '',CHARSET(''), null, CHARSET(null), CAST(null as char(10)), CHARSET(CAST(null as char(10))), 'x', CHARSET('x');
@@ -12,6 +18,8 @@ SET sql_mode=default;
SELECT '',CHARSET(''), null, CHARSET(null), CAST(null as char(10)), CHARSET(CAST(null as char(10))), 'x', CHARSET('x');
SELECT CHARSET(NULLIF('','')),NULLIF('','');



--echo #
--echo # Test NCHAR litteral
--echo #
@@ -22,6 +30,8 @@ SET sql_mode=default;
SELECT N'',CHARSET(N''), N'x', CHARSET(N'x');
SELECT CHARSET(NULLIF(N'',N'')),NULLIF(N'',N'');



--echo #
--echo # Test CHARSET prefix litteral
--echo #
@@ -52,6 +62,8 @@ SELECT '' '' '',CHARSET('' '' '');
SELECT _latin1'' '' '',CHARSET(_latin1'' '' '');
SELECT N'' '' '',CHARSET(N'' '' '');

--enable_view_protocol

--echo #
--echo # UNION - implicit group by
--echo #
@@ -70,10 +82,16 @@ UNION
SELECT 1 , _cp1250 ''
ORDER BY 1;

# it is necessary that the view protocol uses the same connection,
# not util connection
--disable_view_protocol

SELECT NULLIF(_cp1250 '',_cp1250 '')
UNION
SELECT NULLIF(N'',N'');

--enable_view_protocol

--error ER_CANT_AGGREGATE_2COLLATIONS
SELECT 1 , _latin2 ''
UNION
@@ -26,7 +26,7 @@
--echo # query: $query
--echo # select: $select
--echo #

--disable_view_protocol
if ($select) {
--disable_query_log
--eval $select INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/before_explain.txt'
@@ -159,3 +159,4 @@ SHOW STATUS WHERE (Variable_name LIKE 'Sort%' OR
--enable_query_log

--echo
--enable_view_protocol
@@ -1,5 +1,7 @@
# "mtr --ps" returns different values in "Max length"
--disable_ps_protocol
# view protocol createincorrect table name
--disable_view_protocol
--enable_metadata
--vertical_results
SELECT
@@ -39,6 +41,7 @@ FROM t1;
--horizontal_results
--disable_metadata
--enable_ps_protocol
--enable_view_protocol
CREATE TABLE t2 AS
SELECT
a AS ___________a,

0 comments on commit 72ba96a

Please sign in to comment.