Commit 65ad60db authored by unknown's avatar unknown

Merge abotchkov@bk-internal.mysql.com:/home/bk/mysql-4.1

into deer.(none):/home/hf/work/mysql-4.1.stmt


sql/sql_db.cc:
  Auto merged
parents e1c1aa7a 8094305c
...@@ -20,7 +20,7 @@ AUTOMAKE_OPTIONS = foreign ...@@ -20,7 +20,7 @@ AUTOMAKE_OPTIONS = foreign
# These are built from source in the Docs directory # These are built from source in the Docs directory
EXTRA_DIST = INSTALL-SOURCE README \ EXTRA_DIST = INSTALL-SOURCE README \
COPYING COPYING.LIB COPYING COPYING.LIB zlib
SUBDIRS = . include @docs_dirs@ \ SUBDIRS = . include @docs_dirs@ \
@readline_topdir@ sql-common \ @readline_topdir@ sql-common \
@thread_dirs@ pstack @sql_client_dirs@ \ @thread_dirs@ pstack @sql_client_dirs@ \
......
...@@ -31,7 +31,7 @@ n ...@@ -31,7 +31,7 @@ n
4 4
show slave status; 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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 288 master-bin.000001 Yes No 0 0 244 605 Master master-bin.000001 244 No 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 332 master-bin.000001 Yes No 0 0 244 649 Master master-bin.000001 244 No
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291; start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
select * from t1; select * from t1;
n n
...@@ -41,21 +41,21 @@ n ...@@ -41,21 +41,21 @@ n
4 4
show slave status; 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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 288 master-bin.000001 Yes No 0 0 244 605 Master master-no-such-bin.000001 291 No 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 332 master-bin.000001 Yes No 0 0 244 649 Master master-no-such-bin.000001 291 No
start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=493; start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=537;
select * from t2; select * from t2;
n n
1 1
2 2
show slave status; 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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 493 master-bin.000001 Yes No 0 0 449 605 Relay slave-relay-bin.000002 493 No 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 537 master-bin.000001 Yes No 0 0 449 649 Relay slave-relay-bin.000002 537 No
start slave; start slave;
stop slave; stop slave;
start slave until master_log_file='master-bin.000001', master_log_pos=561; start slave until master_log_file='master-bin.000001', master_log_pos=561;
show slave status; 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 Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 605 master-bin.000001 Yes No 0 0 561 649 Master master-bin.000001 561 No 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 649 master-bin.000001 Yes No 0 0 561 693 Master master-bin.000001 561 No
start slave until master_log_file='master-bin', master_log_pos=561; start slave until master_log_file='master-bin', master_log_pos=561;
ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12; start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
......
...@@ -3,8 +3,11 @@ source include/master-slave.inc; ...@@ -3,8 +3,11 @@ source include/master-slave.inc;
# prepare version for substitutions # prepare version for substitutions
let $VERSION=`select version()`; let $VERSION=`select version()`;
# stop slave before he will start replication # stop slave before he will start replication also sync with master
# for avoiding undetermenistic behaviour
save_master_pos;
connection slave; connection slave;
sync_with_master;
stop slave; stop slave;
connection master; connection master;
...@@ -37,7 +40,7 @@ sleep 2; ...@@ -37,7 +40,7 @@ sleep 2;
show slave status; show slave status;
# try replicate all until second insert to t2; # try replicate all until second insert to t2;
start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=493; start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=537;
sleep 2; sleep 2;
select * from t2; select * from t2;
--replace_result $MASTER_MYPORT MASTER_MYPORT --replace_result $MASTER_MYPORT MASTER_MYPORT
......
...@@ -128,7 +128,7 @@ fi ...@@ -128,7 +128,7 @@ fi
if test ! -x $mysqld if test ! -x $mysqld
then then
if test "$in_rpm" -eq 1 if test "$in_rpm" = 1
then then
echo "FATAL ERROR $mysqld not found!" echo "FATAL ERROR $mysqld not found!"
exit 1 exit 1
...@@ -167,7 +167,7 @@ then ...@@ -167,7 +167,7 @@ then
fi fi
fi fi
if test "$ip_only" -eq 1 if test "$ip_only" = 1
then then
ip=`echo "$resolved" | awk '/ /{print $6}'` ip=`echo "$resolved" | awk '/ /{print $6}'`
hostname=$ip hostname=$ip
...@@ -187,7 +187,7 @@ then ...@@ -187,7 +187,7 @@ then
c_d="yes" c_d="yes"
fi fi
if test $verbose -eq 1 if test $verbose = 1
then then
create_option="verbose" create_option="verbose"
else else
......
...@@ -1876,19 +1876,22 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli) ...@@ -1876,19 +1876,22 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
pthread_mutex_lock(&rli->data_lock); pthread_mutex_lock(&rli->data_lock);
#ifdef TO_BE_CHECKED_BY_GUILHEM if (thd->options & OPTION_BEGIN)
if (rli->inside_transaction)
{ {
slave_print_error(rli, 0, slave_print_error(rli, 0,
opt_using_transactions ?
"\ "\
There is an unfinished transaction in the relay log (could find neither \ There is an unfinished transaction in the relay log (could find neither \
COMMIT nor ROLLBACK in the relay log); It could be that the master died while \ COMMIT nor ROLLBACK in the relay log); It could be that the master died while \
writing the transaction to its binary log. Now the slave is rolling back the \ writing the transaction to its binary log. Now the slave is rolling back the \
transaction."); transaction." :
"\
There is an unfinished transaction in the relay log (could find neither \
COMMIT nor ROLLBACK in the relay log); It could be that the master died while \
writing the transaction to its binary log.");
pthread_mutex_unlock(&rli->data_lock); pthread_mutex_unlock(&rli->data_lock);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
#endif
memcpy(log_name, new_log_ident, ident_len+1); memcpy(log_name, new_log_ident, ident_len+1);
rli->notify_group_master_log_name_update(); rli->notify_group_master_log_name_update();
......
...@@ -391,8 +391,30 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) ...@@ -391,8 +391,30 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
exit: exit:
start_waiting_global_read_lock(thd); start_waiting_global_read_lock(thd);
/*
If this database was the client's selected database, we silently change the
client's selected database to nothing (to have an empty SELECT DATABASE() in
the future). For this we free() thd->db and set it to 0. But we don't do
free() for the slave thread. Indeed, doing a x_free() on it leads to nasty
problems (i.e. long painful debugging) because in this thread, thd->db is
the same as data_buf and db of the Query_log_event which is dropping the
database. So if you free() thd->db, you're freeing data_buf. You set thd->db
to 0 but not data_buf (thd->db and data_buf are two distinct pointers which
point to the same place). Then in ~Query_log_event(), we have
'if (data_buf) free(data_buf)'
data_buf is !=0 so this makes a DOUBLE free().
Side effects of this double free() are, randomly (depends on the machine),
when the slave is replicating a DROP DATABASE:
- garbage characters in the error message:
"Error 'Can't drop database 'test2'; database doesn't exist' on query
'h4zI'"
- segfault
- hang in "free(vio)" (yes!) in the I/O or SQL slave threads (so slave
server hangs at shutdown etc).
*/
if (thd->db && !strcmp(thd->db, db)) if (thd->db && !strcmp(thd->db, db))
{ {
if (!(thd->slave_thread)) /* a slave thread will free it itself */
x_free(thd->db); x_free(thd->db);
thd->db= 0; thd->db= 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