Merge lthalmann@bk-internal.mysql.com:/home/bk/mysql-5.1-build

into  mysql.com:/nfsdisk1/lars/MERGE/mysql-5.1-merge
This commit is contained in:
unknown 2007-06-11 16:47:50 +02:00
commit b0a140c197
54 changed files with 22436 additions and 92 deletions

View File

@ -296,10 +296,11 @@ extern CHARSET_INFO my_charset_tis620_thai_ci;
extern CHARSET_INFO my_charset_tis620_bin;
extern CHARSET_INFO my_charset_ucs2_general_ci;
extern CHARSET_INFO my_charset_ucs2_bin;
extern CHARSET_INFO my_charset_ucs2_general_uca;
extern CHARSET_INFO my_charset_ucs2_unicode_ci;
extern CHARSET_INFO my_charset_ujis_japanese_ci;
extern CHARSET_INFO my_charset_ujis_bin;
extern CHARSET_INFO my_charset_utf8_general_ci;
extern CHARSET_INFO my_charset_utf8_unicode_ci;
extern CHARSET_INFO my_charset_utf8_bin;
extern CHARSET_INFO my_charset_cp1250_czech_ci;
extern CHARSET_INFO my_charset_filename;

View File

@ -62,6 +62,7 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/include/*.test $(distdir)/include
$(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/Index.xml $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.000001 $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data
@ -106,6 +107,7 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/Index.xml $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.frm $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(DESTDIR)$(testdir)/std_data

View File

@ -362,7 +362,8 @@ sub mtr_report_stats ($) {
# Special case, made as specific as possible, for:
# Bug #28436: Incorrect position in SHOW BINLOG EVENTS causes
# server coredump
/\QError in Log_event::read_log_event(): 'Sanity check failed', data_len: 258, event_type: 49\E/
/\QError in Log_event::read_log_event(): 'Sanity check failed', data_len: 258, event_type: 49\E/ or
/Statement is not safe to log in statement format/
)
{
next; # Skip these lines

View File

@ -0,0 +1,13 @@
SET BINLOG_FORMAT=STATEMENT;
CREATE TABLE t1 (a CHAR(40));
CREATE TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE t3 (b INT AUTO_INCREMENT PRIMARY KEY);
CREATE VIEW v1(a,b) AS SELECT a,b FROM t2,t3;
INSERT INTO t1 SELECT UUID();
Warnings:
Warning 1588 Statement is not safe to log in statement format.
SHOW WARNINGS;
Level Warning
Code 1588
Message Statement is not safe to log in statement format.
DROP TABLE t1,t2,t3;

View File

@ -1,4 +1,5 @@
drop table if exists t1;
drop table if exists t1,t2;
drop view if exists v1;
create table t1(n int not null, key(n), key(n), key(n), key(n));
check table t1 extended;
insert into t1 values (200000);

View File

@ -192,3 +192,16 @@ drop table t1;
select hex(convert(_big5 0xC84041 using ucs2));
hex(convert(_big5 0xC84041 using ucs2))
003F0041
End of 4.1 tests
create table t1 (a blob);
insert into t1 values (0xEE00);
delete from t1;
select hex(load_file('test/t1.txt'));
hex(load_file('test/t1.txt'))
5CEE5C300A
load data infile 't1.txt' into table t1;
select hex(a) from t1;
hex(a)
EE00
drop table t1;
End of 5.0 tests

View File

@ -0,0 +1,296 @@
drop table if exists t1;
set names utf8;
show variables like 'character_sets_dir%';
Variable_name Value
character_sets_dir MYSQL_TEST_DIR/std_data/
show collation like 'utf8_test_ci';
Collation Charset Id Default Compiled Sortlen
utf8_test_ci utf8 240 8
create table t1 (c1 char(1) character set utf8 collate utf8_test_ci);
insert into t1 values ('a');
select * from t1 where c1='b';
c1
a
drop table t1;
show collation like 'ucs2_test_ci';
Collation Charset Id Default Compiled Sortlen
ucs2_test_ci ucs2 241 8
create table t1 (c1 char(1) character set ucs2 collate ucs2_test_ci);
insert into t1 values ('a');
select * from t1 where c1='b';
c1
a
drop table t1;
show collation like 'ucs2_vn_ci';
Collation Charset Id Default Compiled Sortlen
ucs2_vn_ci ucs2 242 8
create table t1 (c1 char(1) character set ucs2 collate ucs2_vn_ci);
insert into t1 values (0x0061),(0x0041),(0x00E0),(0x00C0),(0x1EA3),(0x1EA2),
(0x00E3),(0x00C3),(0x00E1),(0x00C1),(0x1EA1),(0x1EA0);
insert into t1 values (0x0103),(0x0102),(0x1EB1),(0x1EB0),(0x1EB3),(0x1EB2),
(0x1EB5),(0x1EB4),(0x1EAF),(0x1EAE),(0x1EB7),(0x1EB6);
insert into t1 values (0x00E2),(0x00C2),(0x1EA7),(0x1EA6),(0x1EA9),(0x1EA8),
(0x1EAB),(0x1EAA),(0x1EA5),(0x1EA4),(0x1EAD),(0x1EAC);
insert into t1 values ('b'),('B'),('c'),('C');
insert into t1 values ('d'),('D'),(0x0111),(0x0110);
insert into t1 values (0x0065),(0x0045),(0x00E8),(0x00C8),(0x1EBB),(0x1EBA),
(0x1EBD),(0x1EBC),(0x00E9),(0x00C9),(0x1EB9),(0x1EB8);
insert into t1 values (0x00EA),(0x00CA),(0x1EC1),(0x1EC0),(0x1EC3),(0x1EC2),
(0x1EC5),(0x1EC4),(0x1EBF),(0x1EBE),(0x1EC7),(0x1EC6);
insert into t1 values ('g'),('G'),('h'),('H');
insert into t1 values (0x0069),(0x0049),(0x00EC),(0x00CC),(0x1EC9),(0x1EC8),
(0x0129),(0x0128),(0x00ED),(0x00CD),(0x1ECB),(0x1ECA);
insert into t1 values ('k'),('K'),('l'),('L'),('m'),('M');
insert into t1 values (0x006F),(0x004F),(0x00F2),(0x00D2),(0x1ECF),(0x1ECE),
(0x00F5),(0x00D5),(0x00F3),(0x00D3),(0x1ECD),(0x1ECC);
insert into t1 values (0x00F4),(0x00D4),(0x1ED3),(0x1ED2),(0x1ED5),(0x1ED4),
(0x1ED7),(0x1ED6),(0x1ED1),(0x1ED0),(0x1ED9),(0x1ED8);
insert into t1 values (0x01A1),(0x01A0),(0x1EDD),(0x1EDC),(0x1EDF),(0x1EDE),
(0x1EE1),(0x1EE0),(0x1EDB),(0x1EDA),(0x1EE3),(0x1EE2);
insert into t1 values ('p'),('P'),('q'),('Q'),('r'),('R'),('s'),('S'),('t'),('T');
insert into t1 values (0x0075),(0x0055),(0x00F9),(0x00D9),(0x1EE7),(0x1EE6),
(0x0169),(0x0168),(0x00FA),(0x00DA),(0x1EE5),(0x1EE4);
insert into t1 values (0x01B0),(0x01AF),(0x1EEB),(0x1EEA),(0x1EED),(0x1EEC),
(0x1EEF),(0x1EEE),(0x1EE9),(0x1EE8),(0x1EF1),(0x1EF0);
insert into t1 values ('v'),('V'),('x'),('X');
insert into t1 values (0x0079),(0x0059),(0x1EF3),(0x1EF2),(0x1EF7),(0x1EF6),
(0x1EF9),(0x1EF8),(0x00FD),(0x00DD),(0x1EF5),(0x1EF4);
select hex(c1) as h, c1 from t1 order by c1, h;
h c1
0041 A
0061 a
00C0 À
00C1 Á
00C3 Ã
00E0 à
00E1 á
00E3 ã
1EA0 Ạ
1EA1 ạ
1EA2 Ả
1EA3 ả
0102 Ă
0103 ă
1EAE Ắ
1EAF ắ
1EB0 Ằ
1EB1 ằ
1EB2 Ẳ
1EB3 ẳ
1EB4 Ẵ
1EB5 ẵ
1EB6 Ặ
1EB7 ặ
00C2 Â
00E2 â
1EA4 Ấ
1EA5 ấ
1EA6 Ầ
1EA7 ầ
1EA8 Ẩ
1EA9 ẩ
1EAA Ẫ
1EAB ẫ
1EAC Ậ
1EAD ậ
0042 B
0062 b
0043 C
0063 c
0044 D
0064 d
0110 Đ
0111 đ
0045 E
0065 e
00C8 È
00C9 É
00E8 è
00E9 é
1EB8 Ẹ
1EB9 ẹ
1EBA Ẻ
1EBB ẻ
1EBC Ẽ
1EBD ẽ
00CA Ê
00EA ê
1EBE Ế
1EBF ế
1EC0 Ề
1EC1 ề
1EC2 Ể
1EC3 ể
1EC4 Ễ
1EC5 ễ
1EC6 Ệ
1EC7 ệ
0047 G
0067 g
0048 H
0068 h
0049 I
0069 i
00CC Ì
00CD Í
00EC ì
00ED í
0128 Ĩ
0129 ĩ
1EC8 Ỉ
1EC9 ỉ
1ECA Ị
1ECB ị
004B K
006B k
004C L
006C l
004D M
006D m
004F O
006F o
00D2 Ò
00D3 Ó
00D5 Õ
00F2 ò
00F3 ó
00F5 õ
1ECC Ọ
1ECD ọ
1ECE Ỏ
1ECF ỏ
00D4 Ô
00F4 ô
1ED0 Ố
1ED1 ố
1ED2 Ồ
1ED3 ồ
1ED4 Ổ
1ED5 ổ
1ED6 Ỗ
1ED7 ỗ
1ED8 Ộ
1ED9 ộ
01A0 Ơ
01A1 ơ
1EDA Ớ
1EDB ớ
1EDC Ờ
1EDD ờ
1EDE Ở
1EDF ở
1EE0 Ỡ
1EE1 ỡ
1EE2 Ợ
1EE3 ợ
0050 P
0070 p
0051 Q
0071 q
0052 R
0072 r
0053 S
0073 s
0054 T
0074 t
0055 U
0075 u
00D9 Ù
00DA Ú
00F9 ù
00FA ú
0168 Ũ
0169 ũ
1EE4 Ụ
1EE5 ụ
1EE6 Ủ
1EE7 ủ
01AF Ư
01B0 ư
1EE8 Ứ
1EE9 ứ
1EEA Ừ
1EEB ừ
1EEC Ử
1EED ử
1EEE Ữ
1EEF ữ
1EF0 Ự
1EF1 ự
0056 V
0076 v
0058 X
0078 x
0059 Y
0079 y
00DD Ý
00FD ý
1EF2 Ỳ
1EF3 ỳ
1EF4 Ỵ
1EF5 ỵ
1EF6 Ỷ
1EF7 ỷ
1EF8 Ỹ
1EF9 ỹ
select group_concat(hex(c1) order by hex(c1)) from t1 group by c1;
group_concat(hex(c1) order by hex(c1))
0041,0061,00C0,00C1,00C3,00E0,00E1,00E3,1EA0,1EA1,1EA2,1EA3
0102,0103,1EAE,1EAF,1EB0,1EB1,1EB2,1EB3,1EB4,1EB5,1EB6,1EB7
00C2,00E2,1EA4,1EA5,1EA6,1EA7,1EA8,1EA9,1EAA,1EAB,1EAC,1EAD
0042,0062
0043,0063
0044,0064
0110,0111
0045,0065,00C8,00C9,00E8,00E9,1EB8,1EB9,1EBA,1EBB,1EBC,1EBD
00CA,00EA,1EBE,1EBF,1EC0,1EC1,1EC2,1EC3,1EC4,1EC5,1EC6,1EC7
0047,0067
0048,0068
0049,0069,00CC,00CD,00EC,00ED,0128,0129,1EC8,1EC9,1ECA,1ECB
004B,006B
004C,006C
004D,006D
004F,006F,00D2,00D3,00D5,00F2,00F3,00F5,1ECC,1ECD,1ECE,1ECF
00D4,00F4,1ED0,1ED1,1ED2,1ED3,1ED4,1ED5,1ED6,1ED7,1ED8,1ED9
01A0,01A1,1EDA,1EDB,1EDC,1EDD,1EDE,1EDF,1EE0,1EE1,1EE2,1EE3
0050,0070
0051,0071
0052,0072
0053,0073
0054,0074
0055,0075,00D9,00DA,00F9,00FA,0168,0169,1EE4,1EE5,1EE6,1EE7
01AF,01B0,1EE8,1EE9,1EEA,1EEB,1EEC,1EED,1EEE,1EEF,1EF0,1EF1
0056,0076
0058,0078
0059,0079,00DD,00FD,1EF2,1EF3,1EF4,1EF5,1EF6,1EF7,1EF8,1EF9
select group_concat(c1 order by hex(c1) SEPARATOR '') from t1 group by c1;
group_concat(c1 order by hex(c1) SEPARATOR '')
AaÀÁÃàáãẠạẢả
ĂăẮắẰằẲẳẴẵẶặ
ÂâẤấẦầẨẩẪẫẬậ
Bb
Cc
Dd
Đđ
EeÈÉèéẸẹẺẻẼẽ
ÊêẾếỀềỂểỄễỆệ
Gg
Hh
IiÌÍìíĨĩỈỉỊị
Kk
Ll
Mm
OoÒÓÕòóõỌọỎỏ
ÔôỐốỒồỔổỖỗỘộ
ƠơỚớỜờỞởỠỡỢợ
Pp
Qq
Rr
Ss
Tt
UuÙÚùúŨũỤụỦủ
ƯưỨứỪừỬửỮữỰự
Vv
Xx
YyÝýỲỳỴỵỶỷỸỹ
drop table t1;

File diff suppressed because it is too large Load Diff

View File

@ -1086,6 +1086,39 @@ n d
1 30
2 20
drop table t1,t2;
CREATE TABLE `t1` (
`a` int(11) NOT NULL auto_increment,
`b` int(11) default NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
CREATE TABLE `t2` (
`a` int(11) NOT NULL auto_increment,
`b` int(11) default NULL,
PRIMARY KEY (`a`)
) ENGINE=INNODB DEFAULT CHARSET=latin1 ;
insert into t1 values (1,1),(2,2);
insert into t2 values (1,1),(4,4);
reset master;
UPDATE t2,t1 SET t2.a=t1.a+2;
ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
select * from t2 /* must be (3,1), (4,4) */;
a b
1 1
4 4
show master status /* there must no UPDATE in binlog */;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 106
delete from t1;
delete from t2;
insert into t1 values (1,2),(3,4),(4,4);
insert into t2 values (1,2),(3,4),(4,4);
reset master;
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
show master status /* there must be no UPDATE query event */;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 106
drop table t1, t2;
create table t1 (a int, b int) engine=innodb;
insert into t1 values(20,null);
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
@ -1775,13 +1808,13 @@ Variable_name Value
Innodb_page_size 16384
show status like "Innodb_rows_deleted";
Variable_name Value
Innodb_rows_deleted 2070
Innodb_rows_deleted 2072
show status like "Innodb_rows_inserted";
Variable_name Value
Innodb_rows_inserted 3083
Innodb_rows_inserted 3088
show status like "Innodb_rows_updated";
Variable_name Value
Innodb_rows_updated 886
Innodb_rows_updated 888
show status like "Innodb_row_lock_waits";
Variable_name Value
Innodb_row_lock_waits 0

