Commit 0610e204 authored by lars@mysql.com's avatar lars@mysql.com

Merge mysql.com:/home/bkroot/mysql-5.0 into mysql.com:/home/bk/mysql-5.0

parents 96ee8cc0 96b0f03f
...@@ -102,6 +102,7 @@ Makefile.in ...@@ -102,6 +102,7 @@ Makefile.in
Makefile.in' Makefile.in'
PENDING/* PENDING/*
TAGS TAGS
VC++Files/client/mysql_amd64.dsp
ac_available_languages_fragment ac_available_languages_fragment
acinclude.m4 acinclude.m4
aclocal.m4 aclocal.m4
...@@ -274,6 +275,8 @@ client/mysqlmanager-pwgen ...@@ -274,6 +275,8 @@ client/mysqlmanager-pwgen
client/mysqlmanagerc client/mysqlmanagerc
client/mysqlshow client/mysqlshow
client/mysqltest client/mysqltest
client/mysqltestmanager-pwgen
client/mysqltestmanagerc
client/mysys_priv.h client/mysys_priv.h
client/select_test client/select_test
client/ssl_test client/ssl_test
...@@ -284,10 +287,12 @@ cmd-line-utils/libedit/common.h ...@@ -284,10 +287,12 @@ cmd-line-utils/libedit/common.h
cmd-line-utils/libedit/makelist cmd-line-utils/libedit/makelist
comon.h comon.h
config.cache config.cache
config.guess
config.h config.h
config.h.in config.h.in
config.log config.log
config.status config.status
config.sub
configure configure
configure.lineno configure.lineno
core core
...@@ -355,6 +360,7 @@ innobase/ib_config.h.in ...@@ -355,6 +360,7 @@ innobase/ib_config.h.in
innobase/stamp-h1 innobase/stamp-h1
insert_test insert_test
install install
install-sh
isam/isamchk isam/isamchk
isam/isamlog isam/isamlog
isam/pack_isam isam/pack_isam
...@@ -519,7 +525,9 @@ linked_libmysqldex_sources ...@@ -519,7 +525,9 @@ linked_libmysqldex_sources
linked_server_sources linked_server_sources
linked_tools_sources linked_tools_sources
locked locked
ltmain.sh
man/*.1 man/*.1
missing
mit-pthreads/config.flags mit-pthreads/config.flags
mit-pthreads/include/bits mit-pthreads/include/bits
mit-pthreads/include/pthread/machdep.h mit-pthreads/include/pthread/machdep.h
...@@ -936,6 +944,7 @@ scripts/mysqld_multi ...@@ -936,6 +944,7 @@ scripts/mysqld_multi
scripts/mysqld_safe scripts/mysqld_safe
scripts/mysqldumpslow scripts/mysqldumpslow
scripts/mysqlhotcopy scripts/mysqlhotcopy
scripts/mysqlhotcopy.sh.rej
scripts/safe_mysqld scripts/safe_mysqld
select_test select_test
server-tools/instance-manager/client.c server-tools/instance-manager/client.c
...@@ -1100,18 +1109,10 @@ tmp/* ...@@ -1100,18 +1109,10 @@ tmp/*
tools/my_vsnprintf.c tools/my_vsnprintf.c
tools/mysqlmanager tools/mysqlmanager
tools/mysqlmngd tools/mysqlmngd
tools/mysqltestmanager
tools/mysys_priv.h tools/mysys_priv.h
vi.h vi.h
vio/test-ssl vio/test-ssl
vio/test-sslclient vio/test-sslclient
vio/test-sslserver vio/test-sslserver
vio/viotest-ssl vio/viotest-ssl
VC++Files/client/mysql_amd64.dsp
client/mysqltestmanager-pwgen
client/mysqltestmanagerc
tools/mysqltestmanager
config.guess
config.sub
install-sh
ltmain.sh
missing
...@@ -52,6 +52,7 @@ dlenev@build.mysql.com ...@@ -52,6 +52,7 @@ dlenev@build.mysql.com
dlenev@jabberwock.localdomain dlenev@jabberwock.localdomain
dlenev@mysql.com dlenev@mysql.com
ejonore@mc03.ndb.mysql.com ejonore@mc03.ndb.mysql.com
elliot@mysql.com
evgen@moonbone.(none) evgen@moonbone.(none)
evgen@moonbone.local evgen@moonbone.local
gbichot@bk-internal.mysql.com gbichot@bk-internal.mysql.com
......
...@@ -107,7 +107,8 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, ...@@ -107,7 +107,8 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
} }
if (keyseg->flag & HA_SPACE_PACK) if (keyseg->flag & HA_SPACE_PACK)
{ {
end=pos+length; FIX_LENGTH(cs, pos, length, char_length);
end= pos + char_length;
if (type != HA_KEYTYPE_NUM) if (type != HA_KEYTYPE_NUM)
{ {
while (end > pos && end[-1] == ' ') while (end > pos && end[-1] == ' ')
...@@ -118,8 +119,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, ...@@ -118,8 +119,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
while (pos < end && pos[0] == ' ') while (pos < end && pos[0] == ' ')
pos++; pos++;
} }
length=(uint) (end-pos); char_length= (uint) (end - pos);
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length); store_key_length_inc(key,char_length);
memcpy((byte*) key,(byte*) pos,(size_t) char_length); memcpy((byte*) key,(byte*) pos,(size_t) char_length);
key+=char_length; key+=char_length;
......
# include/rpl_stmt_seq.inc
#
# Please be very careful when editing this routine, because the handling of
# the $variables is extreme sensitive.
#
######## The typical test sequence
# 1. INSERT without commit
# check table content of master and slave
# 2. EXECUTE the statement
# check table content of master and slave
# 3. ROLLBACK
# check table content of master and slave
# 4. flush the logs
let $VERSION=`select version()`;
--disable_query_log
# SELECT '######## new test sequence ########' as "";
eval SELECT CONCAT('######## ','$my_stmt',' ########') as "";
--enable_query_log
###############################################################
# Predict the number of the current log
###############################################################
# Disable the logging of the log number computation.
--disable_query_log
# $_log_num_n should contain the number of the current binlog in numeric style.
# If this routine is called for the first time, $_log_num will not initialized
# and contain the value '' instead of '1'. So we will correct it here.
#
eval set @aux= IF('$_log_num_n' = '', '1', '$_log_num_n');
let $_log_num_n= `SELECT @aux`;
eval set @aux= LPAD('$_log_num_n',6,'0');
# SELECT @aux AS "@aux is";
#
# $_log_num_s should contain the number of the current binlog in string style.
let $_log_num_s= `select @aux`;
# eval SELECT '$log_num' ;
--enable_query_log
###############################################################
# INSERT
###############################################################
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
# Maybe it would be smarter to use a table with autoincrement column.
let $MAX= `SELECT MAX(f1) FROM t1` ;
eval INSERT INTO t1 SET f1= $MAX + 1;
# results before DDL(to be tested)
SELECT MAX(f1) FROM t1;
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
sync_slave_with_master;
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
# results before DDL(to be tested)
SELECT MAX(f1) FROM t1;
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
###############################################################
# command to be tested
###############################################################
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
eval $my_stmt;
# Devaluate $my_stmt, to detect script bugs
let $my_stmt= ERROR: YOU FORGOT TO FILL IN THE STATEMENT;
# results after DDL(to be tested)
SELECT MAX(f1) FROM t1;
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
sync_slave_with_master;
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
# results after DDL(to be tested)
SELECT MAX(f1) FROM t1;
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
###############################################################
# ROLLBACK
###############################################################
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
ROLLBACK;
# results after final ROLLBACK
SELECT MAX(f1) FROM t1;
# Try to detect if the DDL command caused that the INSERT is committed
# $MAX holds the highest/last value just before the insert of MAX + 1
--disable_query_log
eval SELECT CONCAT(CONCAT('TEST-INFO: MASTER: The INSERT is ',
IF(MAX(f1) = $MAX + 1, 'committed', 'not committed')),
IF((MAX(f1) = $MAX + 1) XOR NOT $my_master_commit,
' (Succeeded)',
' (Failed)')) AS ""
FROM mysqltest1.t1;
--enable_query_log
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
sync_slave_with_master;
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
# results after final ROLLBACK
SELECT MAX(f1) FROM t1;
--disable_query_log
eval SELECT CONCAT(CONCAT('TEST-INFO: SLAVE: The INSERT is ',
IF(MAX(f1) = $MAX + 1, 'committed', 'not committed')),
IF((MAX(f1) = $MAX + 1) XOR NOT $my_slave_commit,
' (Succeeded)',
' (Failed)')) AS ""
FROM mysqltest1.t1;
--enable_query_log
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
###############################################################
# Manipulate binlog
###############################################################
#let $manipulate= 0;
let $manipulate= 1;
while ($manipulate)
{
#### Manipulate the binary logs,
# so that the output of SHOW BINLOG EVENTS IN <current log>
# contains only commands of the current test sequence.
# - flush the master and the slave log
# ---> both start to write into new logs with incremented number
# - increment $_log_num_n
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
flush logs;
# sleep 1;
# eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
sync_slave_with_master;
connection slave;
--disable_query_log
SELECT '-------- switch to slave --------' as "";
--enable_query_log
# the final content of the binary log
flush logs;
# The next sleep is urgent needed.
# Without this sleep the slaves crashes often, when the SHOW BINLOG
# is executed. :-(
# sleep 1;
# eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s';
inc $_log_num_n;
let $manipulate= 0;
}
connection master;
--disable_query_log
SELECT '-------- switch to master -------' as "";
--enable_query_log
...@@ -891,3 +891,14 @@ string ...@@ -891,3 +891,14 @@ string
create table t1 (a varchar(255)) default character set utf8; create table t1 (a varchar(255)) default character set utf8;
insert into t1 values (1.0); insert into t1 values (1.0);
drop table t1; drop table t1;
create table t1 (
id int not null,
city varchar(20) not null,
key (city(7),id)
) character set=utf8;
insert into t1 values (1,'Durban North');
insert into t1 values (2,'Durban');
select * from t1 where city = 'Durban';
id city
2 Durban
drop table t1;
...@@ -909,7 +909,6 @@ set autocommit=0; ...@@ -909,7 +909,6 @@ set autocommit=0;
create table t1 (a int not null) engine= innodb; create table t1 (a int not null) engine= innodb;
insert into t1 values(1),(2); insert into t1 values(1),(2);
truncate table t1; truncate table t1;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
commit; commit;
truncate table t1; truncate table t1;
truncate table t1; truncate table t1;
...@@ -1638,14 +1637,16 @@ t2 CREATE TABLE `t2` ( ...@@ -1638,14 +1637,16 @@ t2 CREATE TABLE `t2` (
drop table t2, t1; drop table t2, t1;
show status like "binlog_cache_use"; show status like "binlog_cache_use";
Variable_name Value Variable_name Value
Binlog_cache_use 153 Binlog_cache_use 24
Binlog_cache_use 25
show status like "binlog_cache_disk_use"; show status like "binlog_cache_disk_use";
Variable_name Value Variable_name Value
Binlog_cache_disk_use 0 Binlog_cache_disk_use 0
create table t1 (a int) engine=innodb; create table t1 (a int) engine=innodb;
show status like "binlog_cache_use"; show status like "binlog_cache_use";
Variable_name Value Variable_name Value
Binlog_cache_use 154 Binlog_cache_use 25
Binlog_cache_use 26
show status like "binlog_cache_disk_use"; show status like "binlog_cache_disk_use";
Variable_name Value Variable_name Value
Binlog_cache_disk_use 1 Binlog_cache_disk_use 1
...@@ -1654,7 +1655,8 @@ delete from t1; ...@@ -1654,7 +1655,8 @@ delete from t1;
commit; commit;
show status like "binlog_cache_use"; show status like "binlog_cache_use";
Variable_name Value Variable_name Value
Binlog_cache_use 155 Binlog_cache_use 26
Binlog_cache_use 27
show status like "binlog_cache_disk_use"; show status like "binlog_cache_disk_use";
Variable_name Value Variable_name Value
Binlog_cache_disk_use 1 Binlog_cache_disk_use 1
......
...@@ -24,7 +24,7 @@ a ...@@ -24,7 +24,7 @@ a
3 3
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 0 Qcache_queries_in_cache 1
drop table t1; drop table t1;
commit; commit;
create table t1 (a int not null) engine=innodb; create table t1 (a int not null) engine=innodb;
......
This diff is collapsed.
...@@ -731,3 +731,17 @@ select ifnull(NULL, _utf8'string'); ...@@ -731,3 +731,17 @@ select ifnull(NULL, _utf8'string');
create table t1 (a varchar(255)) default character set utf8; create table t1 (a varchar(255)) default character set utf8;
insert into t1 values (1.0); insert into t1 values (1.0);
drop table t1; drop table t1;
#
# Bug#10253 compound index length and utf8 char set
# produces invalid query results
#
create table t1 (
id int not null,
city varchar(20) not null,
key (city(7),id)
) character set=utf8;
insert into t1 values (1,'Durban North');
insert into t1 values (2,'Durban');
select * from t1 where city = 'Durban';
drop table t1;
...@@ -596,7 +596,6 @@ show tables from mysqltest; ...@@ -596,7 +596,6 @@ show tables from mysqltest;
set autocommit=0; set autocommit=0;
create table t1 (a int not null) engine= innodb; create table t1 (a int not null) engine= innodb;
insert into t1 values(1),(2); insert into t1 values(1),(2);
--error 1192
truncate table t1; truncate table t1;
commit; commit;
truncate table t1; truncate table t1;
......
This diff is collapsed.
...@@ -746,9 +746,15 @@ sub record_log_pos { ...@@ -746,9 +746,15 @@ sub record_log_pos {
my ($file,$position) = get_row( $dbh, "show master status" ); my ($file,$position) = get_row( $dbh, "show master status" );
die "master status is undefined" if !defined $file || !defined $position; die "master status is undefined" if !defined $file || !defined $position;
my ($master_host, undef, undef, undef, $log_file, $log_pos ) my $row_hash = get_row_hash( $dbh, "show slave status" );
= get_row( $dbh, "show slave status" ); my ($master_host, $log_file, $log_pos );
if ( $dbh->{mysql_serverinfo} =~ /^3\.23/ ) {
($master_host, $log_file, $log_pos )
= @{$row_hash}{ qw / Master_Host Log_File Pos / };
} else {
($master_host, $log_file, $log_pos )
= @{$row_hash}{ qw / Master_Host Master_Log_File Read_Master_Log_Pos / };
}
my $hostname = hostname(); my $hostname = hostname();
$dbh->do( qq{ replace into $table_name $dbh->do( qq{ replace into $table_name
...@@ -773,6 +779,14 @@ sub get_row { ...@@ -773,6 +779,14 @@ sub get_row {
return $sth->fetchrow_array(); return $sth->fetchrow_array();
} }
sub get_row_hash {
my ( $dbh, $sql ) = @_;
my $sth = $dbh->prepare($sql);
$sth->execute;
return $sth->fetchrow_hashref();
}
sub scan_raid_dir { sub scan_raid_dir {
my ( $r_db_files, $data_dir, @raid_dir ) = @_; my ( $r_db_files, $data_dir, @raid_dir ) = @_;
......
...@@ -2740,6 +2740,20 @@ mysql_execute_command(THD *thd) ...@@ -2740,6 +2740,20 @@ mysql_execute_command(THD *thd)
case SQLCOM_CREATE_TABLE: case SQLCOM_CREATE_TABLE:
{ {
/* If CREATE TABLE of non-temporary table, do implicit commit */
if (!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE))
{
if (end_active_trans(thd))
{
res= -1;
break;
}
}
else
{
/* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */
thd->options|= OPTION_STATUS_NO_TRANS_UPDATE;
}
DBUG_ASSERT(first_table == all_tables && first_table != 0); DBUG_ASSERT(first_table == all_tables && first_table != 0);
bool link_to_local; bool link_to_local;
// Skip first table, which is the table we are creating // Skip first table, which is the table we are creating
...@@ -3232,6 +3246,11 @@ mysql_execute_command(THD *thd) ...@@ -3232,6 +3246,11 @@ mysql_execute_command(THD *thd)
break; break;
} }
case SQLCOM_TRUNCATE: case SQLCOM_TRUNCATE:
if (end_active_trans(thd))
{
res= -1;
break;
}
DBUG_ASSERT(first_table == all_tables && first_table != 0); DBUG_ASSERT(first_table == all_tables && first_table != 0);
if (check_one_table_access(thd, DELETE_ACL, all_tables)) if (check_one_table_access(thd, DELETE_ACL, all_tables))
goto error; goto error;
...@@ -3324,6 +3343,9 @@ mysql_execute_command(THD *thd) ...@@ -3324,6 +3343,9 @@ mysql_execute_command(THD *thd)
*/ */
if (thd->slave_thread) if (thd->slave_thread)
lex->drop_if_exists= 1; lex->drop_if_exists= 1;
/* So that DROP TEMPORARY TABLE gets to binlog at commit/rollback */
thd->options|= OPTION_STATUS_NO_TRANS_UPDATE;
} }
res= mysql_rm_table(thd, first_table, lex->drop_if_exists, res= mysql_rm_table(thd, first_table, lex->drop_if_exists,
lex->drop_temporary); lex->drop_temporary);
...@@ -3462,6 +3484,11 @@ mysql_execute_command(THD *thd) ...@@ -3462,6 +3484,11 @@ mysql_execute_command(THD *thd)
break; break;
case SQLCOM_CREATE_DB: case SQLCOM_CREATE_DB:
{ {
if (end_active_trans(thd))
{
res= -1;
break;
}
char *alias; char *alias;
if (!(alias=thd->strdup(lex->name)) || check_db_name(lex->name)) if (!(alias=thd->strdup(lex->name)) || check_db_name(lex->name))
{ {
...@@ -3492,6 +3519,11 @@ mysql_execute_command(THD *thd) ...@@ -3492,6 +3519,11 @@ mysql_execute_command(THD *thd)
} }
case SQLCOM_DROP_DB: case SQLCOM_DROP_DB:
{ {
if (end_active_trans(thd))
{
res= -1;
break;
}
if (check_db_name(lex->name)) if (check_db_name(lex->name))
{ {
my_error(ER_WRONG_DB_NAME, MYF(0), lex->name); my_error(ER_WRONG_DB_NAME, MYF(0), lex->name);
......
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