Merge work:/my/mysql into donna.mysql.com:/home/my/bk/mysql
Docs/manual.texi: Auto merged sql/slave.cc: Auto merged sql/sql_repl.cc: Auto merged
This commit is contained in:
commit
002b51000f
@ -40776,12 +40776,13 @@ not yet 100 % confident in this code.
|
|||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
@item
|
@item
|
||||||
Changed code to get around compiler bug in Compaq C++ on OSF1, that broke
|
Changed code to get around compiler bug in Compaq C++ on OSF1, that broke
|
||||||
@code{BACKUP, RESTORE, CHECK, REPAIR, and ANALYZE TABLE}.
|
@code{BACKUP}, @code{RESTORE}, @code{CHECK}, @code{REPAIR}, and
|
||||||
|
@code{ANALYZE TABLE}.
|
||||||
@item
|
@item
|
||||||
Added option @code{FULL} to @code{SHOW COLUMNS}. Now we only show the
|
Added option @code{FULL} to @code{SHOW COLUMNS}. Now we only show the
|
||||||
privilege list for the columns if this option is given.
|
privilege list for the columns if this option is given.
|
||||||
@item
|
@item
|
||||||
Fixed bug in @code{SHOW LOGS} when there wheren't any BDB logs.
|
Fixed bug in @code{SHOW LOGS} when there weren't any BDB logs.
|
||||||
@item
|
@item
|
||||||
Fixed a timing problem in replication that could delay sending an update
|
Fixed a timing problem in replication that could delay sending an update
|
||||||
to the client until a new update was done.
|
to the client until a new update was done.
|
||||||
@ -40791,13 +40792,13 @@ to keep this code compatible with @code{SHOW FIELDS}.
|
|||||||
@item
|
@item
|
||||||
@code{MERGE} tables didn't work on windows.
|
@code{MERGE} tables didn't work on windows.
|
||||||
@item
|
@item
|
||||||
Fixed problem with @code{SET PASSWORD=...} on windows.
|
Fixed problem with @code{SET PASSWORD=...} on Windows.
|
||||||
@item
|
@item
|
||||||
Added missing @file{my_config.h} to RPM distribution.
|
Added missing @file{my_config.h} to RPM distribution.
|
||||||
@item
|
@item
|
||||||
@code{TRIM("foo" from "foo")} didn't return an empty string.
|
@code{TRIM("foo" from "foo")} didn't return an empty string.
|
||||||
@item
|
@item
|
||||||
Added @code{--with-version-suffix} to configure.
|
Added @code{--with-version-suffix} to @code{configure}.
|
||||||
@item
|
@item
|
||||||
Fixed coredump when client aborted connection without @code{mysql_close()}.
|
Fixed coredump when client aborted connection without @code{mysql_close()}.
|
||||||
@item
|
@item
|
||||||
|
@ -485,14 +485,19 @@ int do_echo(struct st_query* q)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int do_sync_with_master()
|
int do_sync_with_master(struct st_query* q)
|
||||||
{
|
{
|
||||||
MYSQL_RES* res;
|
MYSQL_RES* res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
MYSQL* mysql = &cur_con->mysql;
|
MYSQL* mysql = &cur_con->mysql;
|
||||||
char query_buf[FN_REFLEN+128];
|
char query_buf[FN_REFLEN+128];
|
||||||
|
int offset = 0;
|
||||||
|
char* p = q->first_argument;
|
||||||
|
if(*p)
|
||||||
|
offset = atoi(p);
|
||||||
|
|
||||||
sprintf(query_buf, "select master_pos_wait('%s', %ld)", master_pos.file,
|
sprintf(query_buf, "select master_pos_wait('%s', %ld)", master_pos.file,
|
||||||
master_pos.pos);
|
master_pos.pos + offset);
|
||||||
if(mysql_query(mysql, query_buf))
|
if(mysql_query(mysql, query_buf))
|
||||||
die("At line %u: failed in %s: %d: %s", start_lineno, query_buf,
|
die("At line %u: failed in %s: %d: %s", start_lineno, query_buf,
|
||||||
mysql_errno(mysql), mysql_error(mysql));
|
mysql_errno(mysql), mysql_error(mysql));
|
||||||
@ -1458,7 +1463,7 @@ int main(int argc, char** argv)
|
|||||||
q->require_file=require_file;
|
q->require_file=require_file;
|
||||||
save_file[0]=0;
|
save_file[0]=0;
|
||||||
}
|
}
|
||||||
error |= run_query(&cur_con->mysql, q, QUERY_SEND|QUERY_REAP);
|
error |= run_query(&cur_con->mysql, q, flags);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Q_SEND:
|
case Q_SEND:
|
||||||
|
@ -425,7 +425,7 @@ extern int my_printf_error _VARARGS((uint my_err, const char *format,
|
|||||||
__attribute__ ((format (printf, 2, 4))));
|
__attribute__ ((format (printf, 2, 4))));
|
||||||
extern int my_vsnprintf( char *str, size_t n,
|
extern int my_vsnprintf( char *str, size_t n,
|
||||||
const char *format, va_list ap );
|
const char *format, va_list ap );
|
||||||
|
extern int my_snprintf(char* to, size_t n, const char* fmt, ...);
|
||||||
extern int my_message(uint my_err, const char *str,myf MyFlags);
|
extern int my_message(uint my_err, const char *str,myf MyFlags);
|
||||||
extern int my_message_no_curses(uint my_err, const char *str,myf MyFlags);
|
extern int my_message_no_curses(uint my_err, const char *str,myf MyFlags);
|
||||||
extern int my_message_curses(uint my_err, const char *str,myf MyFlags);
|
extern int my_message_curses(uint my_err, const char *str,myf MyFlags);
|
||||||
|
@ -198,4 +198,9 @@
|
|||||||
#define ER_CRASHED_ON_REPAIR 1195
|
#define ER_CRASHED_ON_REPAIR 1195
|
||||||
#define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196
|
#define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196
|
||||||
#define ER_TRANS_CACHE_FULL 1197
|
#define ER_TRANS_CACHE_FULL 1197
|
||||||
#define ER_ERROR_MESSAGES 198
|
#define ER_SLAVE_MUST_STOP 1198
|
||||||
|
#define ER_SLAVE_NOT_RUNNING 1199
|
||||||
|
#define ER_BAD_SLAVE 1200
|
||||||
|
#define ER_MASTER_INFO 1201
|
||||||
|
#define ER_SLAVE_THREAD 1202
|
||||||
|
#define ER_ERROR_MESSAGES 203
|
||||||
|
@ -72,6 +72,7 @@ cd ..
|
|||||||
BASEDIR=`pwd`
|
BASEDIR=`pwd`
|
||||||
cd $CWD
|
cd $CWD
|
||||||
MYSQL_TEST_DIR=$BASEDIR/mysql-test
|
MYSQL_TEST_DIR=$BASEDIR/mysql-test
|
||||||
|
export MYSQL_TEST_DIR
|
||||||
STD_DATA=$MYSQL_TEST_DIR/std_data
|
STD_DATA=$MYSQL_TEST_DIR/std_data
|
||||||
hostname=`hostname` # Installed in the mysql privilege table
|
hostname=`hostname` # Installed in the mysql privilege table
|
||||||
|
|
||||||
@ -336,6 +337,11 @@ gcov_collect () {
|
|||||||
start_master()
|
start_master()
|
||||||
{
|
{
|
||||||
[ x$MASTER_RUNNING = 1 ] && return
|
[ x$MASTER_RUNNING = 1 ] && return
|
||||||
|
#run master initialization shell script if one exists
|
||||||
|
if [ -f "$master_init_script" ] ;
|
||||||
|
then
|
||||||
|
/bin/sh $master_init_script
|
||||||
|
fi
|
||||||
cd $BASEDIR # for gcov
|
cd $BASEDIR # for gcov
|
||||||
# Remove old berkeley db log files that can confuse the server
|
# Remove old berkeley db log files that can confuse the server
|
||||||
$RM -f $MASTER_MYDDIR/log.*
|
$RM -f $MASTER_MYDDIR/log.*
|
||||||
@ -375,6 +381,13 @@ start_slave()
|
|||||||
{
|
{
|
||||||
[ x$SKIP_SLAVE = x1 ] && return
|
[ x$SKIP_SLAVE = x1 ] && return
|
||||||
[ x$SLAVE_RUNNING = 1 ] && return
|
[ x$SLAVE_RUNNING = 1 ] && return
|
||||||
|
|
||||||
|
#run slave initialization shell script if one exists
|
||||||
|
if [ -f "$slave_init_script" ] ;
|
||||||
|
then
|
||||||
|
/bin/sh $slave_init_script
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$SLAVE_MASTER_INFO" ] ; then
|
if [ -z "$SLAVE_MASTER_INFO" ] ; then
|
||||||
master_info="--master-user=root \
|
master_info="--master-user=root \
|
||||||
--master-connect-retry=1 \
|
--master-connect-retry=1 \
|
||||||
@ -502,6 +515,8 @@ run_testcase ()
|
|||||||
tname=`$BASENAME $tf .test`
|
tname=`$BASENAME $tf .test`
|
||||||
master_opt_file=$TESTDIR/$tname-master.opt
|
master_opt_file=$TESTDIR/$tname-master.opt
|
||||||
slave_opt_file=$TESTDIR/$tname-slave.opt
|
slave_opt_file=$TESTDIR/$tname-slave.opt
|
||||||
|
master_init_script=$TESTDIR/$tname-master.sh
|
||||||
|
slave_init_script=$TESTDIR/$tname-slave.sh
|
||||||
slave_master_info_file=$TESTDIR/$tname-slave-master-info.opt
|
slave_master_info_file=$TESTDIR/$tname-slave-master-info.opt
|
||||||
SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0`
|
SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0`
|
||||||
|
|
||||||
|
@ -37,3 +37,7 @@ k
|
|||||||
223
|
223
|
||||||
245
|
245
|
||||||
267
|
267
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 restore status OK
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 backup status OK
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
File Position Binlog_do_db Binlog_ignore_db
|
File Position Binlog_do_db Binlog_ignore_db
|
||||||
master-bin.001 73
|
master-bin.001 73
|
||||||
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
|
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
|
||||||
127.0.0.1 root 9306 1 master-bin.001 73 Yes
|
127.0.0.1 root 9306 1 master-bin.001 73 Yes 0 0
|
||||||
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
|
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
|
||||||
127.0.0.1 root 9306 1 master-bin.001 73 No
|
127.0.0.1 root 9306 1 master-bin.001 73 No 0 0
|
||||||
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
|
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
|
||||||
127.0.0.1 root 9306 1 master-bin.001 73 Yes
|
127.0.0.1 root 9306 1 master-bin.001 73 Yes 0 0
|
||||||
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
|
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
|
||||||
127.0.0.1 root 9306 1 master-bin.001 173 Yes
|
127.0.0.1 root 9306 1 master-bin.001 173 Yes 0 0
|
||||||
File Position Binlog_do_db Binlog_ignore_db
|
File Position Binlog_do_db Binlog_ignore_db
|
||||||
master-bin.001 73
|
master-bin.001 73
|
||||||
n
|
n
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
File Position Binlog_do_db Binlog_ignore_db
|
File Position Binlog_do_db Binlog_ignore_db
|
||||||
master-bin.001 73
|
master-bin.001 73
|
||||||
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
|
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
|
||||||
0 0 0 No
|
0 0 0 No 0 0
|
||||||
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
|
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
|
||||||
127.0.0.1 test 3306 60 4 No
|
127.0.0.1 test 3306 60 4 No 0 0
|
||||||
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
|
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
|
||||||
127.0.0.1 root 9306 60 4 No
|
127.0.0.1 root 9306 60 4 No 0 0
|
||||||
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
|
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
|
||||||
127.0.0.1 root 9306 60 master-bin.001 73 Yes
|
127.0.0.1 root 9306 60 master-bin.001 73 Yes 0 0
|
||||||
n
|
n
|
||||||
10
|
10
|
||||||
45
|
45
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
|
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
|
||||||
127.0.0.1 root 9306 60 master-bin.001 216 Yes
|
127.0.0.1 root 9306 60 master-bin.001 216 Yes 0 0
|
||||||
s
|
s
|
||||||
Could not break slave
|
Could not break slave
|
||||||
Tried hard
|
Tried hard
|
||||||
@ -9,10 +9,17 @@ master-bin.002
|
|||||||
master-bin.003
|
master-bin.003
|
||||||
Log_name
|
Log_name
|
||||||
master-bin.003
|
master-bin.003
|
||||||
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
|
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
|
||||||
127.0.0.1 root 9306 60 master-bin.003 128 Yes
|
127.0.0.1 root 9306 60 master-bin.003 184 Yes 0 0
|
||||||
m
|
m
|
||||||
34
|
34
|
||||||
|
65
|
||||||
67
|
67
|
||||||
123
|
123
|
||||||
65
|
1234
|
||||||
|
Log_name
|
||||||
|
master-bin.003
|
||||||
|
master-bin.004
|
||||||
|
master-bin.005
|
||||||
|
count(*)
|
||||||
|
100
|
||||||
|
2
mysql-test/r/rpl000017.result
Normal file
2
mysql-test/r/rpl000017.result
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
n
|
||||||
|
24
|
@ -26,6 +26,19 @@ select n from t1;
|
|||||||
select m from t2;
|
select m from t2;
|
||||||
select k from t3;
|
select k from t3;
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
#restore table t1 from '../tmp';
|
restore table t1 from '../tmp';
|
||||||
#connection con2;
|
connection con2;
|
||||||
#lock tables t1 write;
|
send lock tables t1 write;
|
||||||
|
connection con1;
|
||||||
|
send backup table t1 to '../tmp';
|
||||||
|
connection con2;
|
||||||
|
reap;
|
||||||
|
unlock tables;
|
||||||
|
connection con1;
|
||||||
|
reap;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,20 +10,26 @@ connection master1;
|
|||||||
create temporary table t1 (n int);
|
create temporary table t1 (n int);
|
||||||
insert into t1 values (4),(5);
|
insert into t1 values (4),(5);
|
||||||
insert into t2 select * from t1;
|
insert into t2 select * from t1;
|
||||||
|
save_master_pos;
|
||||||
disconnect master;
|
disconnect master;
|
||||||
|
connection slave;
|
||||||
|
|
||||||
|
#add 1 to the saved position, so we will catch drop table on disconnect
|
||||||
|
#for sure
|
||||||
|
sync_with_master 1;
|
||||||
connection master1;
|
connection master1;
|
||||||
insert into t2 values(6);
|
insert into t2 values(6);
|
||||||
disconnect master1;
|
|
||||||
connect (master2,localhost,root,,test,0,mysql-master.sock);
|
|
||||||
connection master2;
|
|
||||||
save_master_pos;
|
save_master_pos;
|
||||||
|
disconnect master1;
|
||||||
connection slave;
|
connection slave;
|
||||||
sync_with_master;
|
#same trick - make sure we catch drop of temporary table on disconnect
|
||||||
|
sync_with_master 1;
|
||||||
@r/rpl000012.result select * from t2;
|
@r/rpl000012.result select * from t2;
|
||||||
@r/rpl000012.status.result show status like 'Slave_open_temp_tables';
|
@r/rpl000012.status.result show status like 'Slave_open_temp_tables';
|
||||||
#
|
#
|
||||||
# Clean up
|
# Clean up
|
||||||
#
|
#
|
||||||
|
connect (master2,localhost,root,,test,0,mysql-master.sock);
|
||||||
connection master2;
|
connection master2;
|
||||||
drop table if exists t1,t2;
|
drop table if exists t1,t2;
|
||||||
save_master_pos;
|
save_master_pos;
|
||||||
|
@ -13,20 +13,24 @@ connection master1;
|
|||||||
create temporary table t1 (n int);
|
create temporary table t1 (n int);
|
||||||
insert into t1 values (4),(5);
|
insert into t1 values (4),(5);
|
||||||
insert into t2 select * from t1;
|
insert into t2 select * from t1;
|
||||||
|
save_master_pos;
|
||||||
disconnect master;
|
disconnect master;
|
||||||
|
connection slave;
|
||||||
|
#add 1 to catch drop table
|
||||||
|
sync_with_master 1;
|
||||||
connection master1;
|
connection master1;
|
||||||
insert into t2 values(6);
|
insert into t2 values(6);
|
||||||
disconnect master1;
|
|
||||||
connect (master2,localhost,root,,test,0,mysql-master.sock);
|
|
||||||
connection master2;
|
|
||||||
save_master_pos;
|
save_master_pos;
|
||||||
|
disconnect master1;
|
||||||
connection slave;
|
connection slave;
|
||||||
sync_with_master;
|
# same trick to go one more event
|
||||||
|
sync_with_master 1;
|
||||||
@r/rpl000013.result select * from t2;
|
@r/rpl000013.result select * from t2;
|
||||||
@r/rpl000013.status.result show status like 'Slave_open_temp_tables';
|
@r/rpl000013.status.result show status like 'Slave_open_temp_tables';
|
||||||
#
|
#
|
||||||
# Clean up
|
# Clean up
|
||||||
#
|
#
|
||||||
|
connect (master2,localhost,root,,test,0,mysql-master.sock);
|
||||||
connection master2;
|
connection master2;
|
||||||
drop table if exists t1,t2;
|
drop table if exists t1,t2;
|
||||||
save_master_pos;
|
save_master_pos;
|
||||||
|
1
mysql-test/t/rpl000016-master.opt
Normal file
1
mysql-test/t/rpl000016-master.opt
Normal file
@ -0,0 +1 @@
|
|||||||
|
-O max_binlog_size=2048
|
@ -26,10 +26,40 @@ select * from t1;
|
|||||||
connection master;
|
connection master;
|
||||||
flush logs;
|
flush logs;
|
||||||
drop table if exists t2;
|
drop table if exists t2;
|
||||||
create table t2(m int);
|
create table t2(m int not null primary key);
|
||||||
insert into t2 values (34),(67),(123);
|
insert into t2 values (34),(67),(123);
|
||||||
|
save_master_pos;
|
||||||
flush logs;
|
flush logs;
|
||||||
show master logs;
|
show master logs;
|
||||||
|
|
||||||
|
#now lets make some duplicate key mess and see if we can recover from it
|
||||||
|
|
||||||
|
#first insert a value on the slave
|
||||||
|
connection slave;
|
||||||
|
sync_with_master;
|
||||||
|
insert into t2 values(1234);
|
||||||
|
|
||||||
|
#same value on the master
|
||||||
|
connection master;
|
||||||
|
save_master_pos;
|
||||||
|
insert into t2 values(1234);
|
||||||
|
connection slave;
|
||||||
|
sync_with_master;
|
||||||
|
|
||||||
|
#the slave may have already stopped, so we ignore the error
|
||||||
|
!slave stop;
|
||||||
|
|
||||||
|
#restart slave skipping one event
|
||||||
|
set sql_slave_skip_counter=1;
|
||||||
|
slave start;
|
||||||
|
|
||||||
|
connection master;
|
||||||
|
save_master_pos;
|
||||||
|
|
||||||
|
#let slave catch up
|
||||||
|
connection slave;
|
||||||
|
sync_with_master;
|
||||||
|
connection master;
|
||||||
purge master logs to 'master-bin.003';
|
purge master logs to 'master-bin.003';
|
||||||
show master logs;
|
show master logs;
|
||||||
insert into t2 values (65);
|
insert into t2 values (65);
|
||||||
@ -38,6 +68,25 @@ connection slave;
|
|||||||
sync_with_master;
|
sync_with_master;
|
||||||
show slave status;
|
show slave status;
|
||||||
select * from t2;
|
select * from t2;
|
||||||
drop table if exists t1,t2;
|
|
||||||
connection master;
|
connection master;
|
||||||
drop table if exists t1,t2;
|
let $1=100;
|
||||||
|
drop table if exists t3;
|
||||||
|
create table t3 (n int);
|
||||||
|
while ($1)
|
||||||
|
{
|
||||||
|
insert into t3 values(4);
|
||||||
|
dec $1;
|
||||||
|
}
|
||||||
|
show master logs;
|
||||||
|
save_master_pos;
|
||||||
|
connection slave;
|
||||||
|
slave stop;
|
||||||
|
slave start;
|
||||||
|
sync_with_master;
|
||||||
|
select count(*) from t3 where n = 4;
|
||||||
|
#clean up
|
||||||
|
connection master;
|
||||||
|
drop table if exists t1,t2,t3;
|
||||||
|
save_master_pos;
|
||||||
|
connection slave;
|
||||||
|
sync_with_master;
|
||||||
|
1
mysql-test/t/rpl000017-slave.opt
Normal file
1
mysql-test/t/rpl000017-slave.opt
Normal file
@ -0,0 +1 @@
|
|||||||
|
--skip-slave-start
|
9
mysql-test/t/rpl000017-slave.sh
Executable file
9
mysql-test/t/rpl000017-slave.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
cat > $MYSQL_TEST_DIR/var/slave-data/master.info <<EOF
|
||||||
|
master-bin.001
|
||||||
|
4
|
||||||
|
127.0.0.1
|
||||||
|
root
|
||||||
|
|
||||||
|
9306
|
||||||
|
1
|
||||||
|
EOF
|
19
mysql-test/t/rpl000017.test
Normal file
19
mysql-test/t/rpl000017.test
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
connect (master,localhost,root,,test,0,mysql-master.sock);
|
||||||
|
connect (slave,localhost,root,,test,0,mysql-slave.sock);
|
||||||
|
connection master;
|
||||||
|
reset master;
|
||||||
|
connection slave;
|
||||||
|
slave start;
|
||||||
|
connection master;
|
||||||
|
drop table if exists t1;
|
||||||
|
create table t1(n int);
|
||||||
|
insert into t1 values(24);
|
||||||
|
save_master_pos;
|
||||||
|
connection slave;
|
||||||
|
sync_with_master;
|
||||||
|
select * from t1;
|
||||||
|
connection master;
|
||||||
|
drop table t1;
|
||||||
|
save_master_pos;
|
||||||
|
connection slave;
|
||||||
|
sync_with_master;
|
@ -40,7 +40,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
|
|||||||
myf MyFlags __attribute__((unused)))
|
myf MyFlags __attribute__((unused)))
|
||||||
{
|
{
|
||||||
File file= -1;
|
File file= -1;
|
||||||
DBUG_ENTER("open_temp_file");
|
DBUG_ENTER("create_temp_file");
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
{
|
{
|
||||||
char temp[FN_REFLEN],*end,*res,**old_env,*temp_env[1];
|
char temp[FN_REFLEN],*end,*res,**old_env,*temp_env[1];
|
||||||
|
@ -21,6 +21,13 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <m_ctype.h>
|
#include <m_ctype.h>
|
||||||
|
|
||||||
|
int my_snprintf(char* to, size_t n, const char* fmt, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start(args,fmt);
|
||||||
|
return my_vsnprintf(to, n, fmt, args);
|
||||||
|
}
|
||||||
|
|
||||||
int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
|
int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
|
||||||
{
|
{
|
||||||
char *start=to, *end=to+n-1;
|
char *start=to, *end=to+n-1;
|
||||||
|
@ -472,7 +472,7 @@ int main(int argc,char **argv)
|
|||||||
int error;
|
int error;
|
||||||
|
|
||||||
MY_INIT(argv[0]);
|
MY_INIT(argv[0]);
|
||||||
start_value=4424889L; best_t1=3207460L; best_t2=481534L; best_type=0; /* mode=4451 add=8 type: 0 */
|
start_value=5315771L; best_t1=6916833L; best_t2=3813748L; best_type=3; /* mode=5839 add=5 type: 0 */
|
||||||
if (get_options(argc,(char **) argv))
|
if (get_options(argc,(char **) argv))
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
|
@ -283,6 +283,7 @@ static SYMBOL symbols[] = {
|
|||||||
{ "SQL_QUOTE_SHOW_CREATE",SYM(SQL_QUOTE_SHOW_CREATE), 0, 0},
|
{ "SQL_QUOTE_SHOW_CREATE",SYM(SQL_QUOTE_SHOW_CREATE), 0, 0},
|
||||||
{ "SQL_SAFE_UPDATES", SYM(SQL_SAFE_UPDATES),0,0},
|
{ "SQL_SAFE_UPDATES", SYM(SQL_SAFE_UPDATES),0,0},
|
||||||
{ "SQL_SELECT_LIMIT", SYM(SQL_SELECT_LIMIT),0,0},
|
{ "SQL_SELECT_LIMIT", SYM(SQL_SELECT_LIMIT),0,0},
|
||||||
|
{ "SQL_SLAVE_SKIP_COUNTER", SYM(SQL_SLAVE_SKIP_COUNTER),0,0},
|
||||||
{ "SQL_SMALL_RESULT", SYM(SQL_SMALL_RESULT),0,0},
|
{ "SQL_SMALL_RESULT", SYM(SQL_SMALL_RESULT),0,0},
|
||||||
{ "SQL_WARNINGS", SYM(SQL_WARNINGS),0,0},
|
{ "SQL_WARNINGS", SYM(SQL_WARNINGS),0,0},
|
||||||
{ "STRAIGHT_JOIN", SYM(STRAIGHT_JOIN),0,0},
|
{ "STRAIGHT_JOIN", SYM(STRAIGHT_JOIN),0,0},
|
||||||
|
16
sql/log.cc
16
sql/log.cc
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log;
|
MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log;
|
||||||
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
|
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
|
||||||
|
extern ulong max_binlog_size;
|
||||||
|
|
||||||
static bool test_if_number(const char *str,
|
static bool test_if_number(const char *str,
|
||||||
long *res, bool allow_wildcards);
|
long *res, bool allow_wildcards);
|
||||||
@ -609,6 +610,8 @@ bool MYSQL_LOG::write(Query_log_event* event_info)
|
|||||||
{
|
{
|
||||||
/* In most cases this is only called if 'is_open()' is true */
|
/* In most cases this is only called if 'is_open()' is true */
|
||||||
bool error=0;
|
bool error=0;
|
||||||
|
bool should_rotate = 0;
|
||||||
|
|
||||||
if (!inited) // Can't use mutex if not init
|
if (!inited) // Can't use mutex if not init
|
||||||
return 0;
|
return 0;
|
||||||
VOID(pthread_mutex_lock(&LOCK_log));
|
VOID(pthread_mutex_lock(&LOCK_log));
|
||||||
@ -655,7 +658,7 @@ bool MYSQL_LOG::write(Query_log_event* event_info)
|
|||||||
file == &log_file && flush_io_cache(file))
|
file == &log_file && flush_io_cache(file))
|
||||||
goto err;
|
goto err;
|
||||||
error=0;
|
error=0;
|
||||||
|
should_rotate = (file == &log_file && my_b_tell(file) >= max_binlog_size);
|
||||||
err:
|
err:
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
@ -669,6 +672,8 @@ err:
|
|||||||
VOID(pthread_cond_broadcast(&COND_binlog_update));
|
VOID(pthread_cond_broadcast(&COND_binlog_update));
|
||||||
}
|
}
|
||||||
VOID(pthread_mutex_unlock(&LOCK_log));
|
VOID(pthread_mutex_unlock(&LOCK_log));
|
||||||
|
if(should_rotate)
|
||||||
|
new_file();
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -682,6 +687,7 @@ bool MYSQL_LOG::write(IO_CACHE *cache)
|
|||||||
{
|
{
|
||||||
VOID(pthread_mutex_lock(&LOCK_log));
|
VOID(pthread_mutex_lock(&LOCK_log));
|
||||||
bool error=1;
|
bool error=1;
|
||||||
|
|
||||||
if (is_open())
|
if (is_open())
|
||||||
{
|
{
|
||||||
uint length;
|
uint length;
|
||||||
@ -723,6 +729,7 @@ err:
|
|||||||
VOID(pthread_cond_broadcast(&COND_binlog_update));
|
VOID(pthread_cond_broadcast(&COND_binlog_update));
|
||||||
|
|
||||||
VOID(pthread_mutex_unlock(&LOCK_log));
|
VOID(pthread_mutex_unlock(&LOCK_log));
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -730,6 +737,8 @@ err:
|
|||||||
bool MYSQL_LOG::write(Load_log_event* event_info)
|
bool MYSQL_LOG::write(Load_log_event* event_info)
|
||||||
{
|
{
|
||||||
bool error=0;
|
bool error=0;
|
||||||
|
bool should_rotate = 0;
|
||||||
|
|
||||||
if (inited)
|
if (inited)
|
||||||
{
|
{
|
||||||
VOID(pthread_mutex_lock(&LOCK_log));
|
VOID(pthread_mutex_lock(&LOCK_log));
|
||||||
@ -745,11 +754,16 @@ bool MYSQL_LOG::write(Load_log_event* event_info)
|
|||||||
sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
|
sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
|
||||||
error=write_error=1;
|
error=write_error=1;
|
||||||
}
|
}
|
||||||
|
should_rotate = (my_b_tell(&log_file) >= max_binlog_size);
|
||||||
VOID(pthread_cond_broadcast(&COND_binlog_update));
|
VOID(pthread_cond_broadcast(&COND_binlog_update));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VOID(pthread_mutex_unlock(&LOCK_log));
|
VOID(pthread_mutex_unlock(&LOCK_log));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(should_rotate)
|
||||||
|
new_file();
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size,
|
|||||||
query_buff_size, lower_case_table_names, mysqld_net_retry_count,
|
query_buff_size, lower_case_table_names, mysqld_net_retry_count,
|
||||||
net_interactive_timeout, slow_launch_time = 2L,
|
net_interactive_timeout, slow_launch_time = 2L,
|
||||||
net_read_timeout,net_write_timeout,slave_open_temp_tables=0,
|
net_read_timeout,net_write_timeout,slave_open_temp_tables=0,
|
||||||
open_files_limit=0;
|
open_files_limit=0, max_binlog_size;
|
||||||
ulong thread_cache_size=0, binlog_cache_size=0, max_binlog_cache_size=0;
|
ulong thread_cache_size=0, binlog_cache_size=0, max_binlog_cache_size=0;
|
||||||
volatile ulong cached_thread_count=0;
|
volatile ulong cached_thread_count=0;
|
||||||
|
|
||||||
@ -2571,6 +2571,8 @@ CHANGEABLE_VAR changeable_vars[] = {
|
|||||||
1024*1024L, 80, 64*1024*1024L, MALLOC_OVERHEAD, 1024 },
|
1024*1024L, 80, 64*1024*1024L, MALLOC_OVERHEAD, 1024 },
|
||||||
{ "max_binlog_cache_size", (long*) &max_binlog_cache_size,
|
{ "max_binlog_cache_size", (long*) &max_binlog_cache_size,
|
||||||
~0L, IO_SIZE, ~0L, 0, IO_SIZE },
|
~0L, IO_SIZE, ~0L, 0, IO_SIZE },
|
||||||
|
{ "max_binlog_size", (long*) &max_binlog_size,
|
||||||
|
1024*1024L*1024L, 1024, 1024*1024L*1024L, 0, 1 },
|
||||||
{ "max_connections", (long*) &max_connections,
|
{ "max_connections", (long*) &max_connections,
|
||||||
100, 1, 16384, 0, 1 },
|
100, 1, 16384, 0, 1 },
|
||||||
{ "max_connect_errors", (long*) &max_connect_errors,
|
{ "max_connect_errors", (long*) &max_connect_errors,
|
||||||
@ -2673,6 +2675,7 @@ struct show_var_st init_vars[]= {
|
|||||||
{"lower_case_table_names", (char*) &lower_case_table_names, SHOW_LONG},
|
{"lower_case_table_names", (char*) &lower_case_table_names, SHOW_LONG},
|
||||||
{"max_allowed_packet", (char*) &max_allowed_packet, SHOW_LONG},
|
{"max_allowed_packet", (char*) &max_allowed_packet, SHOW_LONG},
|
||||||
{"max_binlog_cache_size", (char*) &max_binlog_cache_size, SHOW_LONG},
|
{"max_binlog_cache_size", (char*) &max_binlog_cache_size, SHOW_LONG},
|
||||||
|
{"max_binlog_size", (char*) &max_binlog_size, SHOW_LONG},
|
||||||
{"max_connections", (char*) &max_connections, SHOW_LONG},
|
{"max_connections", (char*) &max_connections, SHOW_LONG},
|
||||||
{"max_connect_errors", (char*) &max_connect_errors, SHOW_LONG},
|
{"max_connect_errors", (char*) &max_connect_errors, SHOW_LONG},
|
||||||
{"max_delayed_threads", (char*) &max_insert_delayed_threads, SHOW_LONG},
|
{"max_delayed_threads", (char*) &max_insert_delayed_threads, SHOW_LONG},
|
||||||
|
@ -208,3 +208,8 @@
|
|||||||
"Tabulka '%-.64s' je ozna-Bèena jako poru¹ená a poslední (automatická?) oprava se nezdaøila",-A
|
"Tabulka '%-.64s' je ozna-Bèena jako poru¹ená a poslední (automatická?) oprava se nezdaøila",-A
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
@ -202,3 +202,8 @@
|
|||||||
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
@ -199,3 +199,8 @@
|
|||||||
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
@ -187,7 +187,7 @@
|
|||||||
"Got error %d during CHECKPOINT",
|
"Got error %d during CHECKPOINT",
|
||||||
"Aborted connection %ld to db: '%-.64s' user: '%-.32s' host: `%-.64s' (%-.64s)",
|
"Aborted connection %ld to db: '%-.64s' user: '%-.32s' host: `%-.64s' (%-.64s)",
|
||||||
"The handler for the table does not support binary table dump",
|
"The handler for the table does not support binary table dump",
|
||||||
"Binlog closed while trying to FLUSH MASTER",
|
"Binlog closed, cannot RESET MASTER",
|
||||||
"Failed rebuilding the index of dumped table '%-.64s'",
|
"Failed rebuilding the index of dumped table '%-.64s'",
|
||||||
"Error from master: '%-.64s'",
|
"Error from master: '%-.64s'",
|
||||||
"Net error reading from master",
|
"Net error reading from master",
|
||||||
@ -199,3 +199,8 @@
|
|||||||
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
@ -203,3 +203,8 @@
|
|||||||
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
@ -199,3 +199,8 @@
|
|||||||
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
@ -202,3 +202,8 @@
|
|||||||
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
@ -199,3 +199,8 @@
|
|||||||
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
@ -201,3 +201,8 @@
|
|||||||
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
@ -199,3 +199,8 @@
|
|||||||
"La tabella '%-.64s' e' segnalata come rovinata e l'ultima ricostruzione (automatica?) e' fallita",
|
"La tabella '%-.64s' e' segnalata come rovinata e l'ultima ricostruzione (automatica?) e' fallita",
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
@ -201,3 +201,8 @@
|
|||||||
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
@ -199,3 +199,8 @@
|
|||||||
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
@ -201,3 +201,8 @@
|
|||||||
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
@ -201,3 +201,8 @@
|
|||||||
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
@ -203,3 +203,8 @@
|
|||||||
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
@ -199,3 +199,8 @@
|
|||||||
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
@ -203,3 +203,8 @@
|
|||||||
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
@ -179,7 +179,7 @@
|
|||||||
"Результат содержит больше одной строки",
|
"Результат содержит больше одной строки",
|
||||||
"Таблица этого типа обязана иметь PRIMARY KEY",
|
"Таблица этого типа обязана иметь PRIMARY KEY",
|
||||||
"Эта копия MySQL скомпилирована без поддержки RAID",
|
"Эта копия MySQL скомпилирована без поддержки RAID",
|
||||||
"You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column",
|
"MySQL работает в режиме защиты от дураков (safe_mode) - не могу UPDATE без WHERE с каким-небудь KEY",
|
||||||
"Индекс '%-.64s' не найден в таблице '%-.64s'",
|
"Индекс '%-.64s' не найден в таблице '%-.64s'",
|
||||||
"Не могу открыть таблицу",
|
"Не могу открыть таблицу",
|
||||||
"Данный тип таблиц не поддерживает check/repair",
|
"Данный тип таблиц не поддерживает check/repair",
|
||||||
@ -190,15 +190,20 @@
|
|||||||
"Ошибка %d во время CHECKPOINT",
|
"Ошибка %d во время CHECKPOINT",
|
||||||
"Прерванное соединение %ld к базе данных: '%-.64s' пользователь: '%-.32s' хост: `%-.64s' (%-.64s)",
|
"Прерванное соединение %ld к базе данных: '%-.64s' пользователь: '%-.32s' хост: `%-.64s' (%-.64s)",
|
||||||
"Этот тип таблиц не поддерживает binary table dump",
|
"Этот тип таблиц не поддерживает binary table dump",
|
||||||
"Binlog closed while trying to FLUSH MASTER",
|
"Репликационный лог закрыт, не могу сделать RESET MASTER",
|
||||||
"Failed rebuilding the index of dumped table '%-.64s'",
|
"Ошибка при восстановлении индекса перекачанной таблицы '%-.64s'",
|
||||||
"Error from master: '%-.64s'",
|
"Ошибка на мастере: '%-.64s'",
|
||||||
"Net error reading from master",
|
"Сетевая ошибка при чтении с мастера",
|
||||||
"Net error writing to master",
|
"Сетевая ошибка при писании мастеру",
|
||||||
"FULLTEXT индекс, соответствующий заданному списку столбцов, не найден",
|
"FULLTEXT индекс, соответствующий заданному списку столбцов, не найден",
|
||||||
"Can't execute the given command because you have active locked tables or an active transaction",
|
"Не могу выполнить комманду из-за активных locked таблиц или активной транзакции",
|
||||||
"Неизвестная системная переменная '%-.64'",
|
"Неизвестная системная переменная '%-.64'",
|
||||||
"Таблица '%-.64s' помечена как испорченная и должна быть исправлена",
|
"Таблица '%-.64s' помечена как испорченная и должна быть исправлена",
|
||||||
"Таблица '%-.64s' помечена как испорченная и последняя попытка исправления (автоматическая?) не удалась",
|
"Таблица '%-.64s' помечена как испорченная и последняя попытка исправления (автоматическая?) не удалась",
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Предупреждение: некоторые нетранзакционные таблицы не подчиняются ROLLBACK",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Многозапросная транзакция требует увеличения 'max_binlog_cache_size' - увеличте эту переменную и попробуйте еще раз",
|
||||||
|
"Эта операция невозможна с активным slave, надо SLAVE STOP",
|
||||||
|
"Эта операция невозможна с пассивным slave, надо SLAVE START",
|
||||||
|
"Этот сервер не slave, исправьте в конфигурационном файле или коммандой CHANGE MASTER TO",
|
||||||
|
"Не получилось инициализировать структуру master info, проверте persmissions на файле master.info",
|
||||||
|
"Не могу создать процесс SLAVE, проверьте системные ресурсы",
|
||||||
|
@ -207,3 +207,8 @@
|
|||||||
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
@ -200,3 +200,8 @@
|
|||||||
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
|
||||||
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
"Warning: Some non-transactional changed tables couldn't be rolled back",
|
||||||
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
@ -199,3 +199,8 @@
|
|||||||
"Tabell '%-.64s' är crashad och senast (automatiska?) reparation misslyckades",
|
"Tabell '%-.64s' är crashad och senast (automatiska?) reparation misslyckades",
|
||||||
"Warning: Några icke transaktionella tabeller kunde inte återställas vid ROLLBACK",
|
"Warning: Några icke transaktionella tabeller kunde inte återställas vid ROLLBACK",
|
||||||
"Transaktionen krävde mera än 'max_binlog_cache_size' minne. Utöka denna mysqld variabel och försök på nytt",
|
"Transaktionen krävde mera än 'max_binlog_cache_size' minne. Utöka denna mysqld variabel och försök på nytt",
|
||||||
|
"This operation cannot be performed with a running slave, run SLAVE STOP first",
|
||||||
|
"This operation requires a running slave, configure slave and do SLAVE START",
|
||||||
|
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
|
||||||
|
"Could not initialize master info structure, check permisions on master.info",
|
||||||
|
"Could not create slave thread, check system resources",
|
||||||
|
43
sql/slave.cc
43
sql/slave.cc
@ -34,10 +34,13 @@ DYNAMIC_ARRAY replicate_wild_do_table, replicate_wild_ignore_table;
|
|||||||
bool do_table_inited = 0, ignore_table_inited = 0;
|
bool do_table_inited = 0, ignore_table_inited = 0;
|
||||||
bool wild_do_table_inited = 0, wild_ignore_table_inited = 0;
|
bool wild_do_table_inited = 0, wild_ignore_table_inited = 0;
|
||||||
bool table_rules_on = 0;
|
bool table_rules_on = 0;
|
||||||
|
uint32 slave_skip_counter = 0;
|
||||||
|
static TABLE* save_temporary_tables = 0;
|
||||||
// when slave thread exits, we need to remember the temporary tables so we
|
// when slave thread exits, we need to remember the temporary tables so we
|
||||||
// can re-use them on slave start
|
// can re-use them on slave start
|
||||||
static TABLE* save_temporary_tables = 0;
|
|
||||||
|
static int last_slave_errno = 0;
|
||||||
|
static char last_slave_error[1024] = "";
|
||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
int disconnect_slave_event_count = 0, abort_slave_event_count = 0;
|
int disconnect_slave_event_count = 0, abort_slave_event_count = 0;
|
||||||
static int events_till_disconnect = -1, events_till_abort = -1;
|
static int events_till_disconnect = -1, events_till_abort = -1;
|
||||||
@ -506,14 +509,14 @@ int init_master_info(MASTER_INFO* mi)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(length=my_b_gets(&mi->file, mi->log_file_name,
|
if ((length=my_b_gets(&mi->file, mi->log_file_name,
|
||||||
sizeof(mi->log_file_name))))
|
sizeof(mi->log_file_name))) < 1)
|
||||||
{
|
{
|
||||||
msg="Error reading log file name from master info file ";
|
msg="Error reading log file name from master info file ";
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
mi->log_file_name[length]= 0; // kill \n
|
mi->log_file_name[length-1]= 0; // kill \n
|
||||||
char buf[FN_REFLEN];
|
char buf[FN_REFLEN];
|
||||||
if(!my_b_gets(&mi->file, buf, sizeof(buf)))
|
if(!my_b_gets(&mi->file, buf, sizeof(buf)))
|
||||||
{
|
{
|
||||||
@ -570,6 +573,9 @@ int show_master_info(THD* thd)
|
|||||||
field_list.push_back(new Item_empty_string("Slave_Running", 3));
|
field_list.push_back(new Item_empty_string("Slave_Running", 3));
|
||||||
field_list.push_back(new Item_empty_string("Replicate_do_db", 20));
|
field_list.push_back(new Item_empty_string("Replicate_do_db", 20));
|
||||||
field_list.push_back(new Item_empty_string("Replicate_ignore_db", 20));
|
field_list.push_back(new Item_empty_string("Replicate_ignore_db", 20));
|
||||||
|
field_list.push_back(new Item_empty_string("Last_errno", 4));
|
||||||
|
field_list.push_back(new Item_empty_string("Last_error", 20));
|
||||||
|
field_list.push_back(new Item_empty_string("Skip_counter", 12));
|
||||||
if(send_fields(thd, field_list, 1))
|
if(send_fields(thd, field_list, 1))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
|
|
||||||
@ -589,6 +595,9 @@ int show_master_info(THD* thd)
|
|||||||
pthread_mutex_unlock(&LOCK_slave);
|
pthread_mutex_unlock(&LOCK_slave);
|
||||||
net_store_data(packet, &replicate_do_db);
|
net_store_data(packet, &replicate_do_db);
|
||||||
net_store_data(packet, &replicate_ignore_db);
|
net_store_data(packet, &replicate_ignore_db);
|
||||||
|
net_store_data(packet, (uint32)last_slave_errno);
|
||||||
|
net_store_data(packet, last_slave_error);
|
||||||
|
net_store_data(packet, slave_skip_counter);
|
||||||
|
|
||||||
if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length()))
|
if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length()))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
@ -833,13 +842,14 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
|
|||||||
if (ev)
|
if (ev)
|
||||||
{
|
{
|
||||||
int type_code = ev->get_type_code();
|
int type_code = ev->get_type_code();
|
||||||
if (ev->server_id == ::server_id)
|
if (ev->server_id == ::server_id || slave_skip_counter)
|
||||||
{
|
{
|
||||||
if(type_code == LOAD_EVENT)
|
if(type_code == LOAD_EVENT)
|
||||||
skip_load_data_infile(net);
|
skip_load_data_infile(net);
|
||||||
|
|
||||||
mi->inc_pos(event_len);
|
mi->inc_pos(event_len);
|
||||||
flush_master_info(mi);
|
flush_master_info(mi);
|
||||||
|
--slave_skip_counter;
|
||||||
delete ev;
|
delete ev;
|
||||||
return 0; // avoid infinite update loops
|
return 0; // avoid infinite update loops
|
||||||
}
|
}
|
||||||
@ -853,6 +863,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
|
|||||||
{
|
{
|
||||||
Query_log_event* qev = (Query_log_event*)ev;
|
Query_log_event* qev = (Query_log_event*)ev;
|
||||||
int q_len = qev->q_len;
|
int q_len = qev->q_len;
|
||||||
|
int expected_error,actual_error = 0;
|
||||||
init_sql_alloc(&thd->mem_root, 8192,0);
|
init_sql_alloc(&thd->mem_root, 8192,0);
|
||||||
thd->db = rewrite_db((char*)qev->db);
|
thd->db = rewrite_db((char*)qev->db);
|
||||||
if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))
|
if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))
|
||||||
@ -869,19 +880,22 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
|
|||||||
thd->net.last_error[0] = 0;
|
thd->net.last_error[0] = 0;
|
||||||
thd->slave_proxy_id = qev->thread_id; // for temp tables
|
thd->slave_proxy_id = qev->thread_id; // for temp tables
|
||||||
mysql_parse(thd, thd->query, q_len);
|
mysql_parse(thd, thd->query, q_len);
|
||||||
int expected_error,actual_error;
|
|
||||||
if ((expected_error = qev->error_code) !=
|
if ((expected_error = qev->error_code) !=
|
||||||
(actual_error = thd->net.last_errno) && expected_error)
|
(actual_error = thd->net.last_errno) && expected_error)
|
||||||
{
|
{
|
||||||
sql_print_error("Slave: did not get the expected error\
|
const char* errmsg = "Slave: did not get the expected error\
|
||||||
running query from master - expected: '%s', got '%s'",
|
running query from master - expected: '%s', got '%s'";
|
||||||
ER(expected_error),
|
sql_print_error(errmsg, ER(expected_error),
|
||||||
actual_error ? ER(actual_error):"no error"
|
actual_error ? thd->net.last_error:"no error"
|
||||||
);
|
);
|
||||||
thd->query_error = 1;
|
thd->query_error = 1;
|
||||||
}
|
}
|
||||||
else if (expected_error == actual_error)
|
else if (expected_error == actual_error)
|
||||||
|
{
|
||||||
thd->query_error = 0;
|
thd->query_error = 0;
|
||||||
|
*last_slave_error = 0;
|
||||||
|
last_slave_errno = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
thd->db = 0; // prevent db from being freed
|
thd->db = 0; // prevent db from being freed
|
||||||
thd->query = 0; // just to be sure
|
thd->query = 0; // just to be sure
|
||||||
@ -893,6 +907,13 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
|
|||||||
{
|
{
|
||||||
sql_print_error("Slave: error running query '%s' ",
|
sql_print_error("Slave: error running query '%s' ",
|
||||||
qev->query);
|
qev->query);
|
||||||
|
last_slave_errno = actual_error ? actual_error : -1;
|
||||||
|
my_snprintf(last_slave_error, sizeof(last_slave_error),
|
||||||
|
"error '%s' on query '%s'",
|
||||||
|
actual_error ? thd->net.last_error :
|
||||||
|
"unexpected success or fatal error",
|
||||||
|
qev->query
|
||||||
|
);
|
||||||
free_root(&thd->mem_root,0);
|
free_root(&thd->mem_root,0);
|
||||||
delete ev;
|
delete ev;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -93,6 +93,11 @@ extern bool opt_log_slave_updates ;
|
|||||||
pthread_handler_decl(handle_slave,arg);
|
pthread_handler_decl(handle_slave,arg);
|
||||||
extern bool volatile abort_loop, abort_slave;
|
extern bool volatile abort_loop, abort_slave;
|
||||||
extern bool slave_running;
|
extern bool slave_running;
|
||||||
|
extern uint32 slave_skip_counter;
|
||||||
|
// needed for problems when slave stops and
|
||||||
|
// we want to restart it skipping one or more events in the master log that
|
||||||
|
// have caused errors, and have been manually applied by DBA already
|
||||||
|
|
||||||
extern pthread_t slave_real_id;
|
extern pthread_t slave_real_id;
|
||||||
extern MASTER_INFO glob_mi;
|
extern MASTER_INFO glob_mi;
|
||||||
extern HASH replicate_do_table, replicate_ignore_table;
|
extern HASH replicate_do_table, replicate_ignore_table;
|
||||||
|
@ -519,34 +519,34 @@ int start_slave(THD* thd , bool net_report)
|
|||||||
{
|
{
|
||||||
if(!thd) thd = current_thd;
|
if(!thd) thd = current_thd;
|
||||||
NET* net = &thd->net;
|
NET* net = &thd->net;
|
||||||
const char* err = 0;
|
int slave_errno = 0;
|
||||||
if (check_access(thd, PROCESS_ACL, any_db))
|
if (check_access(thd, PROCESS_ACL, any_db))
|
||||||
return 1;
|
return 1;
|
||||||
pthread_mutex_lock(&LOCK_slave);
|
pthread_mutex_lock(&LOCK_slave);
|
||||||
if(!slave_running)
|
if(!slave_running)
|
||||||
{
|
{
|
||||||
if(init_master_info(&glob_mi))
|
if(init_master_info(&glob_mi))
|
||||||
err = "Could not initialize master info";
|
slave_errno = ER_MASTER_INFO;
|
||||||
else if(server_id_supplied && *glob_mi.host)
|
else if(server_id_supplied && *glob_mi.host)
|
||||||
{
|
{
|
||||||
pthread_t hThread;
|
pthread_t hThread;
|
||||||
if(pthread_create(&hThread, &connection_attrib, handle_slave, 0))
|
if(pthread_create(&hThread, &connection_attrib, handle_slave, 0))
|
||||||
{
|
{
|
||||||
err = "cannot create slave thread";
|
slave_errno = ER_SLAVE_THREAD;
|
||||||
}
|
}
|
||||||
while(!slave_running) // slave might already be running by now
|
while(!slave_running) // slave might already be running by now
|
||||||
pthread_cond_wait(&COND_slave_start, &LOCK_slave);
|
pthread_cond_wait(&COND_slave_start, &LOCK_slave);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
err = "Master host not set, or server id not configured";
|
slave_errno = ER_BAD_SLAVE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
err = "Slave already running";
|
slave_errno = ER_SLAVE_MUST_STOP;
|
||||||
|
|
||||||
pthread_mutex_unlock(&LOCK_slave);
|
pthread_mutex_unlock(&LOCK_slave);
|
||||||
if(err)
|
if(slave_errno)
|
||||||
{
|
{
|
||||||
if(net_report) send_error(net, 0, err);
|
if(net_report) send_error(net, slave_errno);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if(net_report)
|
else if(net_report)
|
||||||
@ -559,7 +559,7 @@ int stop_slave(THD* thd, bool net_report )
|
|||||||
{
|
{
|
||||||
if(!thd) thd = current_thd;
|
if(!thd) thd = current_thd;
|
||||||
NET* net = &thd->net;
|
NET* net = &thd->net;
|
||||||
const char* err = 0;
|
int slave_errno = 0;
|
||||||
|
|
||||||
if (check_access(thd, PROCESS_ACL, any_db))
|
if (check_access(thd, PROCESS_ACL, any_db))
|
||||||
return 1;
|
return 1;
|
||||||
@ -576,14 +576,14 @@ int stop_slave(THD* thd, bool net_report )
|
|||||||
pthread_cond_wait(&COND_slave_stopped, &LOCK_slave);
|
pthread_cond_wait(&COND_slave_stopped, &LOCK_slave);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
err = "Slave is not running";
|
slave_errno = ER_SLAVE_NOT_RUNNING;
|
||||||
|
|
||||||
pthread_mutex_unlock(&LOCK_slave);
|
pthread_mutex_unlock(&LOCK_slave);
|
||||||
thd->proc_info = 0;
|
thd->proc_info = 0;
|
||||||
|
|
||||||
if(err)
|
if(slave_errno)
|
||||||
{
|
{
|
||||||
if(net_report) send_error(net, 0, err);
|
if(net_report) send_error(net, slave_errno);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if(net_report)
|
else if(net_report)
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#define YYMAXDEPTH 3200 /* Because of 64K stack */
|
#define YYMAXDEPTH 3200 /* Because of 64K stack */
|
||||||
#define Lex current_lex
|
#define Lex current_lex
|
||||||
#include "mysql_priv.h"
|
#include "mysql_priv.h"
|
||||||
|
#include "slave.h"
|
||||||
#include "sql_acl.h"
|
#include "sql_acl.h"
|
||||||
#include "lex_symbol.h"
|
#include "lex_symbol.h"
|
||||||
#include <myisam.h>
|
#include <myisam.h>
|
||||||
@ -408,6 +409,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
|
|||||||
%token SQL_AUTO_IS_NULL
|
%token SQL_AUTO_IS_NULL
|
||||||
%token SQL_SAFE_UPDATES
|
%token SQL_SAFE_UPDATES
|
||||||
%token SQL_QUOTE_SHOW_CREATE
|
%token SQL_QUOTE_SHOW_CREATE
|
||||||
|
%token SQL_SLAVE_SKIP_COUNTER
|
||||||
|
|
||||||
%left SET_VAR
|
%left SET_VAR
|
||||||
%left OR_OR_CONCAT OR
|
%left OR_OR_CONCAT OR
|
||||||
@ -2662,6 +2664,15 @@ option_value:
|
|||||||
if (item->fix_fields(current_thd,0) || item->update())
|
if (item->fix_fields(current_thd,0) || item->update())
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
|
| SQL_SLAVE_SKIP_COUNTER equal ULONG_NUM
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(&LOCK_slave);
|
||||||
|
if(slave_running)
|
||||||
|
send_error(¤t_thd->net, ER_SLAVE_MUST_STOP);
|
||||||
|
else
|
||||||
|
slave_skip_counter = $3;
|
||||||
|
pthread_mutex_unlock(&LOCK_slave);
|
||||||
|
}
|
||||||
|
|
||||||
text_or_password:
|
text_or_password:
|
||||||
TEXT_STRING { $$=$1.str;}
|
TEXT_STRING { $$=$1.str;}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user