View File

@ -604,3 +604,38 @@ id c1 c2
2 test t ppc
9 abc ppc
drop table t1, t2;
CREATE TABLE `t1` (
`a` int(11) NOT NULL auto_increment,
`b` int(11) default NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
CREATE TABLE `t2` (
`a` int(11) NOT NULL auto_increment,
`b` int(11) default NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
set @@session.binlog_format= mixed;
insert into t1 values (1,1),(2,2);
insert into t2 values (1,1),(4,4);
reset master;
UPDATE t2,t1 SET t2.a=t1.a+2;
ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
select * from t2 /* must be (3,1), (4,4) */;
a b
3 1
4 4
show master status /* there must be the UPDATE query event */;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 197
delete from t1;
delete from t2;
insert into t1 values (1,2),(3,4),(4,4);
insert into t2 values (1,2),(3,4),(4,4);
reset master;
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
show master status /* there must be the UPDATE query event */;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 212
drop table t1, t2;
end of tests

View File

@ -0,0 +1,451 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
USE test;
DROP VIEW IF EXISTS v1,v11;
DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p11;
DROP FUNCTION IF EXISTS f1;
DROP FUNCTION IF EXISTS f2;
DROP EVENT IF EXISTS e1;
DROP EVENT IF EXISTS e11;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=myisam;
INSERT INTO t1 VALUES (1,1,'1');
INSERT INTO t1 VALUES (2,2,UUID());
CREATE TABLE t2 (a INT, b INT, c VARCHAR(64)) ENGINE=myisam;
INSERT INTO t2 VALUES (1,1,'1');
INSERT INTO t2 VALUES (2,2,UUID());
CREATE TABLE t11 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=innodb;
INSERT INTO t11 VALUES (1,1,'1');
INSERT INTO t11 VALUES (2,2,UUID());
CREATE TABLE t12 (a INT, b INT, c VARCHAR(64)) ENGINE=innodb;
INSERT INTO t12 VALUES (1,1,'1');
INSERT INTO t12 VALUES (2,2,UUID());
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE VIEW v11 AS SELECT * FROM t11;
CREATE TRIGGER t1_tr1 BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
INSERT INTO t2 VALUES (NEW.a, NEW.b, NEW.c);
INSERT INTO t3 VALUES (NEW.a, NEW.b, NEW.c);
END|
CREATE TRIGGER t1_tr2 BEFORE UPDATE ON t1 FOR EACH ROW
BEGIN
UPDATE t2 SET c = '';
UPDATE t3 SET c = '';
END|
CREATE TRIGGER t11_tr1 BEFORE INSERT ON t11 FOR EACH ROW
BEGIN
INSERT INTO t12 VALUES (NEW.a, NEW.b, NEW.c);
INSERT INTO t13 VALUES (NEW.a, NEW.b, NEW.c);
END|
CREATE TRIGGER t11_tr2 BEFORE UPDATE ON t11 FOR EACH ROW
BEGIN
UPDATE t12 SET c = '';
UPDATE t13 SET c = '';
END|
CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND ENABLE DO
BEGIN
DECLARE c INT;
SELECT a INTO c FROM t1 WHERE a < 11 ORDER BY a DESC LIMIT 1;
IF c = 7 THEN
CALL p1(10, '');
END IF;
END|
CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND ENABLE DO
BEGIN
DECLARE c INT;
SELECT a INTO c FROM t11 WHERE a < 11 ORDER BY a DESC LIMIT 1;
IF c = 7 THEN
CALL p11(10, '');
END IF;
END|
CREATE FUNCTION f1 (x INT) RETURNS VARCHAR(64)
BEGIN
IF x > 5 THEN
RETURN UUID();
END IF;
RETURN '';
END|
CREATE FUNCTION f2 (x INT) RETURNS VARCHAR(64)
BEGIN
RETURN f1(x);
END|
CREATE PROCEDURE p1 (IN x INT, IN y VARCHAR(64))
BEGIN
INSERT INTO t1 VALUES (x,x,y);
END|
CREATE PROCEDURE p11 (IN x INT, IN y VARCHAR(64))
BEGIN
INSERT INTO t11 VALUES (x,x,y);
END|
CREATE TABLE t3 SELECT * FROM v1;
INSERT INTO t1 VALUES (3,3,'');
UPDATE t1 SET c='2' WHERE a = 1;
INSERT INTO t1 VALUES(4,4,f1(4));
INSERT INTO t1 VALUES (100,100,'');
CALL p1(5, UUID());
INSERT INTO t1 VALUES (101,101,'');
INSERT INTO t1 VALUES(6,6,f1(6));
INSERT INTO t1 VALUES (102,102,'');
INSERT INTO t1 VALUES(7,7,f2(7));
INSERT INTO t1 VALUES (103,103,'');
CREATE TABLE t13 SELECT * FROM v11;
INSERT INTO t11 VALUES (3,3,'');
UPDATE t11 SET c='2' WHERE a = 1;
INSERT INTO t11 VALUES(4,4,f1(4));
INSERT INTO t11 VALUES (100,100,'');
CALL p11(5, UUID());
INSERT INTO t11 VALUES (101,101,'');
INSERT INTO t11 VALUES(6,6,f1(6));
INSERT INTO t11 VALUES (102,102,'');
INSERT INTO t11 VALUES(7,7,f2(7));
INSERT INTO t11 VALUES (103,103,'');
SET GLOBAL EVENT_SCHEDULER = on;
SET GLOBAL EVENT_SCHEDULER = off;
SHOW TABLES LIKE 't%';
Tables_in_test (t%)
t1
t11
t12
t13
t2
t3
SELECT table_name FROM information_schema.views WHERE table_schema='test';
table_name
v1
v11
SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test';
trigger_name event_manipulation event_object_table
t1_tr1 INSERT t1
t1_tr2 UPDATE t1
t11_tr1 INSERT t11
t11_tr2 UPDATE t11
SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test';
routine_type routine_name
FUNCTION f1
FUNCTION f2
PROCEDURE p1
PROCEDURE p11
SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
event_name status
e1 ENABLED
e11 ENABLED
SELECT COUNT(*) FROM t1;
COUNT(*)
12
SELECT a,b FROM t1 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t2;
COUNT(*)
12
SELECT a,b FROM t2 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t3;
COUNT(*)
12
SELECT a,b FROM t3 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT a,b FROM v1 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t11;
COUNT(*)
12
SELECT a,b FROM t11 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t12;
COUNT(*)
12
SELECT a,b FROM t12 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t13;
COUNT(*)
12
SELECT a,b FROM t13 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT a,b FROM v11 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SHOW TABLES LIKE 't%';
Tables_in_test (t%)
t1
t11
t12
t13
t2
t3
SELECT table_name FROM information_schema.views WHERE table_schema='test';
table_name
v1
v11
SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test';
trigger_name event_manipulation event_object_table
t1_tr1 INSERT t1
t1_tr2 UPDATE t1
t11_tr1 INSERT t11
t11_tr2 UPDATE t11
SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test';
routine_type routine_name
FUNCTION f1
FUNCTION f2
PROCEDURE p1
PROCEDURE p11
SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
event_name status
e1 SLAVESIDE_DISABLED
e11 SLAVESIDE_DISABLED
SELECT COUNT(*) FROM t1;
COUNT(*)
12
SELECT a,b FROM t1 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t2;
COUNT(*)
12
SELECT a,b FROM t2 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t3;
COUNT(*)
12
SELECT a,b FROM t3 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT a,b FROM v1 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t11;
COUNT(*)
12
SELECT a,b FROM t11 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t12;
COUNT(*)
12
SELECT a,b FROM t12 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT COUNT(*) FROM t13;
COUNT(*)
12
SELECT a,b FROM t13 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
SELECT a,b FROM v11 ORDER BY a;
a b
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 10
100 100
101 101
102 102
103 103
UPDATE t1 SET c='';
UPDATE t2 SET c='';
UPDATE t3 SET c='';
UPDATE t11 SET c='';
UPDATE t12 SET c='';
UPDATE t13 SET c='';
DROP VIEW IF EXISTS v1,v11;
DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p11;
DROP FUNCTION IF EXISTS f1;
DROP FUNCTION IF EXISTS f2;
DROP EVENT IF EXISTS e1;
DROP EVENT IF EXISTS e11;

View File

@ -218,3 +218,27 @@ k HEX(a) HEX(b)
2 0 8
**** On Master ****
DROP TABLE IF EXISTS t1_myisam, t1_innodb, t2_myisam, t2_innodb;
drop table if exists t1, t2;
CREATE TABLE `t1` (
`a` int(11) NOT NULL auto_increment,
`b` int(11) default NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
CREATE TABLE `t2` (
`a` int(11) NOT NULL auto_increment,
`b` int(11) default NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
insert into t1 values (1,1),(2,2);
insert into t2 values (1,1),(4,4);
UPDATE t2,t1 SET t2.a=t1.a+2;
ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
select * from t2 /* must be (3,1), (4,4) */;
a b
3 1
4 4
select * from t2 /* must be (3,1), (4,4) */;
a b
3 1
4 4
drop table t1,t2;

View File

@ -0,0 +1,136 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
**** On Slave ****
STOP SLAVE;
**** On Master ****
SET SESSION BINLOG_FORMAT=ROW;
CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (c INT, d INT);
INSERT INTO t1 VALUES (1,1),(2,4),(3,9);
INSERT INTO t2 VALUES (1,1),(2,8),(3,27);
UPDATE t1,t2 SET b = d, d = b * 2 WHERE a = c;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b INT)
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (c INT, d INT)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Update_rows # # table_id: #
master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
SELECT * FROM t1;
a b
1 1
2 8
3 27
SELECT * FROM t2;
c d
1 2
2 16
3 54
**** On Slave ****
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=484;
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 714
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 484
Relay_Log_Space #
Until_Condition Master
Until_Log_File master-bin.000001
Until_Log_Pos 484
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
SELECT * FROM t1;
a b
1 1
2 4
3 9
SELECT * FROM t2;
c d
1 1
2 8
3 27
STOP SLAVE;
RESET SLAVE;
RESET MASTER;
SET SESSION BINLOG_FORMAT=STATEMENT;
SET @foo = 12;
INSERT INTO t1 VALUES(@foo, 2*@foo);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # User var # # @`foo`=12
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(@foo, 2*@foo)
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=106;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 248
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 248
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
**** On Master ****
DROP TABLE t1, t2;

View File

@ -181,12 +181,20 @@ affected rows: 2
CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
affected rows: 0
INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00));
Warnings:
Warning 1588 Statement is not safe to log in statement format.
affected rows: 1
INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00));
Warnings:
Warning 1588 Statement is not safe to log in statement format.
affected rows: 1
INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00));
Warnings:
Warning 1588 Statement is not safe to log in statement format.
affected rows: 1
INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00));
Warnings:
Warning 1588 Statement is not safe to log in statement format.
affected rows: 1
SELECT * FROM t1 ORDER BY sum;
sum price

