Commit de0b2af7 authored by unknown's avatar unknown

merged new 3.23 errors

fixed bugs in log seq - now starting to look good
fixes for SHOW BINLOG EVENTS
will push this one


include/mysqld_error.h:
  merged errors from 3.23
mysql-test/mysql-test-run.sh:
  wrong quotes in --skip-test
mysql-test/r/drop.result:
  updated test
mysql-test/r/rpl_log.result:
  updated test
mysql-test/t/drop.test:
  updated test
mysql-test/t/rpl_log.test:
  fixed bugs in test case
sql/item_sum.h:
  remove compiler warning about re-ordered initialization
sql/log.cc:
  fixed a bunch of loq_seq bugs
sql/log_event.cc:
  fixed log seq bugs, added info for Slave event in SHOW BINLOG EVENTS
sql/share/czech/errmsg.txt:
  merged errors from 3.23
sql/share/danish/errmsg.txt:
  merged errors from 3.23
sql/share/dutch/errmsg.txt:
  merged errors from 3.23
sql/share/english/errmsg.txt:
  merged errors from 3.23
sql/share/estonian/errmsg.txt:
  merged errors from 3.23
sql/share/french/errmsg.txt:
  merged errors from 3.23
sql/share/german/errmsg.txt:
  merged errors from 3.23
sql/share/greek/errmsg.txt:
  merged errors from 3.23
sql/share/hungarian/errmsg.txt:
  merged errors from 3.23
sql/share/italian/errmsg.txt:
  merged errors from 3.23
sql/share/japanese/errmsg.txt:
  merged errors from 3.23
sql/share/korean/errmsg.txt:
  merged errors from 3.23
sql/share/norwegian-ny/errmsg.txt:
  merged errors from 3.23
sql/share/norwegian/errmsg.txt:
  merged errors from 3.23
sql/share/polish/errmsg.txt:
  merged errors from 3.23
sql/share/portuguese/errmsg.txt:
  merged errors from 3.23
sql/share/romanian/errmsg.txt:
  merged errors from 3.23
sql/share/russian/errmsg.txt:
  merged errors from 3.23
sql/share/slovak/errmsg.txt:
  merged errors from 3.23
sql/share/spanish/errmsg.txt:
  merged errors from 3.23
sql/share/swedish/errmsg.txt:
  merged errors from 3.23
sql/slave.cc:
  fixed log_seq bugs
