Commit 24bdf956 authored by unknown's avatar unknown

Merge bk-internal:/home/bk/mysql-4.0/

into serg.mylan:/usr/home/serg/Abk/mysql-4.0

parents 8fcd7311 c9b59bcc
......@@ -3,7 +3,7 @@
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags -fprofile-arcs -ftest-coverage -fmessage-length=0"
extra_flags="$pentium_cflags -O2 -fprofile-arcs -ftest-coverage -fmessage-length=0 "
extra_configs="$pentium_configs $debug_configs --disable-shared $static_link"
extra_configs="$extra_configs --with-innodb --with-berkeley-db"
......
......@@ -19,7 +19,7 @@
target = libmysqlclient_r.la
target_defs = -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
## LIBS = @LIBS@
LIBS = @LIBS@ @openssl_libs@
INCLUDES = @MT_INCLUDES@ -I$(srcdir)/../include -I../include \
-I$(srcdir)/.. -I$(top_srcdir) -I.. $(openssl_includes)
......
......@@ -267,9 +267,9 @@ int main(int argc, char *argv[])
puts("got error from mi_extra(HA_EXTRA_NO_CACHE)");
goto end;
}
}
if (key_cacheing)
resize_key_cache(key_cache_size*2);
}
if (!silent)
printf("- Delete\n");
......
slave stop;
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;
slave start;
select get_lock("a",5);
get_lock("a",5)
1
create table t1(n int);
insert into t1 values(1+get_lock("a",10)*0);
insert into t1 values(2);
stop slave;
select * from t1;
n
1
show slave status;
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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root 9306 1 master-bin.001 273 slave-relay-bin.002 255 master-bin.001 No No 0 0 214 314
change master to master_user='root';
show slave status;
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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root 9306 1 master-bin.001 214 slave-relay-bin.001 4 master-bin.001 No No 0 0 214 4
select release_lock("a");
release_lock("a")
1
start slave;
select * from t1;
n
1
2
drop table t1;
......@@ -43,7 +43,7 @@ change master to master_user='test';
change master to master_user='root';
show slave status;
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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.001 1442 slave-relay-bin.001 4 master-bin.001 No No 0 0 1442 4
127.0.0.1 root MASTER_PORT 1 master-bin.001 1419 slave-relay-bin.001 4 master-bin.001 No No 0 0 1419 4
set global sql_slave_skip_counter=1;
start slave;
set sql_log_bin=0;
......
source include/master-slave.inc;
connection slave;
select get_lock("a",5);
connection master;
create table t1(n int);
insert into t1 values(1+get_lock("a",10)*0);
insert into t1 values(2);
save_master_pos;
connection slave;
sleep 3; # can't sync_with_master as we should be blocked
stop slave;
select * from t1;
show slave status;
change master to master_user='root';
show slave status;
# Will restart from after the values(2), which is bug
select release_lock("a");
start slave;
sync_with_master;
select * from t1;
connection master;
drop table t1;
save_master_pos;
connection slave;
sync_with_master;
......@@ -669,7 +669,7 @@ static int flush_key_blocks_int(File file, enum flush_type type)
Flush all blocks for a specific file to disk
SYNOPSIS
flush_all_key_blocks()
flush_key_blocks()
file File descriptor
type Type of flush operation
......
......@@ -770,7 +770,9 @@ bool thr_got_alarm(thr_alarm_t *alrm_ptr)
void thr_end_alarm(thr_alarm_t *alrm_ptr)
{
thr_alarm_t alrm= *alrm_ptr;
/* alrm may be zero if thr_alarm aborted with an error */
if (alrm && alrm->crono)
{
KillTimer(NULL, alrm->crono);
alrm->crono = 0;
......
......@@ -114,6 +114,7 @@ SUFFIXES = .sh
-e 's!@''LDFLAGS''@!@SAVE_LDFLAGS@!'\
-e 's!@''CLIENT_LIBS''@!@CLIENT_LIBS@!' \
-e 's!@''LIBS''@!@LIBS@!' \
-e 's!@''WRAPLIBS''@!@WRAPLIBS@!' \
-e 's!@''innodb_system_libs''@!@innodb_system_libs@!' \
-e 's!@''openssl_libs''@!@openssl_libs@!' \
-e 's!@''VERSION''@!@VERSION@!' \
......
......@@ -92,7 +92,7 @@ libs_r="$ldflags -L$pkglibdir -lmysqlclient_r @LIBS@ @openssl_libs@"
libs_r=`echo "$libs_r" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
cflags="-I$pkgincludedir @CFLAGS@"
include="-I$pkgincludedir"
embedded_libs="$ldflags -L$pkglibdir -lmysqld @LIBS@ @innodb_system_libs@"
embedded_libs="$ldflags -L$pkglibdir -lmysqld @LIBS@ @WRAPLIBS@ @innodb_system_libs@"
embedded_libs=`echo "$embedded_libs" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
# Remove some options that a client doesn't have to care about
......
......@@ -18,8 +18,8 @@
mini MySQL client to be included into the server to do server to server
commincation by Sasha Pachev
Note: all file-global symbols must begin with mc_ , even the static ones, just
in case we decide to make them external at some point
Note: all file-global symbols must begin with mc_ , even the static ones,
just in case we decide to make them external at some point
*/
#include <my_global.h>
......@@ -655,6 +655,11 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
sprintf(host_info=buff,ER(CR_TCP_CONNECTION),host);
DBUG_PRINT("info",("Server name: '%s'. TCP sock: %d", host,port));
thr_alarm_init(&alarmed);
/*
We don't have to check status for thr_alarm as it's not fatal if
we didn't manage to set an alarm. (In this case the socket call
will just block for a while).
*/
thr_alarm(&alarmed, net_read_timeout, &alarm_buff);
sock = (my_socket) socket(AF_INET,SOCK_STREAM,0);
thr_end_alarm(&alarmed);
......
......@@ -853,8 +853,8 @@ void kill_zombie_dump_threads(uint32 slave_server_id)
int change_master(THD* thd, MASTER_INFO* mi)
{
int thread_mask;
const char* errmsg=0;
bool need_relay_log_purge=1;
const char* errmsg= 0;
bool need_relay_log_purge= 1;
DBUG_ENTER("change_master");
lock_slave_threads(mi);
......@@ -928,6 +928,36 @@ int change_master(THD* thd, MASTER_INFO* mi)
mi->rli.relay_log_pos=lex_mi->relay_log_pos;
}
/*
If user did specify neither host nor port nor any log name nor any log
pos, i.e. he specified only user/password/master_connect_retry, he probably
wants replication to resume from where it had left, i.e. from the
coordinates of the **SQL** thread (imagine the case where the I/O is ahead
of the SQL; restarting from the coordinates of the I/O would lose some
events which is probably unwanted when you are just doing minor changes
like changing master_connect_retry).
A side-effect is that if only the I/O thread was started, this thread may
restart from ''/4 after the CHANGE MASTER. That's a minor problem (it is a
much more unlikely situation than the one we are fixing here).
Note: coordinates of the SQL thread must be read here, before the
'if (need_relay_log_purge)' block which resets them.
*/
if (!lex_mi->host && !lex_mi->port &&
!lex_mi->log_file_name && !lex_mi->pos &&
need_relay_log_purge)
{
/*
Sometimes mi->rli.master_log_pos == 0 (it happens when the SQL thread is
not initialized), so we use a max().
What happens to mi->rli.master_log_pos during the initialization stages
of replication is not 100% clear, so we guard against problems using
max().
*/
mi->master_log_pos = max(BIN_LOG_HEADER_SIZE, mi->rli.master_log_pos);
strmake(mi->master_log_name,mi->rli.master_log_name,
sizeof(mi->master_log_name)-1);
}
flush_master_info(mi);
if (need_relay_log_purge)
{
......@@ -959,10 +989,21 @@ int change_master(THD* thd, MASTER_INFO* mi)
}
}
DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos));
/* If changing RELAY_LOG_FILE or RELAY_LOG_POS, this will be nonsense: */
/*
Coordinates in rli were spoilt by the 'if (need_relay_log_purge)' block,
so restore them to good values. If we left them to ''/0, that would work;
but that would fail in the case of 2 successive CHANGE MASTER (without a
START SLAVE in between): because first one would set the coords in mi to
the good values of those in rli, the set those in rli to ''/0, then
second CHANGE MASTER would set the coords in mi to those of rli, i.e. to
''/0: we have lost all copies of the original good coordinates.
That's why we always save good coords in rli.
*/
mi->rli.master_log_pos = mi->master_log_pos;
strmake(mi->rli.master_log_name,mi->master_log_name,
sizeof(mi->rli.master_log_name)-1);
if (!mi->rli.master_log_name[0]) // uninitialized case
mi->rli.master_log_pos=0;
......
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