View File

@ -0,0 +1,71 @@
<charsets>
<charset name="utf8">
<collation name="utf8_test_ci" id="240">
<rules>
<reset>a</reset>
<s>b</s>
</rules>
</collation>
</charset>
<charset name="ucs2">
<collation name="ucs2_test_ci" id="241">
<rules>
<reset>a</reset>
<s>b</s>
</rules>
</collation>
<collation name="ucs2_vn_ci" id="242">
<!-- Vietnamese experimental collation -->
<rules>
<reset>A</reset>
<p>\u0103</p><t>\u0102</t>
<s>\u1EB1</s><t>\u1EB0</t>
<s>\u1EB3</s><t>\u1EB2</t>
<s>\u1EB5</s><t>\u1EB4</t>
<s>\u1EAF</s><t>\u1EAE</t>
<s>\u1EB7</s><t>\u1EB6</t>
<p>\u00E2</p><t>\u00C2</t>
<s>\u1EA7</s><t>\u1EA6</t>
<s>\u1EA9</s><t>\u1EA8</t>
<s>\u1EAB</s><t>\u1EAA</t>
<s>\u1EA5</s><t>\u1EA4</t>
<s>\u1EAD</s><t>\u1EAC</t>
<reset>D</reset>
<p>\u0111</p><t>\u0110</t>
<reset>E</reset>
<p>\u00EA</p><t>\u00CA</t>
<s>\u1EC1</s><t>\u1EC0</t>
<s>\u1EC3</s><t>\u1EC2</t>
<s>\u1EC5</s><t>\u1EC4</t>
<s>\u1EBF</s><t>\u1EBE</t>
<s>\u1EC7</s><t>\u1EC6</t>
<reset>O</reset>
<p>\u00F4</p><t>\u00D4</t>
<s>\u1ED3</s><t>\u1ED2</t>
<s>\u1ED5</s><t>\u1ED4</t>
<s>\u1ED7</s><t>\u1ED6</t>
<s>\u1ED1</s><t>\u1ED0</t>
<s>\u1ED9</s><t>\u1ED8</t>
<p>\u01A1</p><t>\u01A0</t>
<s>\u1EDD</s><t>\u1EDC</t>
<s>\u1EDF</s><t>\u1EDE</t>
<s>\u1EE1</s><t>\u1EE0</t>
<s>\u1EDB</s><t>\u1EDA</t>
<s>\u1EE3</s><t>\u1EE2</t>
<reset>U</reset>
<p>\u01B0</p><t>\u01AF</t>
<s>\u1EEB</s><t>\u1EEA</t>
<s>\u1EED</s><t>\u1EEC</t>
<s>\u1EEF</s><t>\u1EEE</t>
<s>\u1EE9</s><t>\u1EE8</t>
<s>\u1EF1</s><t>\u1EF0</t>
</rules>
</collation>
</charset>
</charsets>

