mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
new file_id generation method
This commit is contained in:
@ -375,3 +375,4 @@ support-files/mysql.server
|
|||||||
support-files/mysql.spec
|
support-files/mysql.spec
|
||||||
tags
|
tags
|
||||||
tmp/*
|
tmp/*
|
||||||
|
vio/viotest-ssl
|
||||||
|
@ -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 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 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 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 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=11
|
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 577 Query 1 9 use test; drop table t1
|
||||||
Log_name Pos Event_type Server_id Log_seq Info
|
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)
|
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 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 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 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 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=11
|
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 577 Query 1 9 use test; drop table t1
|
||||||
master-bin.001 625 Rotate 1 10 master-bin.002;pos=4
|
master-bin.001 625 Rotate 1 10 master-bin.002;pos=4
|
||||||
master-bin.001 666 Stop 1 11
|
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 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 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 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 439 Create_file 1 7 db=test;table=t1;file_id=1;block_len=81
|
||||||
slave-bin.001 647 Exec_load 1 8 ;file_id=11
|
slave-bin.001 646 Exec_load 1 8 ;file_id=1
|
||||||
slave-bin.001 670 Query 1 9 use test; drop table t1
|
slave-bin.001 669 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 717 Rotate 1 4 slave-bin.002;pos=4; forced by master
|
||||||
slave-bin.001 758 Stop 2 5
|
slave-bin.001 757 Stop 2 5
|
||||||
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: $VERSION, Binlog ver: 2
|
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
|
slave-bin.002 79 Slave 2 10 host=127.0.0.1,port=$MASTER_MYPORT,log=master-bin.002,pos=4
|
||||||
|
11
sql/log.cc
11
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),
|
MYSQL_LOG::MYSQL_LOG(): last_time(0), query_start(0),index_file(-1),
|
||||||
name(0), log_type(LOG_CLOSED),write_error(0),
|
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
|
We don't want to intialize LOCK_Log here as the thread system may
|
||||||
@ -724,6 +724,15 @@ err:
|
|||||||
return error;
|
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
|
Write a cached log entry to the binary log
|
||||||
We only come here if there is something in the cache.
|
We only come here if there is something in the cache.
|
||||||
|
@ -45,6 +45,7 @@ static void pretty_print_char(FILE* file, int c)
|
|||||||
|
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
|
|
||||||
|
|
||||||
static void pretty_print_char(String* packet, int c)
|
static void pretty_print_char(String* packet, int c)
|
||||||
{
|
{
|
||||||
packet->append('\'');
|
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):
|
char* block_arg, uint block_len_arg):
|
||||||
Load_log_event(thd_arg,ex,db_arg,table_name_arg,fields_arg,handle_dup),
|
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),
|
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
|
#endif
|
||||||
|
@ -65,6 +65,8 @@ class MYSQL_LOG {
|
|||||||
bool write_error,inited;
|
bool write_error,inited;
|
||||||
uint32 log_seq; // current event sequence number
|
uint32 log_seq; // current event sequence number
|
||||||
// needed this for binlog
|
// 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
|
bool no_rotate; // for binlog - if log name can never change
|
||||||
// we should not try to rotate it or write any rotation events
|
// we should not try to rotate it or write any rotation events
|
||||||
// the user should use FLUSH MASTER instead of FLUSH LOGS for
|
// 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_first_log(LOG_INFO* linfo, const char* log_name);
|
||||||
int find_next_log(LOG_INFO* linfo);
|
int find_next_log(LOG_INFO* linfo);
|
||||||
int get_current_log(LOG_INFO* linfo);
|
int get_current_log(LOG_INFO* linfo);
|
||||||
|
uint next_file_id();
|
||||||
|
|
||||||
inline bool is_open() { return log_type != LOG_CLOSED; }
|
inline bool is_open() { return log_type != LOG_CLOSED; }
|
||||||
char* get_index_fname() { return index_file_name;}
|
char* get_index_fname() { return index_file_name;}
|
||||||
|
Reference in New Issue
Block a user