Commit 47424c15 authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into  shellback.(none):/home/msvensson/mysql/mysql-5.0

parents 6ac00e38 c316933e
This diff is collapsed.
...@@ -26,9 +26,6 @@ ...@@ -26,9 +26,6 @@
#define USERNAME_LENGTH 16 #define USERNAME_LENGTH 16
#define SERVER_VERSION_LENGTH 60 #define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 5 #define SQLSTATE_LENGTH 5
#define SYSTEM_CHARSET_MBMAXLEN 3
#define NAME_BYTE_LEN NAME_LEN*SYSTEM_CHARSET_MBMAXLEN
#define USERNAME_BYTE_LENGTH USERNAME_LENGTH*SYSTEM_CHARSET_MBMAXLEN
/* /*
USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain
...@@ -36,7 +33,7 @@ ...@@ -36,7 +33,7 @@
MySQL standard format: MySQL standard format:
user_name_part@host_name_part\0 user_name_part@host_name_part\0
*/ */
#define USER_HOST_BUFF_SIZE HOSTNAME_LENGTH + USERNAME_BYTE_LENGTH + 2 #define USER_HOST_BUFF_SIZE HOSTNAME_LENGTH + USERNAME_LENGTH + 2
#define LOCAL_HOST "localhost" #define LOCAL_HOST "localhost"
#define LOCAL_HOST_NAMEDPIPE "." #define LOCAL_HOST_NAMEDPIPE "."
......
...@@ -1340,19 +1340,6 @@ select a from t1 group by a; ...@@ -1340,19 +1340,6 @@ select a from t1 group by a;
a a
e e
drop table t1; drop table t1;
set names utf8;
grant select on test.* to юзер_юзер@localhost;
user()
юзер_юзер@localhost
revoke all on test.* from юзер_юзер@localhost;
drop user юзер_юзер@localhost;
create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
use имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
select database();
database()
имя_базы_в_кодировке_утф8_длиной_больше_чем_45
drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
use test;
CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8; CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa'); INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa');
SELECT id FROM t1; SELECT id FROM t1;
......
This diff is collapsed.
#
# Setup
#
stop slave; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
use test;
drop table if exists t1, t2, t3;
#
# See if queries that use both auto_increment and LAST_INSERT_ID()
# are replicated well
#
# We also check how the foreign_key_check variable is replicated
#
create table t1(a int auto_increment, key(a)); create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b)); create table t2(b int auto_increment, c int, key(b));
insert into t1 values (1),(2),(3); insert into t1 values (1),(2),(3);
...@@ -38,6 +49,9 @@ select * from t2; ...@@ -38,6 +49,9 @@ select * from t2;
b c b c
5 0 5 0
6 11 6 11
#
# check if INSERT SELECT in auto_increment is well replicated (bug #490)
#
drop table t2; drop table t2;
drop table t1; drop table t1;
create table t1(a int auto_increment, key(a)); create table t1(a int auto_increment, key(a));
...@@ -68,12 +82,19 @@ b c ...@@ -68,12 +82,19 @@ b c
9 13 9 13
drop table t1; drop table t1;
drop table t2; drop table t2;
#
# Bug#8412: Error codes reported in binary log for CHARACTER SET,
# FOREIGN_KEY_CHECKS
#
SET TIMESTAMP=1000000000; SET TIMESTAMP=1000000000;
CREATE TABLE t1 ( a INT UNIQUE ); CREATE TABLE t1 ( a INT UNIQUE );
SET FOREIGN_KEY_CHECKS=0; SET FOREIGN_KEY_CHECKS=0;
INSERT INTO t1 VALUES (1),(1); INSERT INTO t1 VALUES (1),(1);
ERROR 23000: Duplicate entry '1' for key 1 ERROR 23000: Duplicate entry '1' for key 1
drop table t1; drop table t1;
#
# Bug#14553: NULL in WHERE resets LAST_INSERT_ID
#
create table t1(a int auto_increment, key(a)); create table t1(a int auto_increment, key(a));
create table t2(a int); create table t2(a int);
insert into t1 (a) values (null); insert into t1 (a) values (null);
...@@ -87,6 +108,9 @@ a ...@@ -87,6 +108,9 @@ a
1 1
drop table t1; drop table t1;
drop table t2; drop table t2;
#
# End of 4.1 tests
#
drop function if exists bug15728; drop function if exists bug15728;
drop function if exists bug15728_insert; drop function if exists bug15728_insert;
drop table if exists t1, t2; drop table if exists t1, t2;
...@@ -210,3 +234,6 @@ n b ...@@ -210,3 +234,6 @@ n b
2 100 2 100
3 350 3 350
drop table t1; drop table t1;
# End of 5.0 tests
...@@ -5,9 +5,15 @@ reset slave; ...@@ -5,9 +5,15 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
stop slave; stop slave;
#
# Generate a big enough master's binlog to cause relay log rotations
#
create table t1 (a int); create table t1 (a int);
drop table t1; drop table t1;
reset slave; reset slave;
#
# Test 1
#
set global max_binlog_size=8192; set global max_binlog_size=8192;
set global max_relay_log_size=8192-1; set global max_relay_log_size=8192-1;
select @@global.max_relay_log_size; select @@global.max_relay_log_size;
...@@ -15,47 +21,251 @@ select @@global.max_relay_log_size; ...@@ -15,47 +21,251 @@ select @@global.max_relay_log_size;
4096 4096
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 72952 # # master-bin.000001 Yes Yes 0 0 72952 # None 0 No # 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 72952
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 72952
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 #
#
# Test 2
#
stop slave; stop slave;
reset slave; reset slave;
set global max_relay_log_size=(5*4096); set global max_relay_log_size=(5*4096);
select @@global.max_relay_log_size; select @@global.max_relay_log_size;
@@global.max_relay_log_size @@global.max_relay_log_size 20480
20480
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 72952 # # master-bin.000001 Yes Yes 0 0 72952 # None 0 No # 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 72952
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 72952
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 #
#
# Test 3: max_relay_log_size = 0
#
stop slave; stop slave;
reset slave; reset slave;
set global max_relay_log_size=0; set global max_relay_log_size=0;
select @@global.max_relay_log_size; select @@global.max_relay_log_size;
@@global.max_relay_log_size @@global.max_relay_log_size 0
0
start slave; start slave;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 72952 # # master-bin.000001 Yes Yes 0 0 72952 # None 0 No # 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 72952
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 72952
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 #
#
# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
#
stop slave; stop slave;
reset slave; reset slave;
flush logs; flush logs;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 4 # # No No 0 0 0 # None 0 No # Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File
Read_Master_Log_Pos 4
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File
Slave_IO_Running No
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 0
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 #
#
# Test 5
#
reset slave; reset slave;
start slave; start slave;
flush logs; flush logs;
create table t1 (a int); create table t1 (a int);
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73038 # # master-bin.000001 Yes Yes 0 0 73038 # None 0 No # 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 73038
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 73038
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 #
#
# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
#
flush logs; flush logs;
drop table t1; drop table t1;
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73114 # # master-bin.000001 Yes Yes 0 0 73114 # None 0 No # 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 73114
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 73114
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 #
flush logs; flush logs;
show master status; show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB File master-bin.000002
master-bin.000002 98 Position 98
Binlog_Do_DB
Binlog_Ignore_DB
#
# End of 4.1 tests
#
...@@ -91,3 +91,19 @@ c ...@@ -91,3 +91,19 @@ c
---> Cleaning up... ---> Cleaning up...
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
create table t1(a int, b int);
insert into t1 values (1, 1), (1, 2), (1, 3);
create view v1(a, b) as select a, sum(b) from t1 group by a;
explain v1;
Field Type Null Key Default Extra
a int(11) YES NULL
b decimal(32,0) YES NULL
show create table v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,sum(`t1`.`b`) AS `b` from `t1` group by `t1`.`a`
select * from v1;
a b
1 6
drop table t1;
drop view v1;
End of 5.0 tests
...@@ -1069,23 +1069,6 @@ explain select a from t1 group by a; ...@@ -1069,23 +1069,6 @@ explain select a from t1 group by a;
select a from t1 group by a; select a from t1 group by a;
drop table t1; drop table t1;
#
# Bug#20393: User name truncation in mysql client
# Bug#21432: Database/Table name limited to 64 bytes, not chars, problems with multi-byte
#
set names utf8;
#create user юзер_юзер@localhost;
grant select on test.* to юзер_юзер@localhost;
--exec $MYSQL --default-character-set=utf8 --user=юзер_юзер -e "select user()"
revoke all on test.* from юзер_юзер@localhost;
drop user юзер_юзер@localhost;
create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
use имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
select database();
drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
use test;
# End of 4.1 tests # End of 4.1 tests
# #
......
This diff is collapsed.
# See if queries that use both auto_increment and LAST_INSERT_ID() --echo #
# are replicated well --echo # Setup
--echo #
# We also check how the foreign_key_check variable is replicated
source include/master-slave.inc; source include/master-slave.inc;
source include/have_innodb.inc; source include/have_innodb.inc;
use test;
--disable_warnings
drop table if exists t1, t2, t3;
--enable_warnings
--echo #
--echo # See if queries that use both auto_increment and LAST_INSERT_ID()
--echo # are replicated well
--echo #
--echo # We also check how the foreign_key_check variable is replicated
--echo #
connection master; connection master;
create table t1(a int auto_increment, key(a)); create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b)); create table t2(b int auto_increment, c int, key(b));
...@@ -39,7 +50,9 @@ select * from t1; ...@@ -39,7 +50,9 @@ select * from t1;
select * from t2; select * from t2;
connection master; connection master;
# check if INSERT SELECT in auto_increment is well replicated (bug #490) --echo #
--echo # check if INSERT SELECT in auto_increment is well replicated (bug #490)
--echo #
drop table t2; drop table t2;
drop table t1; drop table t1;
...@@ -62,10 +75,11 @@ save_master_pos; ...@@ -62,10 +75,11 @@ save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
# --echo #
# Bug#8412: Error codes reported in binary log for CHARACTER SET, --echo # Bug#8412: Error codes reported in binary log for CHARACTER SET,
# FOREIGN_KEY_CHECKS --echo # FOREIGN_KEY_CHECKS
# --echo #
connection master; connection master;
SET TIMESTAMP=1000000000; SET TIMESTAMP=1000000000;
CREATE TABLE t1 ( a INT UNIQUE ); CREATE TABLE t1 ( a INT UNIQUE );
...@@ -78,9 +92,10 @@ connection master; ...@@ -78,9 +92,10 @@ connection master;
drop table t1; drop table t1;
sync_slave_with_master; sync_slave_with_master;
# --echo #
# Bug#14553: NULL in WHERE resets LAST_INSERT_ID --echo # Bug#14553: NULL in WHERE resets LAST_INSERT_ID
# --echo #
connection master; connection master;
create table t1(a int auto_increment, key(a)); create table t1(a int auto_increment, key(a));
create table t2(a int); create table t2(a int);
...@@ -95,8 +110,10 @@ connection master; ...@@ -95,8 +110,10 @@ connection master;
drop table t1; drop table t1;
drop table t2; drop table t2;
sync_slave_with_master; sync_slave_with_master;
# End of 4.1 tests
--echo #
--echo # End of 4.1 tests
--echo #
# #
# BUG#15728: LAST_INSERT_ID function inside a stored function returns 0 # BUG#15728: LAST_INSERT_ID function inside a stored function returns 0
...@@ -227,7 +244,10 @@ select * from t1 order by n; ...@@ -227,7 +244,10 @@ select * from t1 order by n;
connection master; connection master;
drop table t1; drop table t1;
sync_slave_with_master;
--echo
--echo # End of 5.0 tests
--echo
# End of 5.0 tests
sync_slave_with_master;
...@@ -7,7 +7,11 @@ source include/master-slave.inc; ...@@ -7,7 +7,11 @@ source include/master-slave.inc;
connection slave; connection slave;
stop slave; stop slave;
connection master; connection master;
# Generate a big enough master's binlog to cause relay log rotations
--echo #
--echo # Generate a big enough master's binlog to cause relay log rotations
--echo #
create table t1 (a int); create table t1 (a int);
let $1=800; let $1=800;
disable_query_log; disable_query_log;
...@@ -23,6 +27,11 @@ drop table t1; ...@@ -23,6 +27,11 @@ drop table t1;
save_master_pos; save_master_pos;
connection slave; connection slave;
reset slave; reset slave;
--echo #
--echo # Test 1
--echo #
set global max_binlog_size=8192; set global max_binlog_size=8192;
set global max_relay_log_size=8192-1; # mapped to 4096 set global max_relay_log_size=8192-1; # mapped to 4096
select @@global.max_relay_log_size; select @@global.max_relay_log_size;
...@@ -30,7 +39,13 @@ start slave; ...@@ -30,7 +39,13 @@ start slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 # --replace_column 1 # 8 # 9 # 23 # 33 #
--vertical_results
show slave status; show slave status;
--echo #
--echo # Test 2
--echo #
stop slave; stop slave;
reset slave; reset slave;
set global max_relay_log_size=(5*4096); set global max_relay_log_size=(5*4096);
...@@ -39,7 +54,13 @@ start slave; ...@@ -39,7 +54,13 @@ start slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 # --replace_column 1 # 8 # 9 # 23 # 33 #
--vertical_results
show slave status; show slave status;
--echo #
--echo # Test 3: max_relay_log_size = 0
--echo #
stop slave; stop slave;
reset slave; reset slave;
set global max_relay_log_size=0; set global max_relay_log_size=0;
...@@ -48,9 +69,12 @@ start slave; ...@@ -48,9 +69,12 @@ start slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 # --replace_column 1 # 8 # 9 # 23 # 33 #
--vertical_results
show slave status; show slave status;
# Tests below are mainly to ensure that we have not coded with wrong assumptions --echo #
--echo # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
--echo #
stop slave; stop slave;
reset slave; reset slave;
...@@ -59,8 +83,13 @@ reset slave; ...@@ -59,8 +83,13 @@ reset slave;
flush logs; flush logs;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 # --replace_column 1 # 8 # 9 # 23 # 33 #
--vertical_results
show slave status; show slave status;
--echo #
--echo # Test 5
--echo #
reset slave; reset slave;
start slave; start slave;
sync_with_master; sync_with_master;
...@@ -75,8 +104,13 @@ connection slave; ...@@ -75,8 +104,13 @@ connection slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 # --replace_column 1 # 8 # 9 # 23 # 33 #
--vertical_results
show slave status; show slave status;
# one more rotation, to be sure Relay_Log_Space is correctly updated
--echo #
--echo # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
--echo #
flush logs; flush logs;
connection master; connection master;
drop table t1; drop table t1;
...@@ -85,6 +119,7 @@ connection slave; ...@@ -85,6 +119,7 @@ connection slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 # --replace_column 1 # 8 # 9 # 23 # 33 #
--vertical_results
show slave status; show slave status;
connection master; connection master;
...@@ -92,5 +127,6 @@ connection master; ...@@ -92,5 +127,6 @@ connection master;
flush logs; flush logs;
show master status; show master status;
# End of 4.1 tests --echo #
# --echo # End of 4.1 tests
--echo #
...@@ -129,3 +129,24 @@ DROP TABLE t1; ...@@ -129,3 +129,24 @@ DROP TABLE t1;
--sync_with_master --sync_with_master
--connection master --connection master
#
# BUG#19419: "VIEW: View that the column name is different
# by master and slave is made".
#
connection master;
create table t1(a int, b int);
insert into t1 values (1, 1), (1, 2), (1, 3);
create view v1(a, b) as select a, sum(b) from t1 group by a;
sync_slave_with_master;
explain v1;
show create table v1;
select * from v1;
connection master;
drop table t1;
drop view v1;
sync_slave_with_master;
--echo End of 5.0 tests
...@@ -97,11 +97,11 @@ port='@MYSQL_TCP_PORT@' ...@@ -97,11 +97,11 @@ port='@MYSQL_TCP_PORT@'
ldflags='@LDFLAGS@' ldflags='@LDFLAGS@'
# Create options # Create options
# We intentionally add a space to the beginning of lib strings, simplifies replace later # We intentionally add a space to the beginning and end of lib strings, simplifies replace later
libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@" libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@"
libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@" libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@ "
libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@" libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@ "
embedded_libs=" $ldflags -L$pkglibdir -lmysqld @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @innodb_system_libs@ @openssl_libs@" embedded_libs=" $ldflags -L$pkglibdir -lmysqld @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @innodb_system_libs@ @openssl_libs@ "
cflags="-I$pkgincludedir @CFLAGS@ " #note: end space! cflags="-I$pkgincludedir @CFLAGS@ " #note: end space!
include="-I$pkgincludedir" include="-I$pkgincludedir"
...@@ -111,8 +111,9 @@ include="-I$pkgincludedir" ...@@ -111,8 +111,9 @@ include="-I$pkgincludedir"
# and -xstrconst to make --cflags usable for Sun Forte C++ # and -xstrconst to make --cflags usable for Sun Forte C++
for remove in DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX \ for remove in DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX \
DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \ DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \
DEXTRA_DEBUG DHAVE_purify 'O[0-9]' 'W[-A-Za-z]*' \ DEXTRA_DEBUG DHAVE_purify O 'O[0-9]' 'xO[0-9]' 'W[-A-Za-z]*' \
Xa xstrconst "xc99=none" Xa xstrconst "xc99=none" \
unroll2 ip mp restrict
do do
# The first option we might strip will always have a space before it because # The first option we might strip will always have a space before it because
# we set -I$pkgincludedir as the first option # we set -I$pkgincludedir as the first option
...@@ -121,7 +122,7 @@ done ...@@ -121,7 +122,7 @@ done
cflags=`echo "$cflags"|sed -e 's/ *\$//'` cflags=`echo "$cflags"|sed -e 's/ *\$//'`
# Same for --libs(_r) # Same for --libs(_r)
for remove in lmtmalloc for remove in lmtmalloc static-libcxa i-static
do do
# We know the strings starts with a space # We know the strings starts with a space
libs=`echo "$libs"|sed -e "s/ -$remove */ /g"` libs=`echo "$libs"|sed -e "s/ -$remove */ /g"`
......
...@@ -1758,7 +1758,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -1758,7 +1758,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
const char *passwd, const char *db, const char *passwd, const char *db,
uint port, const char *unix_socket,ulong client_flag) uint port, const char *unix_socket,ulong client_flag)
{ {
char buff[NAME_BYTE_LEN+USERNAME_BYTE_LENGTH+100]; char buff[NAME_LEN+USERNAME_LENGTH+100];
char *end,*host_info; char *end,*host_info;
my_socket sock; my_socket sock;
in_addr_t ip_addr; in_addr_t ip_addr;
...@@ -2217,7 +2217,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2217,7 +2217,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
mysql->server_status, client_flag)); mysql->server_status, client_flag));
/* This needs to be changed as it's not useful with big packets */ /* This needs to be changed as it's not useful with big packets */
if (user && user[0]) if (user && user[0])
strmake(end,user,USERNAME_BYTE_LENGTH); /* Max user name */ strmake(end,user,USERNAME_LENGTH); /* Max user name */
else else
read_user_name((char*) end); read_user_name((char*) end);
...@@ -2247,7 +2247,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2247,7 +2247,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
/* Add database if needed */ /* Add database if needed */
if (db && (mysql->server_capabilities & CLIENT_CONNECT_WITH_DB)) if (db && (mysql->server_capabilities & CLIENT_CONNECT_WITH_DB))
{ {
end= strmake(end, db, NAME_BYTE_LEN) + 1; end= strmake(end, db, NAME_LEN) + 1;
mysql->db= my_strdup(db,MYF(MY_WME)); mysql->db= my_strdup(db,MYF(MY_WME));
db= 0; db= 0;
} }
......
...@@ -567,7 +567,7 @@ void get_default_definer(THD *thd, LEX_USER *definer); ...@@ -567,7 +567,7 @@ void get_default_definer(THD *thd, LEX_USER *definer);
LEX_USER *create_default_definer(THD *thd); LEX_USER *create_default_definer(THD *thd);
LEX_USER *create_definer(THD *thd, LEX_STRING *user_name, LEX_STRING *host_name); LEX_USER *create_definer(THD *thd, LEX_STRING *user_name, LEX_STRING *host_name);
LEX_USER *get_current_user(THD *thd, LEX_USER *user); LEX_USER *get_current_user(THD *thd, LEX_USER *user);
bool check_string_length(CHARSET_INFO *cs, LEX_STRING *str, bool check_string_length(LEX_STRING *str,
const char *err_msg, uint max_length); const char *err_msg, uint max_length);
enum enum_mysql_completiontype { enum enum_mysql_completiontype {
......
...@@ -406,7 +406,7 @@ typedef struct st_master_info ...@@ -406,7 +406,7 @@ typedef struct st_master_info
/* the variables below are needed because we can change masters on the fly */ /* the variables below are needed because we can change masters on the fly */
char master_log_name[FN_REFLEN]; char master_log_name[FN_REFLEN];
char host[HOSTNAME_LENGTH+1]; char host[HOSTNAME_LENGTH+1];
char user[USERNAME_BYTE_LENGTH+1]; char user[USERNAME_LENGTH+1];
char password[MAX_PASSWORD_LENGTH+1]; char password[MAX_PASSWORD_LENGTH+1];
my_bool ssl; // enables use of SSL connection if true my_bool ssl; // enables use of SSL connection if true
char ssl_ca[FN_REFLEN], ssl_capath[FN_REFLEN], ssl_cert[FN_REFLEN]; char ssl_ca[FN_REFLEN], ssl_capath[FN_REFLEN], ssl_cert[FN_REFLEN];
......
...@@ -404,16 +404,16 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp, ...@@ -404,16 +404,16 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
{ {
LEX *old_lex= thd->lex, newlex; LEX *old_lex= thd->lex, newlex;
String defstr; String defstr;
char old_db_buf[NAME_BYTE_LEN+1]; char old_db_buf[NAME_LEN+1];
LEX_STRING old_db= { old_db_buf, sizeof(old_db_buf) }; LEX_STRING old_db= { old_db_buf, sizeof(old_db_buf) };
bool dbchanged; bool dbchanged;
ulong old_sql_mode= thd->variables.sql_mode; ulong old_sql_mode= thd->variables.sql_mode;
ha_rows old_select_limit= thd->variables.select_limit; ha_rows old_select_limit= thd->variables.select_limit;
sp_rcontext *old_spcont= thd->spcont; sp_rcontext *old_spcont= thd->spcont;
char definer_user_name_holder[USERNAME_BYTE_LENGTH + 1]; char definer_user_name_holder[USERNAME_LENGTH + 1];
LEX_STRING_WITH_INIT definer_user_name(definer_user_name_holder, LEX_STRING_WITH_INIT definer_user_name(definer_user_name_holder,
USERNAME_BYTE_LENGTH); USERNAME_LENGTH);
char definer_host_name_holder[HOSTNAME_LENGTH + 1]; char definer_host_name_holder[HOSTNAME_LENGTH + 1];
LEX_STRING_WITH_INIT definer_host_name(definer_host_name_holder, LEX_STRING_WITH_INIT definer_host_name(definer_host_name_holder,
...@@ -511,7 +511,7 @@ db_create_routine(THD *thd, int type, sp_head *sp) ...@@ -511,7 +511,7 @@ db_create_routine(THD *thd, int type, sp_head *sp)
int ret; int ret;
TABLE *table; TABLE *table;
char definer[USER_HOST_BUFF_SIZE]; char definer[USER_HOST_BUFF_SIZE];
char old_db_buf[NAME_BYTE_LEN+1]; char old_db_buf[NAME_LEN+1];
LEX_STRING old_db= { old_db_buf, sizeof(old_db_buf) }; LEX_STRING old_db= { old_db_buf, sizeof(old_db_buf) };
bool dbchanged; bool dbchanged;
DBUG_ENTER("db_create_routine"); DBUG_ENTER("db_create_routine");
......
...@@ -924,7 +924,7 @@ bool ...@@ -924,7 +924,7 @@ bool
sp_head::execute(THD *thd) sp_head::execute(THD *thd)
{ {
DBUG_ENTER("sp_head::execute"); DBUG_ENTER("sp_head::execute");
char old_db_buf[NAME_BYTE_LEN+1]; char old_db_buf[NAME_LEN+1];
LEX_STRING old_db= { old_db_buf, sizeof(old_db_buf) }; LEX_STRING old_db= { old_db_buf, sizeof(old_db_buf) };
bool dbchanged; bool dbchanged;
sp_rcontext *ctx; sp_rcontext *ctx;
...@@ -1957,8 +1957,8 @@ sp_head::set_info(longlong created, longlong modified, ...@@ -1957,8 +1957,8 @@ sp_head::set_info(longlong created, longlong modified,
void void
sp_head::set_definer(const char *definer, uint definerlen) sp_head::set_definer(const char *definer, uint definerlen)
{ {
char user_name_holder[USERNAME_BYTE_LENGTH + 1]; char user_name_holder[USERNAME_LENGTH + 1];
LEX_STRING_WITH_INIT user_name(user_name_holder, USERNAME_BYTE_LENGTH); LEX_STRING_WITH_INIT user_name(user_name_holder, USERNAME_LENGTH);
char host_name_holder[HOSTNAME_LENGTH + 1]; char host_name_holder[HOSTNAME_LENGTH + 1];
LEX_STRING_WITH_INIT host_name(host_name_holder, HOSTNAME_LENGTH); LEX_STRING_WITH_INIT host_name(host_name_holder, HOSTNAME_LENGTH);
......
...@@ -54,7 +54,7 @@ static byte* acl_entry_get_key(acl_entry *entry,uint *length, ...@@ -54,7 +54,7 @@ static byte* acl_entry_get_key(acl_entry *entry,uint *length,
} }
#define IP_ADDR_STRLEN (3+1+3+1+3+1+3) #define IP_ADDR_STRLEN (3+1+3+1+3+1+3)
#define ACL_KEY_LENGTH (IP_ADDR_STRLEN+1+NAME_BYTE_LEN+1+USERNAME_BYTE_LENGTH+1) #define ACL_KEY_LENGTH (IP_ADDR_STRLEN+1+NAME_LEN+1+USERNAME_LENGTH+1)
static DYNAMIC_ARRAY acl_hosts,acl_users,acl_dbs; static DYNAMIC_ARRAY acl_hosts,acl_users,acl_dbs;
static MEM_ROOT mem, memex; static MEM_ROOT mem, memex;
...@@ -197,7 +197,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables) ...@@ -197,7 +197,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
READ_RECORD read_record_info; READ_RECORD read_record_info;
my_bool return_val= 1; my_bool return_val= 1;
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE; bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
char tmp_name[NAME_BYTE_LEN+1]; char tmp_name[NAME_LEN+1];
int password_length; int password_length;
DBUG_ENTER("acl_load"); DBUG_ENTER("acl_load");
...@@ -2264,7 +2264,7 @@ static GRANT_NAME *name_hash_search(HASH *name_hash, ...@@ -2264,7 +2264,7 @@ static GRANT_NAME *name_hash_search(HASH *name_hash,
const char *user, const char *tname, const char *user, const char *tname,
bool exact) bool exact)
{ {
char helping [NAME_BYTE_LEN*2+USERNAME_BYTE_LENGTH+3]; char helping [NAME_LEN*2+USERNAME_LENGTH+3];
uint len; uint len;
GRANT_NAME *grant_name,*found=0; GRANT_NAME *grant_name,*found=0;
HASH_SEARCH_STATE state; HASH_SEARCH_STATE state;
...@@ -3167,7 +3167,7 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list, ...@@ -3167,7 +3167,7 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
{ {
List_iterator <LEX_USER> str_list (list); List_iterator <LEX_USER> str_list (list);
LEX_USER *Str, *tmp_Str; LEX_USER *Str, *tmp_Str;
char tmp_db[NAME_BYTE_LEN+1]; char tmp_db[NAME_LEN+1];
bool create_new_users=0; bool create_new_users=0;
TABLE_LIST tables[2]; TABLE_LIST tables[2];
DBUG_ENTER("mysql_grant"); DBUG_ENTER("mysql_grant");
...@@ -3231,7 +3231,7 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list, ...@@ -3231,7 +3231,7 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
{ {
result= TRUE; result= TRUE;
continue; continue;
} }
if (replace_user_table(thd, tables[0].table, *Str, if (replace_user_table(thd, tables[0].table, *Str,
(!db ? rights : 0), revoke_grant, create_new_users, (!db ? rights : 0), revoke_grant, create_new_users,
test(thd->variables.sql_mode & test(thd->variables.sql_mode &
...@@ -3867,7 +3867,7 @@ err2: ...@@ -3867,7 +3867,7 @@ err2:
bool check_grant_db(THD *thd,const char *db) bool check_grant_db(THD *thd,const char *db)
{ {
Security_context *sctx= thd->security_ctx; Security_context *sctx= thd->security_ctx;
char helping [NAME_BYTE_LEN+USERNAME_BYTE_LENGTH+2]; char helping [NAME_LEN+USERNAME_LENGTH+2];
uint len; uint len;
bool error= 1; bool error= 1;
......
...@@ -200,7 +200,7 @@ class MYSQL_LOG: public TC_LOG ...@@ -200,7 +200,7 @@ class MYSQL_LOG: public TC_LOG
IO_CACHE log_file; IO_CACHE log_file;
IO_CACHE index_file; IO_CACHE index_file;
char *name; char *name;
char time_buff[20],db[NAME_BYTE_LEN+1]; char time_buff[20],db[NAME_LEN+1];
char log_file_name[FN_REFLEN],index_file_name[FN_REFLEN]; char log_file_name[FN_REFLEN],index_file_name[FN_REFLEN];
/* /*
The max size before rotation (usable only if log_type == LOG_BIN: binary The max size before rotation (usable only if log_type == LOG_BIN: binary
......
...@@ -1001,8 +1001,8 @@ static int check_connection(THD *thd) ...@@ -1001,8 +1001,8 @@ static int check_connection(THD *thd)
char *passwd= strend(user)+1; char *passwd= strend(user)+1;
uint user_len= passwd - user - 1; uint user_len= passwd - user - 1;
char *db= passwd; char *db= passwd;
char db_buff[NAME_BYTE_LEN + 1]; // buffer to store db in utf8 char db_buff[NAME_LEN + 1]; // buffer to store db in utf8
char user_buff[USERNAME_BYTE_LENGTH + 1]; // buffer to store user in utf8 char user_buff[USERNAME_LENGTH + 1]; // buffer to store user in utf8
uint dummy_errors; uint dummy_errors;
/* /*
...@@ -1662,7 +1662,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1662,7 +1662,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
password. New clients send the size (1 byte) + string (not null password. New clients send the size (1 byte) + string (not null
terminated, so also '\0' for empty string). terminated, so also '\0' for empty string).
*/ */
char db_buff[NAME_BYTE_LEN+1]; // buffer to store db in utf8 char db_buff[NAME_LEN+1]; // buffer to store db in utf8
char *db= passwd; char *db= passwd;
uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ? uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
*passwd++ : strlen(passwd); *passwd++ : strlen(passwd);
...@@ -4765,6 +4765,19 @@ end_with_restore_list: ...@@ -4765,6 +4765,19 @@ end_with_restore_list:
} }
append_identifier(thd, &buff, first_table->table_name, append_identifier(thd, &buff, first_table->table_name,
first_table->table_name_length); first_table->table_name_length);
if (lex->view_list.elements)
{
List_iterator_fast<LEX_STRING> names(lex->view_list);
LEX_STRING *name;
int i;
for (i= 0; name= names++; i++)
{
buff.append(i ? ", " : "(");
append_identifier(thd, &buff, name->str, name->length);
}
buff.append(')');
}
buff.append(STRING_WITH_LEN(" AS ")); buff.append(STRING_WITH_LEN(" AS "));
buff.append(first_table->source.str, first_table->source.length); buff.append(first_table->source.str, first_table->source.length);
...@@ -7552,7 +7565,6 @@ LEX_USER *get_current_user(THD *thd, LEX_USER *user) ...@@ -7552,7 +7565,6 @@ LEX_USER *get_current_user(THD *thd, LEX_USER *user)
SYNOPSIS SYNOPSIS
check_string_length() check_string_length()
cs string charset
str string to be checked str string to be checked
err_msg error message to be displayed if the string is too long err_msg error message to be displayed if the string is too long
max_length max length max_length max length
...@@ -7562,13 +7574,13 @@ LEX_USER *get_current_user(THD *thd, LEX_USER *user) ...@@ -7562,13 +7574,13 @@ LEX_USER *get_current_user(THD *thd, LEX_USER *user)
TRUE the passed string is longer than max_length TRUE the passed string is longer than max_length
*/ */
bool check_string_length(CHARSET_INFO *cs, LEX_STRING *str, bool check_string_length(LEX_STRING *str, const char *err_msg,
const char *err_msg, uint max_length) uint max_length)
{ {
if (cs->cset->charpos(cs, str->str, str->str + str->length, if (str->length <= max_length)
max_length) >= str->length) return FALSE;
return FALSE;
my_error(ER_WRONG_STRING_LENGTH, MYF(0), str->str, err_msg, max_length); my_error(ER_WRONG_STRING_LENGTH, MYF(0), str->str, err_msg, max_length);
return TRUE; return TRUE;
} }
...@@ -22,7 +22,7 @@ typedef struct st_slave_info ...@@ -22,7 +22,7 @@ typedef struct st_slave_info
uint32 server_id; uint32 server_id;
uint32 rpl_recovery_rank, master_id; uint32 rpl_recovery_rank, master_id;
char host[HOSTNAME_LENGTH+1]; char host[HOSTNAME_LENGTH+1];
char user[USERNAME_BYTE_LENGTH+1]; char user[USERNAME_LENGTH+1];
char password[MAX_PASSWORD_LENGTH+1]; char password[MAX_PASSWORD_LENGTH+1];
uint16 port; uint16 port;
THD* thd; THD* thd;
......
...@@ -6921,6 +6921,9 @@ load: LOAD DATA_SYM ...@@ -6921,6 +6921,9 @@ load: LOAD DATA_SYM
YYABORT; YYABORT;
} }
lex->sql_command = SQLCOM_LOAD_MASTER_TABLE; lex->sql_command = SQLCOM_LOAD_MASTER_TABLE;
WARN_DEPRECATED("LOAD TABLE FROM MASTER",
"mysqldump or future "
"BACKUP/RESTORE DATABASE facility");
if (!Select->add_table_to_list(YYTHD, $3, NULL, TL_OPTION_UPDATING)) if (!Select->add_table_to_list(YYTHD, $3, NULL, TL_OPTION_UPDATING))
YYABORT; YYABORT;
}; };
...@@ -6959,6 +6962,9 @@ load_data: ...@@ -6959,6 +6962,9 @@ load_data:
FROM MASTER_SYM FROM MASTER_SYM
{ {
Lex->sql_command = SQLCOM_LOAD_MASTER_DATA; Lex->sql_command = SQLCOM_LOAD_MASTER_DATA;
WARN_DEPRECATED("LOAD DATA FROM MASTER",
"mysqldump or future "
"BACKUP/RESTORE DATABASE facility");
}; };
opt_local: opt_local:
...@@ -7517,7 +7523,7 @@ user: ...@@ -7517,7 +7523,7 @@ user:
$$->host.str= (char *) "%"; $$->host.str= (char *) "%";
$$->host.length= 1; $$->host.length= 1;
if (check_string_length(system_charset_info, &$$->user, if (check_string_length(&$$->user,
ER(ER_USERNAME), USERNAME_LENGTH)) ER(ER_USERNAME), USERNAME_LENGTH))
YYABORT; YYABORT;
} }
...@@ -7528,9 +7534,9 @@ user: ...@@ -7528,9 +7534,9 @@ user:
YYABORT; YYABORT;
$$->user = $1; $$->host=$3; $$->user = $1; $$->host=$3;
if (check_string_length(system_charset_info, &$$->user, if (check_string_length(&$$->user,
ER(ER_USERNAME), USERNAME_LENGTH) || ER(ER_USERNAME), USERNAME_LENGTH) ||
check_string_length(&my_charset_latin1, &$$->host, check_string_length(&$$->host,
ER(ER_HOSTNAME), HOSTNAME_LENGTH)) ER(ER_HOSTNAME), HOSTNAME_LENGTH))
YYABORT; YYABORT;
} }
......
...@@ -1592,7 +1592,7 @@ char *get_field(MEM_ROOT *mem, Field *field) ...@@ -1592,7 +1592,7 @@ char *get_field(MEM_ROOT *mem, Field *field)
bool check_db_name(char *name) bool check_db_name(char *name)
{ {
uint name_length= 0; // name length in symbols char *start= name;
/* Used to catch empty names and names with end space */ /* Used to catch empty names and names with end space */
bool last_char_is_space= TRUE; bool last_char_is_space= TRUE;
...@@ -1609,7 +1609,6 @@ bool check_db_name(char *name) ...@@ -1609,7 +1609,6 @@ bool check_db_name(char *name)
name+system_charset_info->mbmaxlen); name+system_charset_info->mbmaxlen);
if (len) if (len)
{ {
name_length++;
name += len; name += len;
continue; continue;
} }
...@@ -1617,13 +1616,12 @@ bool check_db_name(char *name) ...@@ -1617,13 +1616,12 @@ bool check_db_name(char *name)
#else #else
last_char_is_space= *name==' '; last_char_is_space= *name==' ';
#endif #endif
name_length++;
if (*name == '/' || *name == '\\' || *name == FN_LIBCHAR || if (*name == '/' || *name == '\\' || *name == FN_LIBCHAR ||
*name == FN_EXTCHAR) *name == FN_EXTCHAR)
return 1; return 1;
name++; name++;
} }
return (last_char_is_space || name_length > NAME_LEN); return last_char_is_space || (uint) (name - start) > NAME_LEN;
} }
......
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