View File

@ -0,0 +1,16 @@
# Test to check that a warning is generated for unsafe statements
# executed under statement mode logging.
SET BINLOG_FORMAT=STATEMENT;
CREATE TABLE t1 (a CHAR(40));
CREATE TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE t3 (b INT AUTO_INCREMENT PRIMARY KEY);
CREATE VIEW v1(a,b) AS SELECT a,b FROM t2,t3;
INSERT INTO t1 SELECT UUID();
query_vertical SHOW WARNINGS;
DROP TABLE t1,t2,t3;

View File

@ -2,7 +2,8 @@ connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
--disable_warnings
drop table if exists t1;
drop table if exists t1,t2;
drop view if exists v1;
--enable_warnings
# Add a lot of keys to slow down check

View File

@ -63,4 +63,20 @@ drop table t1;
#
select hex(convert(_big5 0xC84041 using ucs2));
# End of 4.1 tests
--echo End of 4.1 tests
#
# Bug#26711 "binary content 0x00 sometimes becomes 0x5C 0x00 after dump/load"
#
create table t1 (a blob);
insert into t1 values (0xEE00);
--exec $MYSQL_DUMP --default-character-set=big5 -T $MYSQLTEST_VARDIR/master-data/test test t1
delete from t1;
select hex(load_file('test/t1.txt'));
load data infile 't1.txt' into table t1;
select hex(a) from t1;
--exec rm $MYSQLTEST_VARDIR/master-data/test/t1.txt
--exec rm $MYSQLTEST_VARDIR/master-data/test/t1.sql
drop table t1;
--echo End of 5.0 tests

View File

@ -0,0 +1,2 @@
--character-sets-dir=$MYSQL_TEST_DIR/std_data/

View File

@ -0,0 +1,63 @@
--source include/have_ucs2.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
set names utf8;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
show variables like 'character_sets_dir%';
show collation like 'utf8_test_ci';
create table t1 (c1 char(1) character set utf8 collate utf8_test_ci);
insert into t1 values ('a');
select * from t1 where c1='b';
drop table t1;
show collation like 'ucs2_test_ci';
create table t1 (c1 char(1) character set ucs2 collate ucs2_test_ci);
insert into t1 values ('a');
select * from t1 where c1='b';
drop table t1;
#
# Vietnamese experimental collation
#
show collation like 'ucs2_vn_ci';
create table t1 (c1 char(1) character set ucs2 collate ucs2_vn_ci);
insert into t1 values (0x0061),(0x0041),(0x00E0),(0x00C0),(0x1EA3),(0x1EA2),
(0x00E3),(0x00C3),(0x00E1),(0x00C1),(0x1EA1),(0x1EA0);
insert into t1 values (0x0103),(0x0102),(0x1EB1),(0x1EB0),(0x1EB3),(0x1EB2),
(0x1EB5),(0x1EB4),(0x1EAF),(0x1EAE),(0x1EB7),(0x1EB6);
insert into t1 values (0x00E2),(0x00C2),(0x1EA7),(0x1EA6),(0x1EA9),(0x1EA8),
(0x1EAB),(0x1EAA),(0x1EA5),(0x1EA4),(0x1EAD),(0x1EAC);
insert into t1 values ('b'),('B'),('c'),('C');
insert into t1 values ('d'),('D'),(0x0111),(0x0110);
insert into t1 values (0x0065),(0x0045),(0x00E8),(0x00C8),(0x1EBB),(0x1EBA),
(0x1EBD),(0x1EBC),(0x00E9),(0x00C9),(0x1EB9),(0x1EB8);
insert into t1 values (0x00EA),(0x00CA),(0x1EC1),(0x1EC0),(0x1EC3),(0x1EC2),
(0x1EC5),(0x1EC4),(0x1EBF),(0x1EBE),(0x1EC7),(0x1EC6);
insert into t1 values ('g'),('G'),('h'),('H');
insert into t1 values (0x0069),(0x0049),(0x00EC),(0x00CC),(0x1EC9),(0x1EC8),
(0x0129),(0x0128),(0x00ED),(0x00CD),(0x1ECB),(0x1ECA);
insert into t1 values ('k'),('K'),('l'),('L'),('m'),('M');
insert into t1 values (0x006F),(0x004F),(0x00F2),(0x00D2),(0x1ECF),(0x1ECE),
(0x00F5),(0x00D5),(0x00F3),(0x00D3),(0x1ECD),(0x1ECC);
insert into t1 values (0x00F4),(0x00D4),(0x1ED3),(0x1ED2),(0x1ED5),(0x1ED4),
(0x1ED7),(0x1ED6),(0x1ED1),(0x1ED0),(0x1ED9),(0x1ED8);
insert into t1 values (0x01A1),(0x01A0),(0x1EDD),(0x1EDC),(0x1EDF),(0x1EDE),
(0x1EE1),(0x1EE0),(0x1EDB),(0x1EDA),(0x1EE3),(0x1EE2);
insert into t1 values ('p'),('P'),('q'),('Q'),('r'),('R'),('s'),('S'),('t'),('T');
insert into t1 values (0x0075),(0x0055),(0x00F9),(0x00D9),(0x1EE7),(0x1EE6),
(0x0169),(0x0168),(0x00FA),(0x00DA),(0x1EE5),(0x1EE4);
insert into t1 values (0x01B0),(0x01AF),(0x1EEB),(0x1EEA),(0x1EED),(0x1EEC),
(0x1EEF),(0x1EEE),(0x1EE9),(0x1EE8),(0x1EF1),(0x1EF0);
insert into t1 values ('v'),('V'),('x'),('X');
insert into t1 values (0x0079),(0x0059),(0x1EF3),(0x1EF2),(0x1EF7),(0x1EF6),
(0x1EF9),(0x1EF8),(0x00FD),(0x00DD),(0x1EF5),(0x1EF4);
select hex(c1) as h, c1 from t1 order by c1, h;
select group_concat(hex(c1) order by hex(c1)) from t1 group by c1;
select group_concat(c1 order by hex(c1) SEPARATOR '') from t1 group by c1;
drop table t1;

File diff suppressed because it is too large Load Diff

View File

@ -95,7 +95,9 @@ select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
#
# Test for BUG#9535
#
--disable_warnings
create table t1 as select uuid(), length(uuid());
--enable_warnings
show create table t1;
drop table t1;

View File

