diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/log.cc | 11 | ||||
-rw-r--r-- | sql/log_event.cc | 3 | ||||
-rw-r--r-- | sql/sql_class.h | 3 |
3 files changed, 15 insertions, 2 deletions
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;} |