parent f1a5dafc
...@@ -208,7 +208,9 @@ ...@@ -208,7 +208,9 @@
#define ER_LOCK_WAIT_TIMEOUT 1205 #define ER_LOCK_WAIT_TIMEOUT 1205
#define ER_LOCK_TABLE_FULL 1206 #define ER_LOCK_TABLE_FULL 1206
#define ER_READ_ONLY_TRANSACTION 1207 #define ER_READ_ONLY_TRANSACTION 1207
#define ER_CONNECT_TO_MASTER 1208 #define ER_DROP_DB_WITH_READ_LOCK 1208
#define ER_QUERY_ON_MASTER 1209 #define ER_CREATE_DB_WITH_READ_LOCK 1209
#define ER_SHOW_BINLOG_EVENTS 1210 #define ER_CONNECT_TO_MASTER 1210
#define ER_ERROR_MESSAGES 211 #define ER_QUERY_ON_MASTER 1211
#define ER_SHOW_BINLOG_EVENTS 1212
#define ER_ERROR_MESSAGES 213
...@@ -659,7 +659,7 @@ run_testcase () ...@@ -659,7 +659,7 @@ run_testcase ()
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`
if [ -n $SKIP_TEST ] ; then if [ -n $SKIP_TEST ] ; then
SKIP_THIS_TEST=`$EXPR \( $tname : '$SKIP_TEST' \) != 0` SKIP_THIS_TEST=`$EXPR \( $tname : "$SKIP_TEST" \) != 0`
if [ x$SKIP_THIS_TEST = x1 ] ; if [ x$SKIP_THIS_TEST = x1 ] ;
then then
return; return;
......
...@@ -2,3 +2,10 @@ n ...@@ -2,3 +2,10 @@ n
1 1
n n
4 4
Database
foo
mysql
test
Database
mysql
test
...@@ -28,24 +28,22 @@ master-bin.001 549 Stop 1 10 ...@@ -28,24 +28,22 @@ master-bin.001 549 Stop 1 10
Log_name Pos Event_type Server_id Log_seq Info Log_name Pos Event_type Server_id Log_seq Info
master-bin.002 4 Start 1 1 Server ver: 4.0.0-debug-log, Binlog ver: 2 master-bin.002 4 Start 1 1 Server ver: 4.0.0-debug-log, Binlog ver: 2
Log_name Log_name
master-bin.001
master-bin.002
Log_name
slave-bin.001 slave-bin.001
slave-bin.002 slave-bin.002
slave-bin.003
slave-bin.004
Log_name Pos Event_type Server_id Log_seq Info Log_name Pos Event_type Server_id Log_seq Info
slave-bin.001 4 Start 2 1 Server ver: 4.0.0-debug-log, Binlog ver: 2 slave-bin.001 4 Start 2 1 Server ver: 4.0.0-debug-log, Binlog ver: 2
slave-bin.001 79 Slave 2 2 slave-bin.001 79 Slave 2 2 host=127.0.0.1,port=9306,log=master-bin.001,pos=4
slave-bin.001 118 Rotate 2 3 slave-bin.002 slave-bin.001 132 Query 1 2 use test; create table t1(n int not null auto_increment primary key)
slave-bin.001 150 Stop 2 4 slave-bin.001 225 Intvar 1 3 INSERT_ID=1
slave-bin.001 253 Query 1 4 use test; insert into t1 values (NULL)
slave-bin.001 316 Query 1 5 use test; drop table t1
slave-bin.001 364 Query 1 6 use test; create table t1 (word char(20) not null)
slave-bin.001 439 Query 1 8 use test; drop table t1
slave-bin.001 487 Rotate 2 3 slave-bin.002
slave-bin.001 519 Stop 2 4
Log_name Pos Event_type Server_id Log_seq Info Log_name Pos Event_type Server_id Log_seq Info
slave-bin.002 4 Start 2 1 Server ver: 4.0.0-debug-log, Binlog ver: 2 slave-bin.002 4 Start 2 1 Server ver: 4.0.0-debug-log, Binlog ver: 2
slave-bin.002 79 Slave 1 2 slave-bin.002 79 Slave 2 2 host=127.0.0.1,port=9306,log=master-bin.002,pos=4
slave-bin.002 132 Slave 1 3
slave-bin.002 185 Query 1 4 use test; create table t1(n int not null auto_increment primary key)
slave-bin.002 278 Intvar 2 5 INSERT_ID=1
slave-bin.002 306 Query 1 6 use test; insert into t1 values (NULL)
slave-bin.002 369 Query 1 7 use test; drop table t1
slave-bin.002 417 Query 1 8 use test; create table t1 (word char(20) not null)
slave-bin.002 492 Query 1 9 use test; drop table t1
slave-bin.002 540 Rotate 2 10 slave-bin.003
slave-bin.002 572 Stop 2 11
...@@ -24,3 +24,18 @@ select * from foo.foo; ...@@ -24,3 +24,18 @@ select * from foo.foo;
drop database if exists foo; drop database if exists foo;
create database foo; create database foo;
drop database foo; drop database foo;
# test drop/create database and FLUSH TABLES WITH READ LOCK
drop database if exists foo;
flush tables with read lock;
--error 1209
create database foo;
unlock tables;
create database foo;
show databases;
flush tables with read lock;
--error 1208
drop database foo;
unlock tables;
drop database foo;
show databases;
...@@ -2,9 +2,12 @@ source include/master-slave.inc; ...@@ -2,9 +2,12 @@ source include/master-slave.inc;
#clean up slave binlogs #clean up slave binlogs
connection slave; connection slave;
slave stop;
reset master; reset master;
reset slave;
connection master; connection master;
reset master;
drop table if exists t1; drop table if exists t1;
create table t1(n int not null auto_increment primary key); create table t1(n int not null auto_increment primary key);
insert into t1 values (NULL); insert into t1 values (NULL);
...@@ -19,8 +22,10 @@ show binlog events from 79 limit 2,1; ...@@ -19,8 +22,10 @@ show binlog events from 79 limit 2,1;
flush logs; flush logs;
show binlog events; show binlog events;
show binlog events in 'master-bin.002'; show binlog events in 'master-bin.002';
show master logs;
save_master_pos; save_master_pos;
connection slave; connection slave;
slave start;
sync_with_master; sync_with_master;
show master logs; show master logs;
show binlog events in 'slave-bin.001' from 4; show binlog events in 'slave-bin.001' from 4;
......
...@@ -173,7 +173,7 @@ class Item_sum_count_distinct :public Item_sum_int ...@@ -173,7 +173,7 @@ class Item_sum_count_distinct :public Item_sum_int
public: public:
Item_sum_count_distinct(List<Item> &list) Item_sum_count_distinct(List<Item> &list)
:Item_sum_int(list),table(0),used_table_cache(~(table_map) 0), :Item_sum_int(list),table(0),used_table_cache(~(table_map) 0),
tmp_table_param(0),always_null(0),use_tree(0) tmp_table_param(0),use_tree(0),always_null(0)
{ quick_group=0; } { quick_group=0; }
~Item_sum_count_distinct(); ~Item_sum_count_distinct();
table_map used_tables() const { return used_table_cache; } table_map used_tables() const { return used_table_cache; }
......
...@@ -236,20 +236,6 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg, ...@@ -236,20 +236,6 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
bool error; bool error;
s.set_log_seq(0, this); s.set_log_seq(0, this);
s.write(&log_file); s.write(&log_file);
// if we have a master, record current master info in a slave
// event
if (glob_mi.inited)
{
THD* thd = current_thd;
Slave_log_event s(thd, &glob_mi);
if(s.master_host)
{
s.set_log_seq(thd, this);
s.write(&log_file);
}
}
flush_io_cache(&log_file); flush_io_cache(&log_file);
pthread_mutex_lock(&LOCK_index); pthread_mutex_lock(&LOCK_index);
error=(my_write(index_file, (byte*) log_file_name, strlen(log_file_name), error=(my_write(index_file, (byte*) log_file_name, strlen(log_file_name),
...@@ -548,7 +534,7 @@ void MYSQL_LOG::new_file() ...@@ -548,7 +534,7 @@ void MYSQL_LOG::new_file()
to change base names at some point. to change base names at some point.
*/ */
Rotate_log_event r(new_name+dirname_length(new_name)); Rotate_log_event r(new_name+dirname_length(new_name));
r.set_log_seq(current_thd, this); r.set_log_seq(0, this);
r.write(&log_file); r.write(&log_file);
VOID(pthread_cond_broadcast(&COND_binlog_update)); VOID(pthread_cond_broadcast(&COND_binlog_update));
} }
...@@ -650,8 +636,10 @@ bool MYSQL_LOG::write(Slave_log_event* event_info) ...@@ -650,8 +636,10 @@ bool MYSQL_LOG::write(Slave_log_event* event_info)
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));
event_info->set_log_seq(current_thd, this); if(!event_info->log_seq)
event_info->set_log_seq(current_thd, this);
error = event_info->write(&log_file); error = event_info->write(&log_file);
flush_io_cache(&log_file);
VOID(pthread_mutex_unlock(&LOCK_log)); VOID(pthread_mutex_unlock(&LOCK_log));
return error; return error;
} }
...@@ -688,7 +676,7 @@ bool MYSQL_LOG::write(Query_log_event* event_info) ...@@ -688,7 +676,7 @@ bool MYSQL_LOG::write(Query_log_event* event_info)
{ {
Intvar_log_event e((uchar)LAST_INSERT_ID_EVENT, thd->last_insert_id); Intvar_log_event e((uchar)LAST_INSERT_ID_EVENT, thd->last_insert_id);
e.set_log_seq(thd, this); e.set_log_seq(thd, this);
if(thd->server_id) if (thd->server_id)
e.server_id = thd->server_id; e.server_id = thd->server_id;
if (e.write(file)) if (e.write(file))
goto err; goto err;
...@@ -697,6 +685,8 @@ bool MYSQL_LOG::write(Query_log_event* event_info) ...@@ -697,6 +685,8 @@ bool MYSQL_LOG::write(Query_log_event* event_info)
{ {
Intvar_log_event e((uchar)INSERT_ID_EVENT, thd->last_insert_id); Intvar_log_event e((uchar)INSERT_ID_EVENT, thd->last_insert_id);
e.set_log_seq(thd, this); e.set_log_seq(thd, this);
if (thd->server_id)
e.server_id = thd->server_id;
if (e.write(file)) if (e.write(file))
goto err; goto err;
} }
......
...@@ -204,7 +204,17 @@ void Intvar_log_event::pack_info(String* packet) ...@@ -204,7 +204,17 @@ void Intvar_log_event::pack_info(String* packet)
void Slave_log_event::pack_info(String* packet) void Slave_log_event::pack_info(String* packet)
{ {
net_store_data(packet, "", 0); String tmp;
char buf[22];
tmp.append("host=");
tmp.append(master_host);
tmp.append(",port=");
tmp.append(llstr(master_port,buf));
tmp.append(",log=");
tmp.append(master_log);
tmp.append(",pos=");
tmp.append(llstr(master_pos,buf));
net_store_data(packet, tmp.ptr(), tmp.length());
} }
...@@ -889,8 +899,8 @@ void Slave_log_event::init_from_mem_pool(int data_size) ...@@ -889,8 +899,8 @@ void Slave_log_event::init_from_mem_pool(int data_size)
master_host = mem_pool + SL_MASTER_HOST_OFFSET; master_host = mem_pool + SL_MASTER_HOST_OFFSET;
master_host_len = strlen(master_host); master_host_len = strlen(master_host);
// safety // safety
master_log = master_host + master_host_len; master_log = master_host + master_host_len + 1;
if(master_log >= mem_pool + data_size) if(master_log > mem_pool + data_size)
{ {
master_host = 0; master_host = 0;
return; return;
...@@ -902,9 +912,12 @@ void Slave_log_event::init_from_mem_pool(int data_size) ...@@ -902,9 +912,12 @@ void Slave_log_event::init_from_mem_pool(int data_size)
Slave_log_event::Slave_log_event(const char* buf, int event_len): Slave_log_event::Slave_log_event(const char* buf, int event_len):
Log_event(buf),mem_pool(0),master_host(0) Log_event(buf),mem_pool(0),master_host(0)
{ {
event_len -= LOG_EVENT_HEADER_LEN;
if(event_len < 0)
return;
if(!(mem_pool = (char*)my_malloc(event_len + 1, MYF(MY_WME)))) if(!(mem_pool = (char*)my_malloc(event_len + 1, MYF(MY_WME))))
return; return;
memcpy(mem_pool, buf, event_len); memcpy(mem_pool, buf + LOG_EVENT_HEADER_LEN, event_len);
mem_pool[event_len] = 0; mem_pool[event_len] = 0;
init_from_mem_pool(event_len); init_from_mem_pool(event_len);
} }
...@@ -220,3 +220,6 @@ ...@@ -220,3 +220,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -214,3 +214,6 @@ ...@@ -214,3 +214,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -211,3 +211,6 @@ ...@@ -211,3 +211,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -209,7 +209,8 @@ ...@@ -209,7 +209,8 @@
"Lock wait timeout exceeded", "Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size", "The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s", "Error connecting to master: %-.128s",
"Error running query on master: %-.128s", "Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s", "Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -215,3 +215,6 @@ ...@@ -215,3 +215,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -211,3 +211,6 @@ ...@@ -211,3 +211,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -214,3 +214,6 @@ ...@@ -214,3 +214,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -211,3 +211,6 @@ ...@@ -211,3 +211,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -213,3 +213,6 @@ ...@@ -213,3 +213,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -211,3 +211,6 @@ ...@@ -211,3 +211,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -213,3 +213,6 @@ ...@@ -213,3 +213,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -211,3 +211,6 @@ ...@@ -211,3 +211,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -213,3 +213,6 @@ ...@@ -213,3 +213,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -213,3 +213,6 @@ ...@@ -213,3 +213,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -215,3 +215,6 @@ ...@@ -215,3 +215,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -211,3 +211,6 @@ ...@@ -211,3 +211,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -215,3 +215,6 @@ ...@@ -215,3 +215,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -214,3 +214,6 @@ ...@@ -214,3 +214,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -219,3 +219,6 @@ ...@@ -219,3 +219,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -212,3 +212,6 @@ ...@@ -212,3 +212,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -211,3 +211,6 @@ ...@@ -211,3 +211,6 @@
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error in SHOW BINLOG EVENTS: %-.128s",
...@@ -928,7 +928,10 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) ...@@ -928,7 +928,10 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
thd->server_id = ev->server_id; // use the original server id for logging thd->server_id = ev->server_id; // use the original server id for logging
thd->set_time(); // time the query thd->set_time(); // time the query
if(!ev->when) if(!thd->log_seq)
thd->log_seq = ev->log_seq;
if (!ev->when)
ev->when = time(NULL); ev->when = time(NULL);
switch(type_code) { switch(type_code) {
...@@ -1009,6 +1012,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) ...@@ -1009,6 +1012,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
} }
free_root(&thd->mem_root,0); free_root(&thd->mem_root,0);
delete ev; delete ev;
thd->log_seq = 0;
mi->inc_pos(event_len); mi->inc_pos(event_len);
flush_master_info(mi); flush_master_info(mi);
...@@ -1024,6 +1028,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) ...@@ -1024,6 +1028,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
} }
delete ev; delete ev;
thd->log_seq = 0;
break; break;
} }
...@@ -1135,6 +1140,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) ...@@ -1135,6 +1140,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
} }
delete ev; delete ev;
thd->log_seq = 0;
free_root(&thd->mem_root,0); free_root(&thd->mem_root,0);
if(thd->fatal_error) if(thd->fatal_error)
...@@ -1154,6 +1160,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) ...@@ -1154,6 +1160,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
mi->inc_pos(event_len); mi->inc_pos(event_len);
flush_master_info(mi); flush_master_info(mi);
delete ev; delete ev;
thd->log_seq = 0;
break; break;
case STOP_EVENT: case STOP_EVENT:
...@@ -1164,30 +1171,49 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) ...@@ -1164,30 +1171,49 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
flush_master_info(mi); flush_master_info(mi);
} }
delete ev; delete ev;
thd->log_seq = 0;
break; break;
case ROTATE_EVENT: case ROTATE_EVENT:
{ {
Rotate_log_event* rev = (Rotate_log_event*)ev; Rotate_log_event* rev = (Rotate_log_event*)ev;
int ident_len = rev->ident_len; int ident_len = rev->ident_len;
bool rotate_binlog = 0, write_slave_event = 0;
char* log_name = mi->log_file_name;
pthread_mutex_lock(&mi->lock); pthread_mutex_lock(&mi->lock);
memcpy(mi->log_file_name, rev->new_log_ident,ident_len );
mi->log_file_name[ident_len] = 0; // rotate local binlog only if the name of remote has changed
if (!*log_name || !(log_name[ident_len] == 0 &&
!memcmp(log_name, rev->new_log_ident, ident_len)))
{
write_slave_event = mysql_bin_log.is_open();
rotate_binlog = (*log_name && write_slave_event );
memcpy(log_name, rev->new_log_ident,ident_len );
log_name[ident_len] = 0;
}
mi->pos = 4; // skip magic number mi->pos = 4; // skip magic number
pthread_cond_broadcast(&mi->cond); pthread_cond_broadcast(&mi->cond);
pthread_mutex_unlock(&mi->lock); pthread_mutex_unlock(&mi->lock);
flush_master_info(mi); flush_master_info(mi);
#ifndef DBUG_OFF #ifndef DBUG_OFF
if(abort_slave_event_count) if (abort_slave_event_count)
++events_till_abort; ++events_till_abort;
#endif #endif
if(mysql_bin_log.is_open()) if (rotate_binlog)
{
mysql_bin_log.new_file(); mysql_bin_log.new_file();
Slave_log_event sev(slave_thd, mi);
if(sev.master_host) if (write_slave_event)
mysql_bin_log.write(&sev); {
Slave_log_event s(thd, mi);
if (s.master_host)
{
s.set_log_seq(0, &mysql_bin_log);
s.server_id = ::server_id;
mysql_bin_log.write(&s);
}
} }
delete ev; delete ev;
thd->log_seq = 0;
break; break;
} }
...@@ -1207,6 +1233,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) ...@@ -1207,6 +1233,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
} }
mi->inc_pending(event_len); mi->inc_pending(event_len);
delete ev; delete ev;
// do not reset log_seq
break; break;
} }
} }
......
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