@ -754,6 +754,45 @@ select * from t1;
select * from t2;
drop table t1,t2;
#
# Bug#27716 multi-update did partially and has not binlogged
#
CREATE TABLE `t1` (
`a` int(11) NOT NULL auto_increment,
`b` int(11) default NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
CREATE TABLE `t2` (
`a` int(11) NOT NULL auto_increment,
`b` int(11) default NULL,
PRIMARY KEY (`a`)
) ENGINE=INNODB DEFAULT CHARSET=latin1 ;
# A. testing multi_update::send_eof() execution branch
insert into t1 values (1,1),(2,2);
insert into t2 values (1,1),(4,4);
reset master;
--error ER_DUP_ENTRY_WITH_KEY_NAME
UPDATE t2,t1 SET t2.a=t1.a+2;
# check
select * from t2 /* must be (3,1), (4,4) */;
show master status /* there must no UPDATE in binlog */;
# B. testing multi_update::send_error() execution branch
delete from t1;
delete from t2;
insert into t1 values (1,2),(3,4),(4,4);
insert into t2 values (1,2),(3,4),(4,4);
reset master;
--error ER_DUP_ENTRY_WITH_KEY_NAME
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
show master status /* there must be no UPDATE query event */;
# cleanup bug#27716
drop table t1, t2;
#
# Testing of IFNULL
#

View File

@ -570,3 +570,48 @@ delete t1.*,t2.* from t1,t2 where t1.i2=t2.id;
select * from t1 order by i1;
select * from t2 order by id;
drop table t1, t2;
#
# Bug#27716 multi-update did partially and has not binlogged
#
CREATE TABLE `t1` (
`a` int(11) NOT NULL auto_increment,
`b` int(11) default NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
CREATE TABLE `t2` (
`a` int(11) NOT NULL auto_increment,
`b` int(11) default NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
# as the test is about to see erroed queries in binlog
set @@session.binlog_format= mixed;
# A. testing multi_update::send_error() effective update
insert into t1 values (1,1),(2,2);
insert into t2 values (1,1),(4,4);
reset master;
--error ER_DUP_ENTRY_WITH_KEY_NAME
UPDATE t2,t1 SET t2.a=t1.a+2;
# check
select * from t2 /* must be (3,1), (4,4) */;
show master status /* there must be the UPDATE query event */;
# B. testing multi_update::send_error() ineffective update
# (as there is a policy described at mysql_update() still go to binlog)
delete from t1;
delete from t2;
insert into t1 values (1,2),(3,4),(4,4);
insert into t2 values (1,2),(3,4),(4,4);
reset master;
--error ER_DUP_ENTRY_WITH_KEY_NAME
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
show master status /* there must be the UPDATE query event */;
# cleanup bug#27716
drop table t1, t2;
--echo end of tests

View File

@ -0,0 +1 @@
--innodb

View File

@ -0,0 +1 @@
--innodb

View File

@ -0,0 +1,282 @@
#########################################
# Author: Serge Kozlov skozlov@mysql.com
# Date: 04/25/2007
# Purpose: Testing Invocation and Invoked
# Features for Replication.
#########################################
--source include/master-slave.inc
--source include/have_innodb.inc
#
# Define variables used by test case
#
# Non-transactional engine
--let $engine_type= myisam
# Transactional engine
--let $engine_type2= innodb
#
# Clean up
#
USE test;
--disable_warnings
DROP VIEW IF EXISTS v1,v11;
DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p11;
DROP FUNCTION IF EXISTS f1;
DROP FUNCTION IF EXISTS f2;
DROP EVENT IF EXISTS e1;
DROP EVENT IF EXISTS e11;
--enable_warnings
#
# Prepare objects (tables etc)
#
# Create tables
--echo
eval CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=$engine_type;
--disable_warnings
INSERT INTO t1 VALUES (1,1,'1');
INSERT INTO t1 VALUES (2,2,UUID());
eval CREATE TABLE t2 (a INT, b INT, c VARCHAR(64)) ENGINE=$engine_type;
INSERT INTO t2 VALUES (1,1,'1');
INSERT INTO t2 VALUES (2,2,UUID());
--enable_warnings
eval CREATE TABLE t11 (a INT NOT NULL PRIMARY KEY, b INT, c VARCHAR(64)) ENGINE=$engine_type2;
--disable_warnings
INSERT INTO t11 VALUES (1,1,'1');
INSERT INTO t11 VALUES (2,2,UUID());
eval CREATE TABLE t12 (a INT, b INT, c VARCHAR(64)) ENGINE=$engine_type2;
INSERT INTO t12 VALUES (1,1,'1');
INSERT INTO t12 VALUES (2,2,UUID());
--enable_warnings
# Create invoked features
--echo
# Create view for tables t1,t11
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE VIEW v11 AS SELECT * FROM t11;
# Create triggers for t1,t11
DELIMITER |;
CREATE TRIGGER t1_tr1 BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
INSERT INTO t2 VALUES (NEW.a, NEW.b, NEW.c);
INSERT INTO t3 VALUES (NEW.a, NEW.b, NEW.c);
END|
CREATE TRIGGER t1_tr2 BEFORE UPDATE ON t1 FOR EACH ROW
BEGIN
UPDATE t2 SET c = '';
UPDATE t3 SET c = '';
END|
CREATE TRIGGER t11_tr1 BEFORE INSERT ON t11 FOR EACH ROW
BEGIN
INSERT INTO t12 VALUES (NEW.a, NEW.b, NEW.c);
INSERT INTO t13 VALUES (NEW.a, NEW.b, NEW.c);
END|
CREATE TRIGGER t11_tr2 BEFORE UPDATE ON t11 FOR EACH ROW
BEGIN
UPDATE t12 SET c = '';
UPDATE t13 SET c = '';
END|
# Create events which will run every 1 sec
CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND ENABLE DO
BEGIN
DECLARE c INT;
SELECT a INTO c FROM t1 WHERE a < 11 ORDER BY a DESC LIMIT 1;
IF c = 7 THEN
CALL p1(10, '');
END IF;
END|
CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND ENABLE DO
BEGIN
DECLARE c INT;
SELECT a INTO c FROM t11 WHERE a < 11 ORDER BY a DESC LIMIT 1;
IF c = 7 THEN
CALL p11(10, '');
END IF;
END|
# Create functions and procedures used for events
CREATE FUNCTION f1 (x INT) RETURNS VARCHAR(64)
BEGIN
IF x > 5 THEN
RETURN UUID();
END IF;
RETURN '';
END|
CREATE FUNCTION f2 (x INT) RETURNS VARCHAR(64)
BEGIN
RETURN f1(x);
END|
CREATE PROCEDURE p1 (IN x INT, IN y VARCHAR(64))
BEGIN
INSERT INTO t1 VALUES (x,x,y);
END|
CREATE PROCEDURE p11 (IN x INT, IN y VARCHAR(64))
BEGIN
INSERT INTO t11 VALUES (x,x,y);
END|
DELIMITER ;|
#
# Start test case
#
# Do some actions for non-transactional tables
--echo
--disable_warnings
CREATE TABLE t3 SELECT * FROM v1;
INSERT INTO t1 VALUES (3,3,'');
UPDATE t1 SET c='2' WHERE a = 1;
INSERT INTO t1 VALUES(4,4,f1(4));
INSERT INTO t1 VALUES (100,100,'');
CALL p1(5, UUID());
INSERT INTO t1 VALUES (101,101,'');
INSERT INTO t1 VALUES(6,6,f1(6));
INSERT INTO t1 VALUES (102,102,'');
INSERT INTO t1 VALUES(7,7,f2(7));
INSERT INTO t1 VALUES (103,103,'');
# Do some actions for transactional tables
--echo
CREATE TABLE t13 SELECT * FROM v11;
INSERT INTO t11 VALUES (3,3,'');
UPDATE t11 SET c='2' WHERE a = 1;
INSERT INTO t11 VALUES(4,4,f1(4));
INSERT INTO t11 VALUES (100,100,'');
CALL p11(5, UUID());
INSERT INTO t11 VALUES (101,101,'');
INSERT INTO t11 VALUES(6,6,f1(6));
INSERT INTO t11 VALUES (102,102,'');
INSERT INTO t11 VALUES(7,7,f2(7));
INSERT INTO t11 VALUES (103,103,'');
--enable_warnings
# Scheduler is on
--echo
SET GLOBAL EVENT_SCHEDULER = on;
# Wait 2 sec while events will executed
--sleep 2
SET GLOBAL EVENT_SCHEDULER = off;
# Check original objects
--echo
SHOW TABLES LIKE 't%';
SELECT table_name FROM information_schema.views WHERE table_schema='test';
SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test';
SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test';
SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
# Check original data
--echo
SELECT COUNT(*) FROM t1;
SELECT a,b FROM t1 ORDER BY a;
SELECT COUNT(*) FROM t2;
SELECT a,b FROM t2 ORDER BY a;
SELECT COUNT(*) FROM t3;
SELECT a,b FROM t3 ORDER BY a;
SELECT a,b FROM v1 ORDER BY a;
SELECT COUNT(*) FROM t11;
SELECT a,b FROM t11 ORDER BY a;
SELECT COUNT(*) FROM t12;
SELECT a,b FROM t12 ORDER BY a;
SELECT COUNT(*) FROM t13;
SELECT a,b FROM t13 ORDER BY a;
SELECT a,b FROM v11 ORDER BY a;
--sync_slave_with_master slave
# Check replicated objects
--echo
SHOW TABLES LIKE 't%';
SELECT table_name FROM information_schema.views WHERE table_schema='test';
SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test';
SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test';
SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
# Check replicated data
--echo
SELECT COUNT(*) FROM t1;
SELECT a,b FROM t1 ORDER BY a;
SELECT COUNT(*) FROM t2;
SELECT a,b FROM t2 ORDER BY a;
SELECT COUNT(*) FROM t3;
SELECT a,b FROM t3 ORDER BY a;
SELECT a,b FROM v1 ORDER BY a;
SELECT COUNT(*) FROM t11;
SELECT a,b FROM t11 ORDER BY a;
SELECT COUNT(*) FROM t12;
SELECT a,b FROM t12 ORDER BY a;
SELECT COUNT(*) FROM t13;
SELECT a,b FROM t13 ORDER BY a;
SELECT a,b FROM v11 ORDER BY a;
# Remove UUID() before comparing
--connection master
--echo
UPDATE t1 SET c='';
UPDATE t2 SET c='';
UPDATE t3 SET c='';
UPDATE t11 SET c='';
UPDATE t12 SET c='';
UPDATE t13 SET c='';
--sync_slave_with_master slave
# Compare a data from master and slave
--echo
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_slave.sql
--diff_files $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_master.sql $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_slave.sql
#
# Clean up
#
# Remove dumps
--echo
--exec rm $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_master.sql
--exec rm $MYSQLTEST_VARDIR/tmp/rpl_invoked_features_slave.sql
# Remove tables,views,procedures,functions
--connection master
--echo
--disable_warnings
DROP VIEW IF EXISTS v1,v11;
DROP TABLE IF EXISTS t1,t2,t3,t11,t12,t13;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p11;
DROP FUNCTION IF EXISTS f1;
DROP FUNCTION IF EXISTS f2;
DROP EVENT IF EXISTS e1;
DROP EVENT IF EXISTS e11;
--enable_warnings
--sync_slave_with_master slave
# End 5.1 test case

View File

@ -184,3 +184,42 @@ SELECT k, HEX(a),HEX(b) FROM t2_innodb;
connection master;
DROP TABLE IF EXISTS t1_myisam, t1_innodb, t2_myisam, t2_innodb;
sync_slave_with_master;
#
# Bug#27716 multi-update did partially and has not binlogged
#
connection master;
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
CREATE TABLE `t1` (
`a` int(11) NOT NULL auto_increment,
`b` int(11) default NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
CREATE TABLE `t2` (
`a` int(11) NOT NULL auto_increment,
`b` int(11) default NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
# testing multi_update::send_error() effective update
insert into t1 values (1,1),(2,2);
insert into t2 values (1,1),(4,4);
connection master;
--error ER_DUP_ENTRY_WITH_KEY_NAME
UPDATE t2,t1 SET t2.a=t1.a+2;
select * from t2 /* must be (3,1), (4,4) */;
sync_slave_with_master;
connection slave;
select * from t2 /* must be (3,1), (4,4) */;
connection master;
drop table t1,t2;
sync_slave_with_master;

View File

@ -0,0 +1,71 @@
source include/master-slave.inc;
--echo **** On Slave ****
connection slave;
STOP SLAVE;
--echo **** On Master ****
connection master;
SET SESSION BINLOG_FORMAT=ROW;
CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (c INT, d INT);
INSERT INTO t1 VALUES (1,1),(2,4),(3,9);
INSERT INTO t2 VALUES (1,1),(2,8),(3,27);
UPDATE t1,t2 SET b = d, d = b * 2 WHERE a = c;
source include/show_binlog_events.inc;
# These tables should be changed
SELECT * FROM t1;
SELECT * FROM t2;
save_master_pos;
--echo **** On Slave ****
connection slave;
# Stop when reaching the the first table map event.
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=484;
wait_for_slave_to_stop;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
query_vertical SHOW SLAVE STATUS;
# Now we skip *one* table map event. If the execution starts right
# after that table map event, *one* of the involved tables will be
# changed.
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
sync_with_master;
# These values should be what was inserted, not what was
# updated. Since we are skipping the first table map of the group
# representing the UPDATE statement above, we should skip the entire
# group and not start executing at the first table map.
SELECT * FROM t1;
SELECT * FROM t2;
STOP SLAVE;
RESET SLAVE;
connection master;
RESET MASTER;
SET SESSION BINLOG_FORMAT=STATEMENT;
SET @foo = 12;
INSERT INTO t1 VALUES(@foo, 2*@foo);
save_master_pos;
source include/show_binlog_events.inc;
connection slave;
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=106;
wait_for_slave_to_stop;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
query_vertical SHOW SLAVE STATUS;
--echo **** On Master ****
connection master;
DROP TABLE t1, t2;
sync_slave_with_master;

View File

@ -24,7 +24,6 @@
#ifdef HAVE_UCA_COLLATIONS
#ifdef HAVE_CHARSET_ucs2
extern CHARSET_INFO my_charset_ucs2_general_uca;
extern CHARSET_INFO my_charset_ucs2_icelandic_uca_ci;
extern CHARSET_INFO my_charset_ucs2_latvian_uca_ci;
extern CHARSET_INFO my_charset_ucs2_romanian_uca_ci;
@ -46,7 +45,6 @@ extern CHARSET_INFO my_charset_ucs2_hungarian_uca_ci;
#endif
#ifdef HAVE_CHARSET_utf8
extern CHARSET_INFO my_charset_utf8_general_uca_ci;
extern CHARSET_INFO my_charset_utf8_icelandic_uca_ci;
extern CHARSET_INFO my_charset_utf8_latvian_uca_ci;
extern CHARSET_INFO my_charset_utf8_romanian_uca_ci;
@ -135,7 +133,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused)))
add_compiled_collation(&my_charset_ucs2_general_ci);
add_compiled_collation(&my_charset_ucs2_bin);
#ifdef HAVE_UCA_COLLATIONS
add_compiled_collation(&my_charset_ucs2_general_uca);
add_compiled_collation(&my_charset_ucs2_unicode_ci);
add_compiled_collation(&my_charset_ucs2_icelandic_uca_ci);
add_compiled_collation(&my_charset_ucs2_latvian_uca_ci);
add_compiled_collation(&my_charset_ucs2_romanian_uca_ci);
@ -169,7 +167,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused)))
add_compiled_collation(&my_charset_utf8_general_cs);
#endif
#ifdef HAVE_UCA_COLLATIONS
add_compiled_collation(&my_charset_utf8_general_uca_ci);
add_compiled_collation(&my_charset_utf8_unicode_ci);
add_compiled_collation(&my_charset_utf8_icelandic_uca_ci);
add_compiled_collation(&my_charset_utf8_latvian_uca_ci);
add_compiled_collation(&my_charset_utf8_romanian_uca_ci);

