From f80c3cb4f1fbd974859faa5033d8e5ad7f528c9e Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 19 Feb 2001 23:08:24 -0700 Subject: [PATCH] replication fixes Docs/manual.texi: updates from Matthias Urlichs mysql-test/r/rpl000016.result: position sanity check - hope to catch the timing bug mysql-test/t/rpl000016.test: position sanity check - hope to catch timing bug sql/log_event.cc: limit event length by max_allowed_packet sql/log_event.h: abolish MAX_EVENT_LEN sql/sql_repl.cc: error for events larger than max_allowed_packet --- Docs/manual.texi | 5 ++++- mysql-test/r/rpl000016.result | 4 ++++ mysql-test/t/rpl000016.test | 2 ++ sql/log_event.cc | 5 +++-- sql/log_event.h | 2 +- sql/sql_repl.cc | 4 ++++ 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 3aa4194c3c1..880c5917f40 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -41585,6 +41585,9 @@ not yet 100 % confident in this code. @appendixsubsec Changes in release 3.23.34 @itemize @bullet @item +Limit query length for replication by max_allowed_packet, not the arbitrary +limit of 4 MB +@item Allow space around @code{=} in argument to @code{--set-variable}. @item Fixed problem in automatic repair that could let some threads in state @@ -41606,7 +41609,7 @@ Fixed that @code{mysqlbinlog} writes the timestamp value for each query. This ensures that on gets same values for date functions like @code{NOW()} when using @code{mysqlbinlog} to pipe the queries to another server. @item -Allow one to use @code{--skip-gemeni}, @code{--skip-bdb} and +Allow one to use @code{--skip-gemini}, @code{--skip-bdb} and @code{--skip-innobase} to @code{mysqld} even if these databases are not compiled in @code{mysqld}. @item diff --git a/mysql-test/r/rpl000016.result b/mysql-test/r/rpl000016.result index 39ea7234e2a..613a97d5b7e 100644 --- a/mysql-test/r/rpl000016.result +++ b/mysql-test/r/rpl000016.result @@ -21,5 +21,9 @@ Log_name master-bin.003 master-bin.004 master-bin.005 +File Position Binlog_do_db Binlog_ignore_db +master-bin.005 1504 +Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter +127.0.0.1 root 9306 60 master-bin.005 1504 Yes 0 0 count(*) 100 diff --git a/mysql-test/t/rpl000016.test b/mysql-test/t/rpl000016.test index fd30188ea89..a12fde7eb4c 100644 --- a/mysql-test/t/rpl000016.test +++ b/mysql-test/t/rpl000016.test @@ -78,11 +78,13 @@ while ($1) dec $1; } show master logs; +show master status; save_master_pos; connection slave; slave stop; slave start; sync_with_master; +show slave status; select count(*) from t3 where n = 4; #clean up connection master; diff --git a/sql/log_event.cc b/sql/log_event.cc index 38f353d4ec7..d643952c5b0 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -85,10 +85,11 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet, return file->error > 0 ? LOG_READ_TRUNC: LOG_READ_IO; } data_len = uint4korr(buf + EVENT_LEN_OFFSET); - if (data_len < LOG_EVENT_HEADER_LEN || data_len > MAX_EVENT_LEN) + if (data_len < LOG_EVENT_HEADER_LEN || data_len > max_allowed_packet) { if (log_lock) pthread_mutex_unlock(log_lock); - return LOG_READ_BOGUS; + return (data_len < LOG_EVENT_HEADER_LEN) ? LOG_READ_BOGUS : + LOG_READ_TOO_LARGE; } packet->append(buf, sizeof(buf)); data_len -= LOG_EVENT_HEADER_LEN; diff --git a/sql/log_event.h b/sql/log_event.h index 8a22048bba4..79186e329da 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -31,6 +31,7 @@ #define LOG_READ_IO -3 #define LOG_READ_MEM -5 #define LOG_READ_TRUNC -6 +#define LOG_READ_TOO_LARGE -7 #define LOG_EVENT_OFFSET 4 #define BINLOG_VERSION 1 @@ -42,7 +43,6 @@ + sizeof(uint32) + 2 + sizeof(uint32)) #define EVENT_LEN_OFFSET 9 #define EVENT_TYPE_OFFSET 4 -#define MAX_EVENT_LEN 4*1024*1024 #define QUERY_EVENT_OVERHEAD (LOG_EVENT_HEADER_LEN+QUERY_HEADER_LEN) #define ROTATE_EVENT_OVERHEAD LOG_EVENT_HEADER_LEN #define LOAD_EVENT_OVERHEAD (LOG_EVENT_HEADER_LEN+LOAD_HEADER_LEN+sizeof(sql_ex_info)) diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 7730706f0d0..e354bb65713 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -352,6 +352,10 @@ sweepstakes if you report the bug"; case LOG_READ_BOGUS: errmsg = "bogus data in log event"; break; + case LOG_READ_TOO_LARGE: + errmsg = "log event entry exceeded max_allowed_packet -\ + increase max_allowed_packet on master"; + break; case LOG_READ_IO: errmsg = "I/O error reading log event"; break;