summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <sasha@mysql.sashanet.com>2000-08-23 13:27:33 -0600
committerunknown <sasha@mysql.sashanet.com>2000-08-23 13:27:33 -0600
commitb1cc91fae62064da2823ffd50424bf8e4c0b5b6b (patch)
tree3f55e8ba2a24b35f6a2e7955062c5a5673c2bd05
parent448fa9f1cdea830980265083bb0eab3def31d093 (diff)
downloadmariadb-git-b1cc91fae62064da2823ffd50424bf8e4c0b5b6b.tar.gz
Replication fixes
sql/log_event.cc: changed uint to uint32 in all places where the code depended on sizeof(uint) to be 4 sql/log_event.h: changed uint to uint32 in all places where the code depended on sizeof(uint) to be 4 sql/slave.cc: Monty's I64 fix broke my fprintf(), to fix it, changed to use llstr() to print mi->pos that has become ulonglong
-rw-r--r--sql/log_event.cc12
-rw-r--r--sql/log_event.h26
-rw-r--r--sql/slave.cc6
3 files changed, 21 insertions, 23 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index eae8d7c1e88..45a3e749e9e 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -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)));
diff --git a/sql/log_event.h b/sql/log_event.h
index 549f3831a60..82ab462bdf5 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -85,10 +85,10 @@ protected:
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 @@ public:
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 @@ public:
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 @@ protected:
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 @@ public:
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];
diff --git a/sql/slave.cc b/sql/slave.cc
index 500c29480bc..2f4f7c10714 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -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))
{