View File

@ -202,6 +202,19 @@ static my_bool simple_cs_is_full(CHARSET_INFO *cs)
}
static void
copy_uca_collation(CHARSET_INFO *to, CHARSET_INFO *from)
{
to->cset= from->cset;
to->coll= from->coll;
to->strxfrm_multiply= from->strxfrm_multiply;
to->min_sort_char= from->min_sort_char;
to->max_sort_char= from->max_sort_char;
to->mbminlen= from->mbminlen;
to->mbmaxlen= from->mbmaxlen;
}
static int add_collation(CHARSET_INFO *cs)
{
if (cs->name && (cs->number ||
@ -225,29 +238,30 @@ static int add_collation(CHARSET_INFO *cs)
if (!(all_charsets[cs->number]->state & MY_CS_COMPILED))
{
CHARSET_INFO *new= all_charsets[cs->number];
CHARSET_INFO *newcs= all_charsets[cs->number];
if (cs_copy_data(all_charsets[cs->number],cs))
return MY_XML_ERROR;
if (!strcmp(cs->csname,"ucs2") )
{
#if defined(HAVE_CHARSET_ucs2) && defined(HAVE_UCA_COLLATIONS)
new->cset= my_charset_ucs2_general_uca.cset;
new->coll= my_charset_ucs2_general_uca.coll;
new->strxfrm_multiply= my_charset_ucs2_general_uca.strxfrm_multiply;
new->min_sort_char= my_charset_ucs2_general_uca.min_sort_char;
new->max_sort_char= my_charset_ucs2_general_uca.max_sort_char;
new->mbminlen= 2;
new->mbmaxlen= 2;
new->state |= MY_CS_AVAILABLE | MY_CS_LOADED;
copy_uca_collation(newcs, &my_charset_ucs2_unicode_ci);
newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED;
#endif
}
else if (!strcmp(cs->csname, "utf8"))
{
#if defined (HAVE_CHARSET_utf8) && defined(HAVE_UCA_COLLATIONS)
copy_uca_collation(newcs, &my_charset_utf8_unicode_ci);
newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED;
#endif
}
else
{
uchar *sort_order= all_charsets[cs->number]->sort_order;
simple_cs_init_functions(all_charsets[cs->number]);
new->mbminlen= 1;
new->mbmaxlen= 1;
newcs->mbminlen= 1;
newcs->mbmaxlen= 1;
if (simple_cs_is_full(all_charsets[cs->number]))
{
all_charsets[cs->number]->state |= MY_CS_LOADED;

View File

@ -5887,6 +5887,7 @@ void Field_datetime::sql_type(String &res) const
well_formed_error_pos - where not well formed data was first met
cannot_convert_error_pos - where a not-convertable character was first met
end - end of the string
cs - character set of the string
NOTES
As of version 5.0 both cases return the same error:
@ -5906,7 +5907,8 @@ static bool
check_string_copy_error(Field_str *field,
const char *well_formed_error_pos,
const char *cannot_convert_error_pos,
const char *end)
const char *end,
CHARSET_INFO *cs)
{
const char *pos, *end_orig;
char tmp[64], *t;
@ -5920,8 +5922,18 @@ check_string_copy_error(Field_str *field,
for (t= tmp; pos < end; pos++)
{
/*
If the source string is ASCII compatible (mbminlen==1)
and the source character is in ASCII printable range (0x20..0x7F),
then display the character as is.
Otherwise, if the source string is not ASCII compatible (e.g. UCS2),
or the source character is not in the printable range,
then print the character using HEX notation.
*/
if (((unsigned char) *pos) >= 0x20 &&
((unsigned char) *pos) <= 0x7F)
((unsigned char) *pos) <= 0x7F &&
cs->mbminlen == 1)
{
*t++= *pos;
}
@ -6003,7 +6015,7 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
field_charset->pad_char);
if (check_string_copy_error(this, well_formed_error_pos,
cannot_convert_error_pos, from + length))
cannot_convert_error_pos, from + length, cs))
return 2;
/*
@ -6467,7 +6479,7 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
int2store(ptr, copy_length);
if (check_string_copy_error(this, well_formed_error_pos,
cannot_convert_error_pos, from + length))
cannot_convert_error_pos, from + length, cs))
return 2;
// Check if we lost something other than just trailing spaces
@ -7144,7 +7156,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
bmove(ptr+packlength,(uchar*) &tmp,sizeof(char*));
if (check_string_copy_error(this, well_formed_error_pos,
cannot_convert_error_pos, from + length))
cannot_convert_error_pos, from + length, cs))
return 2;
if (from_end_pos < from + length)

View File

@ -2354,7 +2354,7 @@ Create_udf_func::create(THD *thd, udf_func *udf, List<Item> *item_list)
if (item_list != NULL)
arg_count= item_list->elements;
thd->lex->binlog_row_based_if_mixed= TRUE;
thd->lex->set_stmt_unsafe();
DBUG_ASSERT( (udf->type == UDFTYPE_FUNCTION)
|| (udf->type == UDFTYPE_AGGREGATE));
@ -4541,7 +4541,7 @@ Create_func_uuid Create_func_uuid::s_singleton;
Item*
Create_func_uuid::create(THD *thd)
{
thd->lex->binlog_row_based_if_mixed= TRUE;
thd->lex->set_stmt_unsafe();
return new (thd->mem_root) Item_func_uuid();
}
@ -4551,7 +4551,7 @@ Create_func_uuid_short Create_func_uuid_short::s_singleton;
Item*
Create_func_uuid_short::create(THD *thd)
{
thd->lex->binlog_row_based_if_mixed= TRUE;
thd->lex->set_stmt_unsafe();
return new (thd->mem_root) Item_func_uuid_short();
}

View File

@ -6161,6 +6161,20 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
DBUG_RETURN(0);
}
Log_event::enum_skip_reason
Rows_log_event::do_shall_skip(RELAY_LOG_INFO *rli)
{
/*
If the slave skip counter is 1 and this event does not end a
statement, then we should not start executing on the next event.
Otherwise, we defer the decision to the normal skipping logic.
*/
if (rli->slave_skip_counter == 1 && !get_flags(STMT_END_F))
return Log_event::EVENT_SKIP_IGNORE;
else
return Log_event::do_shall_skip(rli);
}
int
Rows_log_event::do_update_pos(RELAY_LOG_INFO *rli)
{
@ -6627,6 +6641,19 @@ err:
DBUG_RETURN(error);
}
Log_event::enum_skip_reason
Table_map_log_event::do_shall_skip(RELAY_LOG_INFO *rli)
{
/*
If the slave skip counter is 1, then we should not start executing
on the next event.
*/
if (rli->slave_skip_counter == 1)
return Log_event::EVENT_SKIP_IGNORE;
else
return Log_event::do_shall_skip(rli);
}
int Table_map_log_event::do_update_pos(RELAY_LOG_INFO *rli)
{
rli->inc_event_relay_log_pos();

View File

@ -2067,6 +2067,7 @@ private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const *rli);
virtual int do_update_pos(RELAY_LOG_INFO *rli);
virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli);
#endif
#ifndef MYSQL_CLIENT
@ -2245,6 +2246,7 @@ private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const *rli);
virtual int do_update_pos(RELAY_LOG_INFO *rli);
virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli);
/*
Primitive to prepare for a sequence of row executions.

View File

@ -3307,7 +3307,7 @@ with --log-bin instead.");
}
else
{
global_system_variables.binlog_format= BINLOG_FORMAT_UNSPEC;
global_system_variables.binlog_format= BINLOG_FORMAT_MIXED;
}
else
if (opt_binlog_format_id == BINLOG_FORMAT_UNSPEC)

View File

@ -6059,3 +6059,6 @@ ER_SLAVE_INCIDENT
eng "The incident %s occured on the master. Message: %-.64s"
ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT
eng "Table has no partition for some existing values"
ER_BINLOG_UNSAFE_STATEMENT
eng "Statement is not safe to log in statement format."
swe "Detta är inte säkert att logga i statement-format."

View File

@ -2015,12 +2015,13 @@ connected:
{
/*
Register ourselves with the master.
If fails, this is not fatal - we just print the error message and go
on with life.
*/
thd->proc_info = "Registering slave on master";
if (register_slave_on_master(mysql) || update_slave_list(mysql, mi))
if (register_slave_on_master(mysql))
{
sql_print_error("Slave I/O thread couldn't register on master");
goto err;
}
}
DBUG_PRINT("info",("Starting reading binary log from master"));

