diff options
-rw-r--r-- | .bzrignore | 1 | ||||
-rw-r--r-- | mysql-test/r/rpl_log.result | 18 | ||||
-rw-r--r-- | sql/log.cc | 11 | ||||
-rw-r--r-- | sql/log_event.cc | 3 | ||||
-rw-r--r-- | sql/sql_class.h | 3 |
5 files changed, 25 insertions, 11 deletions
diff --git a/.bzrignore b/.bzrignore index b27d8529cda..c2ccdcb83f6 100644 --- a/.bzrignore +++ b/.bzrignore @@ -375,3 +375,4 @@ support-files/mysql.server support-files/mysql.spec tags tmp/* +vio/viotest-ssl diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result index f79bd8eccaa..ba5c2ca301d 100644 --- a/mysql-test/r/rpl_log.result +++ b/mysql-test/r/rpl_log.result @@ -5,8 +5,8 @@ master-bin.001 172 Intvar 1 3 INSERT_ID=1 master-bin.001 200 Query 1 4 use test; insert into t1 values (NULL) master-bin.001 263 Query 1 5 use test; drop table t1 master-bin.001 311 Query 1 6 use test; create table t1 (word char(20) not null) -master-bin.001 386 Create_file 1 7 db=test;table=t1;file_id=11;block_len=81 -master-bin.001 554 Exec_load 1 8 ;file_id=11 +master-bin.001 386 Create_file 1 7 db=test;table=t1;file_id=1;block_len=81 +master-bin.001 554 Exec_load 1 8 ;file_id=1 master-bin.001 577 Query 1 9 use test; drop table t1 Log_name Pos Event_type Server_id Log_seq Info master-bin.001 79 Query 1 2 use test; create table t1(n int not null auto_increment primary key) @@ -22,8 +22,8 @@ master-bin.001 172 Intvar 1 3 INSERT_ID=1 master-bin.001 200 Query 1 4 use test; insert into t1 values (NULL) master-bin.001 263 Query 1 5 use test; drop table t1 master-bin.001 311 Query 1 6 use test; create table t1 (word char(20) not null) -master-bin.001 386 Create_file 1 7 db=test;table=t1;file_id=11;block_len=81 -master-bin.001 554 Exec_load 1 8 ;file_id=11 +master-bin.001 386 Create_file 1 7 db=test;table=t1;file_id=1;block_len=81 +master-bin.001 554 Exec_load 1 8 ;file_id=1 master-bin.001 577 Query 1 9 use test; drop table t1 master-bin.001 625 Rotate 1 10 master-bin.002;pos=4 master-bin.001 666 Stop 1 11 @@ -46,11 +46,11 @@ 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 Create_file 1 7 db=test;table=t1;file_id=11;block_len=81 -slave-bin.001 647 Exec_load 1 8 ;file_id=11 -slave-bin.001 670 Query 1 9 use test; drop table t1 -slave-bin.001 718 Rotate 1 4 slave-bin.002;pos=4; forced by master -slave-bin.001 758 Stop 2 5 +slave-bin.001 439 Create_file 1 7 db=test;table=t1;file_id=1;block_len=81 +slave-bin.001 646 Exec_load 1 8 ;file_id=1 +slave-bin.001 669 Query 1 9 use test; drop table t1 +slave-bin.001 717 Rotate 1 4 slave-bin.002;pos=4; forced by master +slave-bin.001 757 Stop 2 5 Log_name Pos Event_type Server_id Log_seq Info slave-bin.002 4 Start 2 1 Server ver: $VERSION, Binlog ver: 2 slave-bin.002 79 Slave 2 10 host=127.0.0.1,port=$MASTER_MYPORT,log=master-bin.002,pos=4 diff --git a/sql/log.cc b/sql/log.cc index 61384f85085..ba09ac86fe6 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -81,7 +81,7 @@ static int find_uniq_filename(char *name) MYSQL_LOG::MYSQL_LOG(): last_time(0), query_start(0),index_file(-1), name(0), log_type(LOG_CLOSED),write_error(0), - inited(0), log_seq(1), no_rotate(0) + inited(0), log_seq(1), file_id(1),no_rotate(0) { /* We don't want to intialize LOCK_Log here as the thread system may @@ -724,6 +724,15 @@ err: return error; } +uint MYSQL_LOG::next_file_id() +{ + uint res; + pthread_mutex_lock(&LOCK_log); + res = file_id++; + pthread_mutex_unlock(&LOCK_log); + return res; +} + /* Write a cached log entry to the binary log We only come here if there is something in the cache. diff --git a/sql/log_event.cc b/sql/log_event.cc index 279bb9fbde3..14524216076 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -45,6 +45,7 @@ static void pretty_print_char(FILE* file, int c) #ifndef MYSQL_CLIENT + static void pretty_print_char(String* packet, int c) { packet->append('\''); @@ -1106,7 +1107,7 @@ Create_file_log_event::Create_file_log_event(THD* thd_arg, sql_exchange* ex, char* block_arg, uint block_len_arg): Load_log_event(thd_arg,ex,db_arg,table_name_arg,fields_arg,handle_dup), fake_base(0),block(block_arg),block_len(block_len_arg), - file_id(thd_arg->file_id = thd_arg->query_id) + file_id(thd_arg->file_id = mysql_bin_log.next_file_id()) { } #endif diff --git a/sql/sql_class.h b/sql/sql_class.h index 3b7fced9bc5..3f212a8f8c6 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -65,6 +65,8 @@ class MYSQL_LOG { bool write_error,inited; uint32 log_seq; // current event sequence number // needed this for binlog + uint file_id; // current file sequence number for load data infile + // binary logging bool no_rotate; // for binlog - if log name can never change // we should not try to rotate it or write any rotation events // the user should use FLUSH MASTER instead of FLUSH LOGS for @@ -99,6 +101,7 @@ public: int find_first_log(LOG_INFO* linfo, const char* log_name); int find_next_log(LOG_INFO* linfo); int get_current_log(LOG_INFO* linfo); + uint next_file_id(); inline bool is_open() { return log_type != LOG_CLOSED; } char* get_index_fname() { return index_file_name;} |