#At file:///home/msvensson/mysql/7.0-bug52305-markup/ based on revid:magnus.blaudd@stripped93f2t69n
3878 Magnus Blåudd 2010-10-20
ndb
- mark up BG52305 with MCP ifndef tags
- split some code to minimize modifying existing code
modified:
client/mysqlbinlog.cc
sql/log_event.cc
sql/log_event.h
sql/mysqld.cc
sql/set_var.cc
sql/slave.cc
sql/slave.h
sql/sql_class.cc
sql/sql_class.h
=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc 2010-10-18 13:46:27 +0000
+++ b/client/mysqlbinlog.cc 2010-10-20 11:10:46 +0000
@@ -104,8 +104,10 @@ static ulonglong rec_count= 0;
static short binlog_flags = 0;
static MYSQL* mysql = NULL;
static const char* dirname_for_local_load= 0;
+#ifndef MCP_BUG52305
uint opt_server_id_bits = 0;
ulong opt_server_id_mask = 0;
+#endif
/**
Pointer to the Format_description_log_event of the currently active binlog.
@@ -1157,12 +1159,14 @@ that may lead to an endless loop.",
"Used to reserve file descriptors for use by this program.",
&open_files_limit, &open_files_limit, 0, GET_ULONG,
REQUIRED_ARG, MY_NFILE, 8, OS_FILE_LIMIT, 0, 1, 0},
+#ifndef MCP_BUG52305
{"server-id-bits", 255,
"Set number of significant bits in ServerId",
(uchar**) &opt_server_id_bits,
(uchar**) &opt_server_id_bits,
/* Default + Max 32 bits, minimum 7 bits */
0, GET_UINT, REQUIRED_ARG, 32, 7, 32, 0, 0, 0},
+#endif
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -2061,8 +2065,10 @@ int main(int argc, char** argv)
if (opt_base64_output_mode == BASE64_OUTPUT_UNSPEC)
opt_base64_output_mode= BASE64_OUTPUT_AUTO;
+#ifndef MCP_BUG52305
opt_server_id_mask = (opt_server_id_bits == 32)?
~ ulong(0) : (1 << opt_server_id_bits) -1;
+#endif
my_set_max_open_files(open_files_limit);
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2010-10-12 14:53:28 +0000
+++ b/sql/log_event.cc 2010-10-20 11:10:46 +0000
@@ -665,9 +665,12 @@ const char* Log_event::get_type_str()
Log_event::Log_event(THD* thd_arg, uint16 flags_arg, bool using_trans)
:log_pos(0), temp_buf(0), exec_time(0), flags(flags_arg), thd(thd_arg)
{
- unmasked_server_id= server_id= thd->server_id;
+ server_id= thd->server_id;
when= thd->start_time;
cache_stmt= using_trans;
+#ifndef MCP_BUG52305
+ unmasked_server_id= server_id;
+#endif
}
@@ -682,13 +685,17 @@ Log_event::Log_event()
:temp_buf(0), exec_time(0), flags(0), cache_stmt(0),
thd(0)
{
- unmasked_server_id= server_id= ::server_id;
+ server_id= ::server_id;
/*
We can't call my_time() here as this would cause a call before
my_init() is called
*/
when= 0;
log_pos= 0;
+
+#ifndef MCP_BUG52305
+ unmasked_server_id= server_id;
+#endif
}
#endif /* !MYSQL_CLIENT */
@@ -705,6 +712,7 @@ Log_event::Log_event(const char* buf,
thd = 0;
#endif
when = uint4korr(buf);
+#ifndef MCP_BUG52305
unmasked_server_id = uint4korr(buf + SERVER_ID_OFFSET);
/*
Mask out any irrelevant parts of the server_id
@@ -714,6 +722,7 @@ Log_event::Log_event(const char* buf,
#else
server_id = unmasked_server_id;
#endif
+#endif
data_written= uint4korr(buf + EVENT_LEN_OFFSET);
if (description_event->binlog_version==1)
{
=== modified file 'sql/log_event.h'
--- a/sql/log_event.h 2010-10-12 14:53:28 +0000
+++ b/sql/log_event.h 2010-10-20 11:10:46 +0000
@@ -932,12 +932,14 @@ public:
*/
uint32 server_id;
+#ifndef MCP_BUG52305
/*
The server id read from the Binlog. server_id above has
lowest bits of this only according to the value of
opt_server_id_bits
*/
uint32 unmasked_server_id;
+#endif
/**
Some 16 flags. See the definitions above for LOG_EVENT_TIME_F,
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2010-10-12 14:53:28 +0000
+++ b/sql/mysqld.cc 2010-10-20 11:10:46 +0000
@@ -492,8 +492,10 @@ handlerton *partition_hton;
ulong opt_ndb_wait_setup;
int(*ndb_wait_setup_func)(ulong)= 0;
#endif
+#ifndef MCP_BUG52305
uint opt_server_id_bits= 0;
ulong opt_server_id_mask= 0;
+#endif
my_bool opt_readonly, use_temp_pool, relay_log_purge;
my_bool opt_sync_frm, opt_allow_suspicious_udfs;
my_bool opt_secure_auth= 0;
@@ -3950,8 +3952,6 @@ with --log-bin instead.");
DBUG_ASSERT((uint)global_system_variables.binlog_format <=
array_elements(binlog_format_names)-1);
- opt_server_id_mask = ~ulong(0);
-
#ifdef HAVE_REPLICATION
if (opt_log_slave_updates && replicate_same_server_id)
{
@@ -3961,6 +3961,11 @@ using --replicate-same-server-id in conj
server.");
unireg_abort(1);
}
+#endif
+
+#ifndef MCP_BUG52305
+ opt_server_id_mask = ~ulong(0);
+#ifdef HAVE_REPLICATION
opt_server_id_mask = (opt_server_id_bits == 32)?
~ ulong(0) : (1 << opt_server_id_bits) -1;
if (server_id != (server_id & opt_server_id_mask))
@@ -3971,6 +3976,7 @@ server-id-bits configured.");
unireg_abort(1);
}
#endif
+#endif
if (opt_bin_log)
{
@@ -6266,12 +6272,14 @@ each time the SQL thread starts.",
"Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.",
&myisam_recover_options_str, &myisam_recover_options_str, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+#ifndef MCP_BUG52305
{"server-id-bits", 255,
"Set number of significant bits in ServerId",
&opt_server_id_bits,
&opt_server_id_bits,
/* Default + Max 32 bits, minimum 7 bits */
0, GET_UINT, REQUIRED_ARG, 32, 7, 32, 0, 0, 0},
+#endif
{"new", 'n', "Use very new possible 'unsafe' functions.",
&global_system_variables.new_mode,
&max_system_variables.new_mode,
@@ -6438,8 +6446,12 @@ thread is in the relay logs.",
&opt_secure_file_priv, &opt_secure_file_priv, 0,
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-id", OPT_SERVER_ID,
+#ifndef MCP_BUG52305
"Uniquely identifies the server instance in the community of replication partners. "
"Max value is limited by opt-server-id-bits if set.",
+#else
+ "Uniquely identifies the server instance in the community of replication partners.",
+#endif
&server_id, &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, UINT_MAX32,
0, 0, 0},
{"set-variable", 'O',
=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc 2010-10-12 14:53:28 +0000
+++ b/sql/set_var.cc 2010-10-20 11:10:46 +0000
@@ -65,7 +65,9 @@
#include "events.h"
+#ifndef MCP_BUG52305
extern uint opt_server_id_bits;
+#endif
extern CHARSET_INFO *character_set_filesystem;
@@ -697,9 +699,11 @@ static sys_var_thd_bool
sys_engine_condition_pushdown(&vars, "engine_condition_pushdown",
&SV::engine_condition_pushdown);
+#ifndef MCP_BUG52305
static sys_var_const
sys_server_id_bits(&vars, "server_id_bits", OPT_GLOBAL, SHOW_INT,
(uchar*) &opt_server_id_bits);
+#endif
/* Time/date/datetime formats */
=== modified file 'sql/slave.cc'
--- a/sql/slave.cc 2010-10-18 10:53:03 +0000
+++ b/sql/slave.cc 2010-10-20 11:10:46 +0000
@@ -2244,11 +2244,12 @@ int apply_event_and_update_pos(Log_event
log (remember that now the relay log starts with its Format_desc,
has a Rotate etc).
*/
-
+#ifndef MCP_BUG52305
/*
Set the unmasked and actual server ids from the event
*/
thd->unmasked_server_id = ev->unmasked_server_id;
+#endif
thd->server_id = ev->server_id; // use the original server id for logging
thd->set_time(); // time the query
thd->lex->current_select= 0;
@@ -3996,12 +3997,14 @@ static int queue_event(Master_info* mi,c
#ifndef MCP_BUG47037
s_id= uint4korr(buf + SERVER_ID_OFFSET);
+#ifndef MCP_BUG52305
/*
If server_id_bits option is set we need to mask out irrelevant bits
when checking server_id, but we still put the full unmasked server_id
into the Relay log so that it can be accessed when applying the event
*/
s_id&= opt_server_id_mask;
+#endif
if ((s_id == ::server_id && !mi->rli.replicate_same_server_id) ||
/*
the following conjunction deals with IGNORE_SERVER_IDS, if set
=== modified file 'sql/slave.h'
--- a/sql/slave.h 2010-10-18 10:53:03 +0000
+++ b/sql/slave.h 2010-10-20 11:10:46 +0000
@@ -226,7 +226,9 @@ extern char *report_host, *report_passwo
extern my_bool master_ssl;
extern char *master_ssl_ca, *master_ssl_capath, *master_ssl_cert;
extern char *master_ssl_cipher, *master_ssl_key;
+#ifndef MCP_BUG52305
extern ulong opt_server_id_mask;
+#endif
extern I_List<THD> threads;
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2010-10-12 14:53:28 +0000
+++ b/sql/sql_class.cc 2010-10-20 11:10:46 +0000
@@ -719,7 +719,10 @@ THD::THD()
/* Variables with default values */
proc_info="login";
where= THD::DEFAULT_WHERE;
- unmasked_server_id = server_id = ::server_id;
+ server_id = ::server_id;
+#ifndef MCP_BUG52305
+ unmasked_server_id = server_id;
+#endif
slave_net = 0;
command=COM_CONNECT;
*scramble= '\0';
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2010-10-12 14:53:28 +0000
+++ b/sql/sql_class.h 2010-10-20 11:10:46 +0000
@@ -1414,7 +1414,9 @@ public:
first byte of the packet in do_command()
*/
enum enum_server_command command;
+#ifndef MCP_BUG52305
uint32 unmasked_server_id;
+#endif
uint32 server_id;
uint32 file_id; // for LOAD DATA INFILE
/* remote (peer) port */
Attachment: [text/bzr-bundle] bzr/magnus.blaudd@sun.com-20101020111046-3rmwxh3ptmcqtb8v.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-7.0 branch (magnus.blaudd:3878) | Magnus Blåudd | 20 Oct |