View File

@ -1858,7 +1858,7 @@ sp_head::restore_lex(THD *thd)
cannot switch from statement-based to row-based only for this
substatement).
*/
if (sublex->binlog_row_based_if_mixed)
if (sublex->is_stmt_unsafe())
m_flags|= BINLOG_ROW_BASED_IF_MIXED;
/*

View File

@ -378,7 +378,7 @@ public:
the substatements not).
*/
if (m_flags & BINLOG_ROW_BASED_IF_MIXED)
lex->binlog_row_based_if_mixed= TRUE;
lex->set_stmt_unsafe();
}

View File

@ -3999,7 +3999,7 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen)
/*
CREATE ... SELECT UUID() locks no tables, we have to test here.
*/
if (thd->lex->binlog_row_based_if_mixed)
if (thd->lex->is_stmt_unsafe())
thd->set_current_stmt_binlog_row_based_if_mixed();
if (!tables && !thd->lex->requires_prelocking())
@ -4040,7 +4040,7 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen)
if (thd->variables.binlog_format == BINLOG_FORMAT_MIXED &&
has_two_write_locked_tables_with_auto_increment(tables))
{
thd->lex->binlog_row_based_if_mixed= TRUE;
thd->lex->set_stmt_unsafe();
thd->set_current_stmt_binlog_row_based_if_mixed();
}
}

View File

