Commit 61731a21 authored by unknown's avatar unknown

after merge fixes (making rpl_charset and rpl_timezone pass).

Replication of charsets and timezones should shortly be changed to not need ONE_SHOT
(but 5.0 should still be able to read it, to be able to replicate 4.1 masters).


mysql-test/r/rpl_charset.result:
  result update after the merge (only binlog positions differ from 4.1)
mysql-test/r/rpl_timezone.result:
  result update after the merge (only binlog positions differ from 4.1)
sql/log.cc:
  use ONE_SHOT to save charset and TZ info in the binlog (until I rewrite this soon)
sql/set_var.cc:
  Even if in the future, 5.0 will not use ONE_SHOT in ITS binlog, it must still be able to interpret it, to make 4.1->5.0 replication possible
sql/set_var.h:
  Even if in the future, 5.0 will not use ONE_SHOT in ITS binlog, it must still be able to interpret it, to make 4.1->5.0 replication possible
parent 2293d5e8
This diff is collapsed.
...@@ -35,9 +35,10 @@ Log_name Pos Event_type Server_id End_log_pos Info ...@@ -35,9 +35,10 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4 master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
master-bin.000001 95 Query 1 181 use `test`; create table t1 (t timestamp) master-bin.000001 95 Query 1 181 use `test`; create table t1 (t timestamp)
master-bin.000001 181 Query 1 266 use `test`; create table t2 (t char(32)) master-bin.000001 181 Query 1 266 use `test`; create table t2 (t char(32))
master-bin.000001 266 Query 1 383 use `test`; insert into t1 values ('20040101000000'), ('20040611093902') master-bin.000001 266 Query 1 351 use `test`; SET ONE_SHOT TIME_ZONE='UTC'
master-bin.000001 383 Query 1 454 use `test`; delete from t1 master-bin.000001 351 Query 1 468 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
master-bin.000001 454 Query 1 571 use `test`; insert into t1 values ('20040101000000'), ('20040611093902') master-bin.000001 468 Query 1 539 use `test`; delete from t1
master-bin.000001 539 Query 1 656 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
set time_zone='MET'; set time_zone='MET';
insert into t2 (select t from t1); insert into t2 (select t from t1);
select * from t1; select * from t1;
...@@ -72,4 +73,5 @@ t ...@@ -72,4 +73,5 @@ t
2001-09-09 03:46:40 2001-09-09 03:46:40
1000000000 1000000000
set global time_zone='MET'; set global time_zone='MET';
ERROR HY000: Binary logging and replication forbid changing of the global server time zone
drop table t1, t2; drop table t1, t2;
...@@ -1307,7 +1307,7 @@ bool MYSQL_LOG::write(Log_event* event_info) ...@@ -1307,7 +1307,7 @@ bool MYSQL_LOG::write(Log_event* event_info)
if (thd) if (thd)
{ {
#if MYSQL_VERSION_ID < 50000 /* NOTE: CHARSET AND TZ REPL WILL BE REWRITTEN SHORTLY */
/* /*
To make replication of charsets working in 4.1 we are writing values To make replication of charsets working in 4.1 we are writing values
of charset related variables before every statement in the binlog, of charset related variables before every statement in the binlog,
...@@ -1353,7 +1353,6 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u", ...@@ -1353,7 +1353,6 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u",
if (e.write(file)) if (e.write(file))
goto err; goto err;
} }
#endif
if (thd->last_insert_id_used) if (thd->last_insert_id_used)
{ {
......
...@@ -1913,7 +1913,7 @@ void sys_var_character_set_server::set_default(THD *thd, enum_var_type type) ...@@ -1913,7 +1913,7 @@ void sys_var_character_set_server::set_default(THD *thd, enum_var_type type)
} }
} }
#if defined(HAVE_REPLICATION) && (MYSQL_VERSION_ID < 50000) #if defined(HAVE_REPLICATION)
bool sys_var_character_set_server::check(THD *thd, set_var *var) bool sys_var_character_set_server::check(THD *thd, set_var *var)
{ {
if ((var->type == OPT_GLOBAL) && if ((var->type == OPT_GLOBAL) &&
...@@ -2020,7 +2020,7 @@ void sys_var_collation_database::set_default(THD *thd, enum_var_type type) ...@@ -2020,7 +2020,7 @@ void sys_var_collation_database::set_default(THD *thd, enum_var_type type)
} }
} }
#if defined(HAVE_REPLICATION) && (MYSQL_VERSION_ID < 50000) #if defined(HAVE_REPLICATION)
bool sys_var_collation_server::check(THD *thd, set_var *var) bool sys_var_collation_server::check(THD *thd, set_var *var)
{ {
if ((var->type == OPT_GLOBAL) && if ((var->type == OPT_GLOBAL) &&
...@@ -2372,7 +2372,7 @@ bool sys_var_thd_time_zone::check(THD *thd, set_var *var) ...@@ -2372,7 +2372,7 @@ bool sys_var_thd_time_zone::check(THD *thd, set_var *var)
String str(buff, sizeof(buff), &my_charset_latin1); String str(buff, sizeof(buff), &my_charset_latin1);
String *res= var->value->val_str(&str); String *res= var->value->val_str(&str);
#if defined(HAVE_REPLICATION) && (MYSQL_VERSION_ID < 50000) #if defined(HAVE_REPLICATION)
if ((var->type == OPT_GLOBAL) && if ((var->type == OPT_GLOBAL) &&
(mysql_bin_log.is_open() || (mysql_bin_log.is_open() ||
active_mi->slave_running || active_mi->rli.slave_running)) active_mi->slave_running || active_mi->rli.slave_running))
...@@ -2736,7 +2736,6 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list) ...@@ -2736,7 +2736,6 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list)
bool not_all_support_one_shot(List<set_var_base> *var_list) bool not_all_support_one_shot(List<set_var_base> *var_list)
{ {
#if MYSQL_VERSION_ID < 50000
List_iterator_fast<set_var_base> it(*var_list); List_iterator_fast<set_var_base> it(*var_list);
set_var_base *var; set_var_base *var;
while ((var= it++)) while ((var= it++))
...@@ -2744,7 +2743,6 @@ bool not_all_support_one_shot(List<set_var_base> *var_list) ...@@ -2744,7 +2743,6 @@ bool not_all_support_one_shot(List<set_var_base> *var_list)
if (var->no_support_one_shot()) if (var->no_support_one_shot())
return 1; return 1;
} }
#endif
return 0; return 0;
} }
......
...@@ -49,20 +49,14 @@ class sys_var ...@@ -49,20 +49,14 @@ class sys_var
const char *name; const char *name;
sys_after_update_func after_update; sys_after_update_func after_update;
#if MYSQL_VERSION_ID < 50000
bool no_support_one_shot; bool no_support_one_shot;
#endif
sys_var(const char *name_arg) sys_var(const char *name_arg)
:name(name_arg), after_update(0) :name(name_arg), after_update(0)
#if MYSQL_VERSION_ID < 50000
, no_support_one_shot(1) , no_support_one_shot(1)
#endif
{} {}
sys_var(const char *name_arg,sys_after_update_func func) sys_var(const char *name_arg,sys_after_update_func func)
:name(name_arg), after_update(func) :name(name_arg), after_update(func)
#if MYSQL_VERSION_ID < 50000
, no_support_one_shot(1) , no_support_one_shot(1)
#endif
{} {}
virtual ~sys_var() {} virtual ~sys_var() {}
virtual bool check(THD *thd, set_var *var); virtual bool check(THD *thd, set_var *var);
...@@ -507,9 +501,7 @@ class sys_var_collation :public sys_var_thd ...@@ -507,9 +501,7 @@ class sys_var_collation :public sys_var_thd
public: public:
sys_var_collation(const char *name_arg) :sys_var_thd(name_arg) sys_var_collation(const char *name_arg) :sys_var_thd(name_arg)
{ {
#if MYSQL_VERSION_ID < 50000
no_support_one_shot= 0; no_support_one_shot= 0;
#endif
} }
bool check(THD *thd, set_var *var); bool check(THD *thd, set_var *var);
SHOW_TYPE type() { return SHOW_CHAR; } SHOW_TYPE type() { return SHOW_CHAR; }
...@@ -529,13 +521,11 @@ class sys_var_character_set :public sys_var_thd ...@@ -529,13 +521,11 @@ class sys_var_character_set :public sys_var_thd
sys_var_thd(name_arg) sys_var_thd(name_arg)
{ {
nullable= 0; nullable= 0;
#if MYSQL_VERSION_ID < 50000
/* /*
In fact only almost all variables derived from sys_var_character_set In fact only almost all variables derived from sys_var_character_set
support ONE_SHOT; character_set_results doesn't. But that's good enough. support ONE_SHOT; character_set_results doesn't. But that's good enough.
*/ */
no_support_one_shot= 0; no_support_one_shot= 0;
#endif
} }
bool check(THD *thd, set_var *var); bool check(THD *thd, set_var *var);
SHOW_TYPE type() { return SHOW_CHAR; } SHOW_TYPE type() { return SHOW_CHAR; }
...@@ -574,7 +564,7 @@ class sys_var_character_set_server :public sys_var_character_set ...@@ -574,7 +564,7 @@ class sys_var_character_set_server :public sys_var_character_set
public: public:
sys_var_character_set_server(const char *name_arg) : sys_var_character_set_server(const char *name_arg) :
sys_var_character_set(name_arg) {} sys_var_character_set(name_arg) {}
#if defined(HAVE_REPLICATION) && (MYSQL_VERSION_ID < 50000) #if defined(HAVE_REPLICATION)
bool check(THD *thd, set_var *var); bool check(THD *thd, set_var *var);
#endif #endif
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
...@@ -612,7 +602,7 @@ class sys_var_collation_server :public sys_var_collation ...@@ -612,7 +602,7 @@ class sys_var_collation_server :public sys_var_collation
{ {
public: public:
sys_var_collation_server(const char *name_arg) :sys_var_collation(name_arg) {} sys_var_collation_server(const char *name_arg) :sys_var_collation(name_arg) {}
#if defined(HAVE_REPLICATION) && (MYSQL_VERSION_ID < 50000) #if defined(HAVE_REPLICATION)
bool check(THD *thd, set_var *var); bool check(THD *thd, set_var *var);
#endif #endif
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
...@@ -722,9 +712,7 @@ class sys_var_thd_time_zone :public sys_var_thd ...@@ -722,9 +712,7 @@ class sys_var_thd_time_zone :public sys_var_thd
sys_var_thd_time_zone(const char *name_arg): sys_var_thd_time_zone(const char *name_arg):
sys_var_thd(name_arg) sys_var_thd(name_arg)
{ {
#if MYSQL_VERSION_ID < 50000
no_support_one_shot= 0; no_support_one_shot= 0;
#endif
} }
bool check(THD *thd, set_var *var); bool check(THD *thd, set_var *var);
SHOW_TYPE type() { return SHOW_CHAR; } SHOW_TYPE type() { return SHOW_CHAR; }
...@@ -752,9 +740,7 @@ class set_var_base :public Sql_alloc ...@@ -752,9 +740,7 @@ class set_var_base :public Sql_alloc
virtual int update(THD *thd)=0; /* To set the value */ virtual int update(THD *thd)=0; /* To set the value */
/* light check for PS */ /* light check for PS */
virtual int light_check(THD *thd) { return check(thd); } virtual int light_check(THD *thd) { return check(thd); }
#if MYSQL_VERSION_ID < 50000
virtual bool no_support_one_shot() { return 1; } virtual bool no_support_one_shot() { return 1; }
#endif
}; };
...@@ -797,9 +783,7 @@ class set_var :public set_var_base ...@@ -797,9 +783,7 @@ class set_var :public set_var_base
int check(THD *thd); int check(THD *thd);
int update(THD *thd); int update(THD *thd);
int light_check(THD *thd); int light_check(THD *thd);
#if MYSQL_VERSION_ID < 50000
bool no_support_one_shot() { return var->no_support_one_shot; } bool no_support_one_shot() { return var->no_support_one_shot; }
#endif
}; };
......
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