summaryrefslogtreecommitdiff
path: root/mysql-test/suite/rpl/t/rpl_autogen_query_multi_byte_char.test
blob: a93fcbac82feebf4f549baf7cda43ea3c7bcac55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
###############################################################################
# Bug#21205695 DROP TABLE MAY CAUSE SLAVES TO BREAK
#
# Problem:
# ========
# 1) Drop table queries are re-generated by server
#    before writing the events(queries) into binlog
#    for various reasons. If table name/db name contains
#    a non regular characters (like latin characters),
#    the generated query is wrong. Hence it breaks the
#    replication.
# 2) In the edge case, when table name contains
#    64 latin characters (latin takes 2 bytes), server is
#    throwing an assert (M_TBLLEN < 128)
#
# 3) In the edge case, when db name contains 64 latin
#    characters, binlog contents are interpreted wrongly
#    which is leading to replication issues.
#
###############################################################################

--source include/not_windows.inc
--source include/master-slave.inc

--let iter=1
# Change iteration to 4 after fixing Bug #22280214
while ($iter <= 2)
{
  --connection master
  if ($iter == 1)
  {
    --echo Test case 1:- table name with one character latin name.
    --let $tblname= REPEAT(CHAR(131),1)
  }
  if ($iter == 2)
  {
    --echo Test case 2:- table name and database names with one character latin name.
    --let $tblname= REPEAT(CHAR(131),1),"`.`",REPEAT(CHAR(131),1)
    --eval SET @s:=CONCAT("CREATE DATABASE `",REPEAT(CHAR(131),1),"`")
    PREPARE STMT FROM @s; EXECUTE stmt;
  }
  # After fixing Bug #22280214 DATADIR LOCATION IS LIMITING
  # IDENTIFIER MAX LENGTH,  the following two tests (iter 3 and 4) can be
  # uncommented.
  #if ($iter == 3)
  #{
    # --echo Test case 3:- table name and database names with 64 latin characters name.
    # --let $tblname= REPEAT(CHAR(131),64),"`.`", REPEAT(CHAR(131),64)
    # --eval SET @s:=CONCAT("CREATE DATABASE `",REPEAT(CHAR(131),64),"`")
    # PREPARE STMT FROM @s; EXECUTE stmt;
  #}
  #if ($iter == 4)
  #{
    # --echo Test case 4:- table name and database names with 64 Euro(€) characters.
    # --let $tblname= REPEAT(CHAR(226,130,172),64),"`.`", REPEAT(CHAR(226,130,172),64)
    # --eval SET @s:=CONCAT("CREATE DATABASE `",REPEAT(CHAR(226,130,172),64),"`")
    # PREPARE STMT FROM @s; EXECUTE stmt;
  #}
  --eval SET @s:=CONCAT("CREATE TABLE `",$tblname,"` (a INT)")
  PREPARE STMT FROM @s; EXECUTE stmt;
  --eval SET @s:=CONCAT("INSERT INTO `",$tblname,"` VALUES (1)")
  PREPARE STMT FROM @s; EXECUTE stmt;
  --eval SET @s:=CONCAT("DROP TABLE `",$tblname, "`")
  PREPARE STMT FROM @s; EXECUTE stmt;
  if ($iter == 2)
  {
    --eval SET @s:=CONCAT("DROP DATABASE `",REPEAT(CHAR(131),1),"`")
    PREPARE STMT FROM @s; EXECUTE stmt;
  }
  # After fixing Bug #22280214 DATADIR LOCATION IS LIMITING
  # IDENTIFIER MAX LENGTH, the following two tests (iter 3 and 4) can be
  # uncommented.
  #if ($iter == 3)
  #{
     # --eval SET @s:=CONCAT("DROP DATABASE `",REPEAT(CHAR(131),64),"`")
     # PREPARE STMT FROM @s; EXECUTE stmt;
  #}
  #if ($iter == 4)
  #{
     # --eval SET @s:=CONCAT("DROP DATABASE `",REPEAT(CHAR(226,130,172),64),"`")
     # PREPARE STMT FROM @s; EXECUTE stmt;
  #}
  --sync_slave_with_master
  --inc $iter
}

--source include/rpl_end.inc