Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
198350d6
Commit
198350d6
authored
Sep 02, 2005
by
lars@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/users/lthalmann/bk/mysql-4.1
into mysql.com:/users/lthalmann/bk/mysql-5.0
parents
d0a78f4d
9d8f51fe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
28 deletions
+94
-28
mysql-test/r/rpl_replicate_do.result
mysql-test/r/rpl_replicate_do.result
+11
-0
mysql-test/t/rpl_replicate_do.test
mysql-test/t/rpl_replicate_do.test
+18
-0
sql/log_event.cc
sql/log_event.cc
+20
-0
sql/sql_parse.cc
sql/sql_parse.cc
+45
-28
No files found.
mysql-test/r/rpl_replicate_do.result
View file @
198350d6
...
@@ -29,3 +29,14 @@ drop table if exists t1,t2,t11;
...
@@ -29,3 +29,14 @@ drop table if exists t1,t2,t11;
show slave status;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1658 # # master-bin.000001 Yes Yes test.t1 0 0 1658 # None 0 No #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1658 # # master-bin.000001 Yes Yes test.t1 0 0 1658 # None 0 No #
create table t1 (ts timestamp);
set one_shot time_zone='met';
insert into t1 values('2005-08-12 00:00:00');
set one_shot time_zone='met';
select * from t1;
ts
2005-08-12 00:00:00
set one_shot time_zone='met';
select * from t1;
ts
2005-08-12 00:00:00
mysql-test/t/rpl_replicate_do.test
View file @
198350d6
...
@@ -36,4 +36,22 @@ sync_with_master;
...
@@ -36,4 +36,22 @@ sync_with_master;
--
replace_column
1
# 8 # 9 # 23 # 33 #
--
replace_column
1
# 8 # 9 # 23 # 33 #
show
slave
status
;
show
slave
status
;
#
# BUG#12542
# TEST: "SET ONE_SHOT should always be executed on slave"
#
# We could use any timezone different than server default in this test
#
connection
master
;
create
table
t1
(
ts
timestamp
);
set
one_shot
time_zone
=
'met'
;
insert
into
t1
values
(
'2005-08-12 00:00:00'
);
set
one_shot
time_zone
=
'met'
;
select
*
from
t1
;
sync_slave_with_master
;
connection
slave
;
set
one_shot
time_zone
=
'met'
;
select
*
from
t1
;
# End of 4.1 tests
# End of 4.1 tests
sql/log_event.cc
View file @
198350d6
...
@@ -1554,6 +1554,16 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli, const char *query
...
@@ -1554,6 +1554,16 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli, const char *query
clear_all_errors
(
thd
,
rli
);
clear_all_errors
(
thd
,
rli
);
/*
Note: We do not need to execute reset_one_shot_variables() if this
db_ok() test fails.
Reason: The db stored in binlog events is the same for SET and for
its companion query. If the SET is ignored because of
db_ok(), the companion query will also be ignored, and if
the companion query is ignored in the db_ok() test of
::exec_event(), then the companion SET also have so we
don't need to reset_one_shot_variables().
*/
if
(
db_ok
(
thd
->
db
,
replicate_do_db
,
replicate_ignore_db
))
if
(
db_ok
(
thd
->
db
,
replicate_do_db
,
replicate_ignore_db
))
{
{
thd
->
set_time
((
time_t
)
when
);
thd
->
set_time
((
time_t
)
when
);
...
@@ -2703,6 +2713,16 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
...
@@ -2703,6 +2713,16 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
Create_file_log_event::exec_event() and then discarding Append_block and
Create_file_log_event::exec_event() and then discarding Append_block and
al. Another way is do the filtering in the I/O thread (more efficient: no
al. Another way is do the filtering in the I/O thread (more efficient: no
disk writes at all).
disk writes at all).
Note: We do not need to execute reset_one_shot_variables() if this
db_ok() test fails.
Reason: The db stored in binlog events is the same for SET and for
its companion query. If the SET is ignored because of
db_ok(), the companion query will also be ignored, and if
the companion query is ignored in the db_ok() test of
::exec_event(), then the companion SET also have so we
don't need to reset_one_shot_variables().
*/
*/
if
(
db_ok
(
thd
->
db
,
replicate_do_db
,
replicate_ignore_db
))
if
(
db_ok
(
thd
->
db
,
replicate_do_db
,
replicate_ignore_db
))
{
{
...
...
sql/sql_parse.cc
View file @
198350d6
...
@@ -174,6 +174,9 @@ static bool begin_trans(THD *thd)
...
@@ -174,6 +174,9 @@ static bool begin_trans(THD *thd)
}
}
#ifdef HAVE_REPLICATION
#ifdef HAVE_REPLICATION
/*
Returns true if all tables should be ignored
*/
inline
bool
all_tables_not_ok
(
THD
*
thd
,
TABLE_LIST
*
tables
)
inline
bool
all_tables_not_ok
(
THD
*
thd
,
TABLE_LIST
*
tables
)
{
{
return
(
table_rules_on
&&
tables
&&
!
tables_ok
(
thd
,
tables
)
&&
return
(
table_rules_on
&&
tables
&&
!
tables_ok
(
thd
,
tables
)
&&
...
@@ -2252,6 +2255,22 @@ bool alloc_query(THD *thd, char *packet, ulong packet_length)
...
@@ -2252,6 +2255,22 @@ bool alloc_query(THD *thd, char *packet, ulong packet_length)
return
FALSE
;
return
FALSE
;
}
}
static
void
reset_one_shot_variables
(
THD
*
thd
)
{
thd
->
variables
.
character_set_client
=
global_system_variables
.
character_set_client
;
thd
->
variables
.
collation_connection
=
global_system_variables
.
collation_connection
;
thd
->
variables
.
collation_database
=
global_system_variables
.
collation_database
;
thd
->
variables
.
collation_server
=
global_system_variables
.
collation_server
;
thd
->
update_charset
();
thd
->
variables
.
time_zone
=
global_system_variables
.
time_zone
;
thd
->
one_shot_set
=
0
;
}
/****************************************************************************
/****************************************************************************
** mysql_execute_command
** mysql_execute_command
...
@@ -2335,16 +2354,22 @@ mysql_execute_command(THD *thd)
...
@@ -2335,16 +2354,22 @@ mysql_execute_command(THD *thd)
/*
/*
Skip if we are in the slave thread, some table rules have been
Skip if we are in the slave thread, some table rules have been
given and the table list says the query should not be replicated.
given and the table list says the query should not be replicated.
Exception is DROP TEMPORARY TABLE IF EXISTS: we always execute it
(otherwise we have stale files on slave caused by exclusion of one tmp
Exceptions are:
table).
- SET: we always execute it (Not that many SET commands exists in
the binary log anyway -- only 4.1 masters write SET statements,
in 5.0 there are no SET statements in the binary log)
- DROP TEMPORARY TABLE IF EXISTS: we always execute it (otherwise we
have stale files on slave caused by exclusion of one tmp table).
*/
*/
if
(
!
(
lex
->
sql_command
==
SQLCOM_DROP_TABLE
&&
if
(
!
(
lex
->
sql_command
==
SQLCOM_SET_OPTION
)
&&
!
(
lex
->
sql_command
==
SQLCOM_DROP_TABLE
&&
lex
->
drop_temporary
&&
lex
->
drop_if_exists
)
&&
lex
->
drop_temporary
&&
lex
->
drop_if_exists
)
&&
all_tables_not_ok
(
thd
,
all_tables
))
all_tables_not_ok
(
thd
,
all_tables
))
{
{
/* we warn the slave SQL thread */
/* we warn the slave SQL thread */
my_message
(
ER_SLAVE_IGNORED_TABLE
,
ER
(
ER_SLAVE_IGNORED_TABLE
),
MYF
(
0
));
my_message
(
ER_SLAVE_IGNORED_TABLE
,
ER
(
ER_SLAVE_IGNORED_TABLE
),
MYF
(
0
));
reset_one_shot_variables
(
thd
);
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
#ifndef TO_BE_DELETED
#ifndef TO_BE_DELETED
...
@@ -3572,6 +3597,7 @@ end_with_restore_list:
...
@@ -3572,6 +3597,7 @@ end_with_restore_list:
!
db_ok_with_wild_table
(
lex
->
name
)))
!
db_ok_with_wild_table
(
lex
->
name
)))
{
{
my_message
(
ER_SLAVE_IGNORED_TABLE
,
ER
(
ER_SLAVE_IGNORED_TABLE
),
MYF
(
0
));
my_message
(
ER_SLAVE_IGNORED_TABLE
,
ER
(
ER_SLAVE_IGNORED_TABLE
),
MYF
(
0
));
reset_one_shot_variables
(
thd
);
break
;
break
;
}
}
#endif
#endif
...
@@ -3606,6 +3632,7 @@ end_with_restore_list:
...
@@ -3606,6 +3632,7 @@ end_with_restore_list:
!
db_ok_with_wild_table
(
lex
->
name
)))
!
db_ok_with_wild_table
(
lex
->
name
)))
{
{
my_message
(
ER_SLAVE_IGNORED_TABLE
,
ER
(
ER_SLAVE_IGNORED_TABLE
),
MYF
(
0
));
my_message
(
ER_SLAVE_IGNORED_TABLE
,
ER
(
ER_SLAVE_IGNORED_TABLE
),
MYF
(
0
));
reset_one_shot_variables
(
thd
);
break
;
break
;
}
}
#endif
#endif
...
@@ -3646,6 +3673,7 @@ end_with_restore_list:
...
@@ -3646,6 +3673,7 @@ end_with_restore_list:
!
db_ok_with_wild_table
(
db
)))
!
db_ok_with_wild_table
(
db
)))
{
{
my_message
(
ER_SLAVE_IGNORED_TABLE
,
ER
(
ER_SLAVE_IGNORED_TABLE
),
MYF
(
0
));
my_message
(
ER_SLAVE_IGNORED_TABLE
,
ER
(
ER_SLAVE_IGNORED_TABLE
),
MYF
(
0
));
reset_one_shot_variables
(
thd
);
break
;
break
;
}
}
#endif
#endif
...
@@ -4702,30 +4730,19 @@ end_with_restore_list:
...
@@ -4702,30 +4730,19 @@ end_with_restore_list:
}
}
thd
->
proc_info
=
"query end"
;
thd
->
proc_info
=
"query end"
;
/* Two binlog-related cleanups: */
/* Two binlog-related cleanups: */
if
(
thd
->
one_shot_set
)
{
/*
/*
Reset system variables temporarily modified by SET ONE SHOT.
If this is a SET, do nothing. This is to allow mysqlbinlog to print
many SET commands (in this case we want the charset temp setting to
Exception: If this is a SET, do nothing. This is to allow
live until the real query). This is also needed so that SET
mysqlbinlog to print many SET commands (in this case we want the
CHARACTER_SET_CLIENT... does not cancel itself immediately.
charset temp setting to live until the real query). This is also
*/
needed so that SET CHARACTER_SET_CLIENT... does not cancel itself
if
(
lex
->
sql_command
!=
SQLCOM_SET_OPTION
)
immediately.
{
*/
thd
->
variables
.
character_set_client
=
if
(
thd
->
one_shot_set
&&
lex
->
sql_command
!=
SQLCOM_SET_OPTION
)
global_system_variables
.
character_set_client
;
reset_one_shot_variables
(
thd
);
thd
->
variables
.
collation_connection
=
global_system_variables
.
collation_connection
;
thd
->
variables
.
collation_database
=
global_system_variables
.
collation_database
;
thd
->
variables
.
collation_server
=
global_system_variables
.
collation_server
;
thd
->
update_charset
();
thd
->
variables
.
time_zone
=
global_system_variables
.
time_zone
;
thd
->
one_shot_set
=
0
;
}
}
/*
/*
The return value for ROW_COUNT() is "implementation dependent" if
The return value for ROW_COUNT() is "implementation dependent" if
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment