Replication fixes

parent 0c46a399
......@@ -23,9 +23,9 @@
#endif /* MYSQL_CLIENT */
#define LOG_EVENT_HEADER_LEN 9
#define QUERY_HEADER_LEN (sizeof(uint) + sizeof(uint) + sizeof(uchar))
#define LOAD_HEADER_LEN (sizeof(uint) + sizeof(uint) + \
+ sizeof(uint) + 2 + sizeof(uint))
#define QUERY_HEADER_LEN (sizeof(uint32) + sizeof(uint32) + sizeof(uchar))
#define LOAD_HEADER_LEN (sizeof(uint32) + sizeof(uint32) + \
+ sizeof(uint32) + 2 + sizeof(uint32))
#define EVENT_LEN_OFFSET 5
#define EVENT_TYPE_OFFSET 4
#define MAX_EVENT_LEN 4*1024*1024
......@@ -71,11 +71,7 @@ int Log_event::write_header(FILE* file)
int4store(pos, when); // timestamp
pos += 4;
*pos++ = get_type_code(); // event type code
int4store(pos, get_data_size() +
sizeof(time_t) // timestamp
+ sizeof(char) // event code
+ sizeof(uint) // event entry size
);
int4store(pos, get_data_size() + LOG_EVENT_HEADER_LEN);
pos += 4;
return (my_fwrite(file, (byte*) buf, (uint) (pos - buf),
MYF(MY_NABP | MY_WME)));
......
......@@ -85,10 +85,10 @@ class Query_log_event: public Log_event
public:
const char* query;
const char* db;
uint q_len; // if we already know the length of the query string
uint32 q_len; // if we already know the length of the query string
// we pass it here, so we would not have to call strlen()
// otherwise, set it to 0, in which case, we compute it with strlen()
uint db_len;
uint32 db_len;
int thread_id;
#if !defined(MYSQL_CLIENT)
THD* thd;
......@@ -101,7 +101,7 @@ class Query_log_event: public Log_event
time(&end_time);
exec_time = (ulong) (end_time - thd->start_time);
valid_exec_time = 1;
db_len = (db) ? (uint) strlen(db) : 0;
db_len = (db) ? (uint32) strlen(db) : 0;
}
#endif
......@@ -120,8 +120,8 @@ class Query_log_event: public Log_event
int get_data_size()
{
return q_len + db_len + 2 +
sizeof(uint) // thread_id
+ sizeof(uint) // exec_time
sizeof(uint32) // thread_id
+ sizeof(uint32) // exec_time
;
}
......@@ -157,19 +157,19 @@ class Load_log_event: public Log_event
char* data_buf;
public:
int thread_id;
uint table_name_len;
uint db_len;
uint fname_len;
uint num_fields;
uint32 table_name_len;
uint32 db_len;
uint32 fname_len;
uint32 num_fields;
const char* fields;
const uchar* field_lens;
uint field_block_len;
uint32 field_block_len;
const char* table_name;
const char* db;
const char* fname;
uint skip_lines;
uint32 skip_lines;
sql_ex_info sql_ex;
#if !defined(MYSQL_CLIENT)
......@@ -189,8 +189,8 @@ class Load_log_event: public Log_event
time(&end_time);
exec_time = (ulong) (end_time - thd->start_time);
valid_exec_time = 1;
db_len = (db) ? (uint) strlen(db) : 0;
table_name_len = (table_name) ? (uint) strlen(table_name) : 0;
db_len = (db) ? (uint32) strlen(db) : 0;
table_name_len = (table_name) ? (uint32) strlen(table_name) : 0;
fname_len = (fname) ? (uint) strlen(fname) : 0;
sql_ex.field_term = (*ex->field_term)[0];
sql_ex.enclosed = (*ex->enclosed)[0];
......
......@@ -372,9 +372,11 @@ int show_master_info(THD* thd)
int flush_master_info(MASTER_INFO* mi)
{
FILE* file = mi->file;
char lbuf[22];
if(my_fseek(file, 0L, MY_SEEK_SET, MYF(MY_WME)) == MY_FILEPOS_ERROR ||
fprintf(file, "%s\n%ld\n%s\n%s\n%s\n%d\n%d\n",
mi->log_file_name, mi->pos, mi->host, mi->user, mi->password,
fprintf(file, "%s\n%s\n%s\n%s\n%s\n%d\n%d\n",
mi->log_file_name, llstr(mi->pos, lbuf), mi->host, mi->user, mi->password,
mi->port, mi->connect_retry) < 0 ||
fflush(file))
{
......
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