@ -329,7 +329,7 @@ THD::THD()
Open_tables_state(refresh_version), rli_fake(0),
lock_id(&main_lock_id),
user_time(0), in_sub_stmt(0),
binlog_table_maps(0),
binlog_table_maps(0), binlog_flags(0UL),
arg_of_last_insert_id_function(FALSE),
first_successful_insert_id_in_prev_stmt(0),
first_successful_insert_id_in_prev_stmt_for_binlog(0),
@ -1456,6 +1456,11 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
}
#define NEED_ESCAPING(x) ((int) (uchar) (x) == escape_char || \
(int) (uchar) (x) == field_sep_char || \
(int) (uchar) (x) == line_sep_char || \
!(x))
bool select_export::send_data(List<Item> &items)
{
@ -1515,14 +1520,20 @@ bool select_export::send_data(List<Item> &items)
used_length=res->length();
if (result_type == STRING_RESULT && escape_char != -1)
{
char *pos,*start,*end;
char *pos, *start, *end;
CHARSET_INFO *res_charset= res->charset();
CHARSET_INFO *character_set_client= thd->variables.
character_set_client;
bool check_second_byte= (res_charset == &my_charset_bin) &&
character_set_client->
escape_with_backslash_is_dangerous;
DBUG_ASSERT(character_set_client->mbmaxlen == 2 ||
!character_set_client->escape_with_backslash_is_dangerous);
for (start=pos=(char*) res->ptr(),end=pos+used_length ;
pos != end ;
pos++)
{
#ifdef USE_MB
CHARSET_INFO *res_charset=res->charset();
if (use_mb(res_charset))
{
int l;
@ -1533,9 +1544,45 @@ bool select_export::send_data(List<Item> &items)
}
}
#endif
if ((int) *pos == escape_char || (int) *pos == field_sep_char ||
(int) *pos == line_sep_char || !*pos)
{
/*
Special case when dumping BINARY/VARBINARY/BLOB values
for the clients with character sets big5, cp932, gbk and sjis,
which can have the escape character (0x5C "\" by default)
as the second byte of a multi-byte sequence.
If
- pos[0] is a valid multi-byte head (e.g 0xEE) and
- pos[1] is 0x00, which will be escaped as "\0",
then we'll get "0xEE + 0x5C + 0x30" in the output file.
If this file is later loaded using this sequence of commands:
mysql> create table t1 (a varchar(128)) character set big5;
mysql> LOAD DATA INFILE 'dump.txt' INTO TABLE t1;
then 0x5C will be misinterpreted as the second byte
of a multi-byte character "0xEE + 0x5C", instead of
escape character for 0x00.
To avoid this confusion, we'll escape the multi-byte
head character too, so the sequence "0xEE + 0x00" will be
dumped as "0x5C + 0xEE + 0x5C + 0x30".
Note, in the condition below we only check if
mbcharlen is equal to 2, because there are no
character sets with mbmaxlen longer than 2
and with escape_with_backslash_is_dangerous set.
DBUG_ASSERT before the loop makes that sure.
*/
if (NEED_ESCAPING(*pos) ||
(check_second_byte &&
my_mbcharlen(character_set_client, (uchar) *pos) == 2 &&
pos + 1 < end &&
NEED_ESCAPING(pos[1])))
{
char tmp_buff[2];
tmp_buff[0]= escape_char;
tmp_buff[1]= *pos ? *pos : '0';
@ -3081,6 +3128,27 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query,
if (int error= binlog_flush_pending_rows_event(TRUE))
DBUG_RETURN(error);
/*
If we are in statement mode and trying to log an unsafe statement,
we should print a warning.
*/
if (lex->is_stmt_unsafe() &&
variables.binlog_format == BINLOG_FORMAT_STMT)
{
DBUG_ASSERT(this->query != NULL);
push_warning(this, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_BINLOG_UNSAFE_STATEMENT,
ER(ER_BINLOG_UNSAFE_STATEMENT));
if (!(binlog_flags & BINLOG_FLAG_UNSAFE_STMT_PRINTED))
{
char warn_buf[MYSQL_ERRMSG_SIZE];
my_snprintf(warn_buf, MYSQL_ERRMSG_SIZE, "%s Statement: %s",
ER(ER_BINLOG_UNSAFE_STATEMENT), this->query);
sql_print_warning(warn_buf);
binlog_flags|= BINLOG_FLAG_UNSAFE_STMT_PRINTED;
}
}
switch (qtype) {
case THD::ROW_QUERY_TYPE:
if (current_stmt_binlog_row_based)

View File

@ -1099,6 +1099,17 @@ public:
private:
uint binlog_table_maps; // Number of table maps currently in the binlog
enum enum_binlog_flag {
BINLOG_FLAG_UNSAFE_STMT_PRINTED,
BINLOG_FLAG_COUNT
};
/**
Flags with per-thread information regarding the status of the
binary log.
*/
uint32 binlog_flags;
public:
uint get_binlog_table_maps() const {
return binlog_table_maps;
@ -1669,6 +1680,7 @@ public:
void restore_sub_statement_state(Sub_statement_state *backup);
void set_n_backup_active_arena(Query_arena *set, Query_arena *backup);
void restore_active_arena(Query_arena *set, Query_arena *backup);
inline void set_current_stmt_binlog_row_based_if_mixed()
{
/*

View File

@ -1664,6 +1664,7 @@ public:
Statement-based replication of INSERT DELAYED has problems with RAND()
and user vars, so in mixed mode we go to row-based.
*/
thd.lex->set_stmt_unsafe();
thd.set_current_stmt_binlog_row_based_if_mixed();
bzero((char*) &thd.net, sizeof(thd.net)); // Safety

View File

@ -1785,7 +1785,7 @@ void Query_tables_list::reset_query_tables_list(bool init)
sroutines_list.empty();
sroutines_list_own_last= sroutines_list.next;
sroutines_list_own_elements= 0;
binlog_row_based_if_mixed= FALSE;
binlog_stmt_flags= 0;
}

View File

@ -967,14 +967,6 @@ public:
uchar **sroutines_list_own_last;
uint sroutines_list_own_elements;
/*
Tells if the parsing stage detected that some items require row-based
binlogging to give a reliable binlog/replication, or if we will use
stored functions or triggers which themselves need require row-based
binlogging.
*/
bool binlog_row_based_if_mixed;
/*
These constructor and destructor serve for creation/destruction
of Query_tables_list instances which are used as backup storage.
@ -1022,12 +1014,48 @@ public:
query_tables_own_last= 0;
}
}
/**
Has the parser/scanner detected that this statement is unsafe?
*/
inline bool is_stmt_unsafe() const {
return binlog_stmt_flags & (1U << BINLOG_STMT_FLAG_UNSAFE);
}
/**
Flag the current (top-level) statement as unsafe.
The flag will be reset after the statement has finished.
*/
inline void set_stmt_unsafe() {
binlog_stmt_flags|= (1U << BINLOG_STMT_FLAG_UNSAFE);
}
inline void clear_stmt_unsafe() {
binlog_stmt_flags&= ~(1U << BINLOG_STMT_FLAG_UNSAFE);
}
/**
true if the parsed tree contains references to stored procedures
or functions, false otherwise
*/
bool uses_stored_routines() const
{ return sroutines_list.elements != 0; }
private:
enum enum_binlog_stmt_flag {
BINLOG_STMT_FLAG_UNSAFE,
BINLOG_STMT_FLAG_COUNT
};
/*
Tells if the parsing stage detected properties of the statement,
for example: that some items require row-based binlogging to give
a reliable binlog/replication, or if we will use stored functions
or triggers which themselves need require row-based binlogging.
*/
uint32 binlog_stmt_flags;
};

View File

@ -1069,6 +1069,7 @@ bool mysql_multi_update(THD *thd,
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex)
{
multi_update *result;
bool res;
DBUG_ENTER("mysql_multi_update");
if (!(result= new multi_update(table_list,
@ -1083,7 +1084,7 @@ bool mysql_multi_update(THD *thd,
MODE_STRICT_ALL_TABLES));
List<Item> total_list;
(void) mysql_select(thd, &select_lex->ref_pointer_array,
res= mysql_select(thd, &select_lex->ref_pointer_array,
table_list, select_lex->with_wild,
total_list,
conds, 0, (ORDER *) NULL, (ORDER *)NULL, (Item *) NULL,
@ -1091,6 +1092,15 @@ bool mysql_multi_update(THD *thd,
options | SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK |
OPTION_SETUP_TABLES_DONE,
result, unit, select_lex);
DBUG_PRINT("info",("res: %d report_error: %d", res,
thd->net.report_error));
res|= thd->net.report_error;
if (unlikely(res))
{
/* If we had a another error reported earlier then this will be ignored */
result->send_error(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR));
result->abort();
}
delete result;
thd->abort_on_warning= 0;
DBUG_RETURN(FALSE);
@ -1441,8 +1451,9 @@ multi_update::~multi_update()
if (copy_field)
delete [] copy_field;
thd->count_cuted_fields= CHECK_FIELD_IGNORE; // Restore this setting
if (!trans_safe)
if (!trans_safe) // todo: remove since redundant
thd->no_trans_update.all= TRUE;
DBUG_ASSERT(trans_safe || thd->no_trans_update.all);
}
@ -1531,8 +1542,15 @@ bool multi_update::send_data(List<Item> &not_used_values)
}
else
{
if (!table->file->has_transactions())
/* non-transactional or transactional table got modified */
/* either multi_update class' flag is raised in its branch */
if (table->file->has_transactions())
transactional_tables= 1;
else
{
trans_safe= 0;
thd->no_trans_update.stmt= TRUE;
}
if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
TRG_ACTION_AFTER, TRUE))
@ -1589,8 +1607,8 @@ void multi_update::send_error(uint errcode,const char *err)
my_error(errcode, MYF(0), err);
/* If nothing updated return */
if (!updated)
return;
if (updated == 0) /* the counter might be reset in send_eof */
return; /* and then the query has been binlogged */
/* Something already updated so we have to invalidate cache */
query_cache_invalidate3(thd, update_tables, 1);
@ -1601,11 +1619,43 @@ void multi_update::send_error(uint errcode,const char *err)
*/
if (trans_safe)
ha_rollback_stmt(thd);
else if (do_update && table_count > 1)
{
/* Add warning here */
VOID(do_updates(0));
DBUG_ASSERT(transactional_tables);
(void) ha_autocommit_or_rollback(thd, 1);
}
else
{
DBUG_ASSERT(thd->no_trans_update.stmt);
if (do_update && table_count > 1)
{
/* Add warning here */
/*
todo/fixme: do_update() is never called with the arg 1.
should it change the signature to become argless?
*/
VOID(do_updates(0));
}
}
if (thd->no_trans_update.stmt)
{
/*
The query has to binlog because there's a modified non-transactional table
either from the query's list or via a stored routine: bug#13270,23333
*/
if (mysql_bin_log.is_open())
{
thd->binlog_query(THD::ROW_QUERY_TYPE,
thd->query, thd->query_length,
transactional_tables, FALSE);
}
if (!trans_safe)
thd->no_trans_update.all= TRUE;
}
DBUG_ASSERT(trans_safe || !updated || thd->no_trans_update.stmt);
if (transactional_tables)
{
(void) ha_autocommit_or_rollback(thd, 1);
}
}
@ -1736,9 +1786,12 @@ int multi_update::do_updates(bool from_send_error)
if (updated != org_updated)
{
if (table->file->has_transactions())
transactional_tables= 1;
transactional_tables= 1;
else
trans_safe= 0; // Can't do safe rollback
{
trans_safe= 0; // Can't do safe rollback
thd->no_trans_update.stmt= TRUE;
}
}
(void) table->file->ha_rnd_end();
(void) tmp_table->file->ha_rnd_end();
@ -1768,7 +1821,10 @@ err2:
if (table->file->has_transactions())
transactional_tables= 1;
else
{
trans_safe= 0;
thd->no_trans_update.stmt= TRUE;
}
}
DBUG_RETURN(1);
}
@ -1798,14 +1854,20 @@ bool multi_update::send_eof()
Write the SQL statement to the binlog if we updated
rows and we succeeded or if we updated some non
transactional tables.
The query has to binlog because there's a modified non-transactional table
either from the query's list or via a stored routine: bug#13270,23333
*/
if ((local_error == 0) || (updated && !trans_safe))
DBUG_ASSERT(trans_safe || !updated || thd->no_trans_update.stmt);
if (local_error == 0 || thd->no_trans_update.stmt)
{
if (mysql_bin_log.is_open())
{
if (local_error == 0)
thd->clear_error();
else
updated= 0; /* if there's an error binlog it here not in ::send_error */
if (thd->binlog_query(THD::ROW_QUERY_TYPE,
thd->query, thd->query_length,
transactional_tables, FALSE) &&
@ -1814,7 +1876,7 @@ bool multi_update::send_eof()
local_error= 1; // Rollback update
}
}
if (!transactional_tables)
if (!trans_safe)
thd->no_trans_update.all= TRUE;
}
@ -1826,7 +1888,7 @@ bool multi_update::send_eof()
if (local_error > 0) // if the above log write did not fail ...
{
/* Safety: If we haven't got an error before (should not happen) */
/* Safety: If we haven't got an error before (can happen in do_updates) */
my_message(ER_UNKNOWN_ERROR, "An error occured in multi-table update",
MYF(0));
return TRUE;

View File

@ -1134,8 +1134,8 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
If the view's body needs row-based binlogging (e.g. the VIEW is created
from SELECT UUID()), the top statement also needs it.
*/
if (lex->binlog_row_based_if_mixed)
old_lex->binlog_row_based_if_mixed= TRUE;
if (lex->is_stmt_unsafe())
old_lex->set_stmt_unsafe();
view_is_mergeable= (table->algorithm != VIEW_ALGORITHM_TMPTABLE &&
lex->can_be_merged());
LINT_INIT(view_main_select_tables);

View File

@ -6402,7 +6402,7 @@ CHARSET_INFO my_charset_big5_chinese_ci=
0, /* min_sort_char */
255, /* max_sort_char */
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* escape_with_backslash_is_dangerous */
&my_charset_big5_handler,
&my_collation_big5_chinese_ci_handler
};
@ -6435,7 +6435,7 @@ CHARSET_INFO my_charset_big5_bin=
0, /* min_sort_char */
255, /* max_sort_char */
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* escape_with_backslash_is_dangerous */
&my_charset_big5_handler,
&my_collation_mb_bin_handler
};

View File

@ -10048,7 +10048,7 @@ CHARSET_INFO my_charset_gbk_chinese_ci=
0, /* min_sort_char */
255, /* max_sort_char */
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
&my_collation_ci_handler
};
@ -10080,7 +10080,7 @@ CHARSET_INFO my_charset_gbk_bin=
0, /* min_sort_char */
255, /* max_sort_char */
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
&my_collation_mb_bin_handler
};

View File

@ -4696,7 +4696,7 @@ CHARSET_INFO my_charset_sjis_japanese_ci=
0, /* min_sort_char */
255, /* max_sort_char */
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
&my_collation_ci_handler
};
@ -4728,7 +4728,7 @@ CHARSET_INFO my_charset_sjis_bin=
0, /* min_sort_char */
255, /* max_sort_char */
' ', /* pad char */
0, /* escape_with_backslash_is_dangerous */
1, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
&my_collation_mb_bin_handler
};

View File

@ -8074,7 +8074,7 @@ MY_COLLATION_HANDLER my_collation_ucs2_uca_handler =
my_propagate_complex
};
CHARSET_INFO my_charset_ucs2_general_uca=
CHARSET_INFO my_charset_ucs2_unicode_ci=
{
128,0,0, /* number */
MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
@ -8735,7 +8735,7 @@ static uchar ctype_utf8[] = {
extern MY_CHARSET_HANDLER my_charset_utf8_handler;
CHARSET_INFO my_charset_utf8_general_uca_ci=
CHARSET_INFO my_charset_utf8_unicode_ci=
{
192,0,0, /* number */
MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,

View File

@ -264,18 +264,6 @@ my_wc_mb_jisx0201(CHARSET_INFO *cs __attribute__((unused)),
return 1;
}
if (wc == 0x00A5)
{
*s = 0x5C;
return 1;
}
if (wc == 0x203E)
{
*s = 0x7E;
return 1;
}
return MY_CS_ILUNI;
}

View File

@ -123,7 +123,7 @@ static struct my_cs_file_section_st * cs_file_sec(const char *attr, size_t len)
}
#define MY_CS_CSDESCR_SIZE 64
#define MY_CS_TAILORING_SIZE 128
#define MY_CS_TAILORING_SIZE 1024
typedef struct my_cs_file_info
{