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
a982db81
Commit
a982db81
authored
Aug 16, 2006
by
mats@romeo.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merging with mysql-5.1-new-rpl tree
parents
6129be94
691355b6
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
21 deletions
+86
-21
mysql-test/r/rpl_switch_stm_row_mixed.result
mysql-test/r/rpl_switch_stm_row_mixed.result
+29
-0
mysql-test/t/rpl_switch_stm_row_mixed.test
mysql-test/t/rpl_switch_stm_row_mixed.test
+35
-1
sql/log.cc
sql/log.cc
+1
-1
sql/sql_class.cc
sql/sql_class.cc
+21
-19
No files found.
mysql-test/r/rpl_switch_stm_row_mixed.result
View file @
a982db81
...
...
@@ -7,6 +7,8 @@ start slave;
drop database if exists mysqltest1;
create database mysqltest1;
use mysqltest1;
set session binlog_format=row;
set global binlog_format=row;
show global variables like "binlog_format%";
Variable_name Value
binlog_format ROW
...
...
@@ -334,6 +336,26 @@ count(*)
select count(*) from t5;
count(*)
58
SET SESSION BINLOG_FORMAT=STATEMENT;
CREATE TABLE t11 (song VARCHAR(255));
LOCK TABLES t11 WRITE;
SET SESSION BINLOG_FORMAT=ROW;
INSERT INTO t11 VALUES('Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict');
SET SESSION BINLOG_FORMAT=STATEMENT;
INSERT INTO t11 VALUES('Careful With That Axe, Eugene');
UNLOCK TABLES;
SELECT * FROM t11;
song Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict
song Careful With That Axe, Eugene
USE mysqltest1;
SELECT * FROM t11;
song Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict
song Careful With That Axe, Eugene
SET SESSION BINLOG_FORMAT=MIXED;
CREATE TABLE t12 (data LONG);
LOCK TABLES t12 WRITE;
INSERT INTO t12 VALUES(UUID());
UNLOCK TABLES;
select count(*) from t11;
count(*)
8
...
...
@@ -463,6 +485,13 @@ master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t11 (song VARCHAR(255))
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t11)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; INSERT INTO t11 VALUES('Careful With That Axe, Eugene')
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t12 (data LONG)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t12)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1)
...
...
mysql-test/t/rpl_switch_stm_row_mixed.test
View file @
a982db81
--
source
include
/
have_
binlog_format_row
.
inc
--
source
include
/
have_
row_based
.
inc
--
source
include
/
master
-
slave
.
inc
connection
master
;
...
...
@@ -8,6 +8,9 @@ create database mysqltest1;
--
enable_warnings
use
mysqltest1
;
set
session
binlog_format
=
row
;
set
global
binlog_format
=
row
;
show
global
variables
like
"binlog_format%"
;
show
session
variables
like
"binlog_format%"
;
select
@@
global
.
binlog_format
,
@@
session
.
binlog_format
;
...
...
@@ -461,7 +464,38 @@ if ($you_want_to_test_UDF)
select
count
(
*
)
from
t9
;
}
#
# Bug#20863 If binlog format is changed between update and unlock of
# tables, wrong binlog
#
connection
master
;
SET
SESSION
BINLOG_FORMAT
=
STATEMENT
;
CREATE
TABLE
t11
(
song
VARCHAR
(
255
));
LOCK
TABLES
t11
WRITE
;
SET
SESSION
BINLOG_FORMAT
=
ROW
;
INSERT
INTO
t11
VALUES
(
'Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict'
);
SET
SESSION
BINLOG_FORMAT
=
STATEMENT
;
INSERT
INTO
t11
VALUES
(
'Careful With That Axe, Eugene'
);
UNLOCK
TABLES
;
--
query_vertical
SELECT
*
FROM
t11
sync_slave_with_master
;
USE
mysqltest1
;
--
query_vertical
SELECT
*
FROM
t11
connection
master
;
SET
SESSION
BINLOG_FORMAT
=
MIXED
;
CREATE
TABLE
t12
(
data
LONG
);
LOCK
TABLES
t12
WRITE
;
INSERT
INTO
t12
VALUES
(
UUID
());
UNLOCK
TABLES
;
--
replace_column
2
# 5 #
--
replace_regex
/
table_id
:
[
0
-
9
]
+/
table_id
:
#/
show
binlog
events
from
102
;
sync_slave_with_master
;
# as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID
--
exec
$MYSQL_DUMP
--
compact
--
order
-
by
-
primary
--
skip
-
extended
-
insert
--
no
-
create
-
info
mysqltest1
>
$MYSQLTEST_VARDIR
/
tmp
/
rpl_switch_stm_row_mixed_master
.
sql
--
exec
$MYSQL_DUMP_SLAVE
--
compact
--
order
-
by
-
primary
--
skip
-
extended
-
insert
--
no
-
create
-
info
mysqltest1
>
$MYSQLTEST_VARDIR
/
tmp
/
rpl_switch_stm_row_mixed_slave
.
sql
...
...
sql/log.cc
View file @
a982db81
...
...
@@ -3165,7 +3165,7 @@ int MYSQL_BIN_LOG::
flush_and_set_pending_rows_event
(
THD
*
thd
,
Rows_log_event
*
event
)
{
DBUG_ENTER
(
"MYSQL_BIN_LOG::flush_and_set_pending_rows_event(event)"
);
DBUG_ASSERT
(
thd
->
current_stmt_binlog_row_based
&&
mysql_bin_log
.
is_open
());
DBUG_ASSERT
(
mysql_bin_log
.
is_open
());
DBUG_PRINT
(
"enter"
,
(
"event=%p"
,
event
));
int
error
=
0
;
...
...
sql/sql_class.cc
View file @
a982db81
...
...
@@ -2652,7 +2652,12 @@ int THD::binlog_delete_row(TABLE* table, bool is_trans,
int
THD
::
binlog_flush_pending_rows_event
(
bool
stmt_end
)
{
DBUG_ENTER
(
"THD::binlog_flush_pending_rows_event"
);
if
(
!
current_stmt_binlog_row_based
||
!
mysql_bin_log
.
is_open
())
/*
We shall flush the pending event even if we are not in row-based
mode: it might be the case that we left row-based mode before
flushing anything (e.g., if we have explicitly locked tables).
*/
if
(
!
mysql_bin_log
.
is_open
())
DBUG_RETURN
(
0
);
/*
...
...
@@ -2718,6 +2723,21 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype,
DBUG_PRINT
(
"enter"
,
(
"qtype=%d, query='%s'"
,
qtype
,
query
));
DBUG_ASSERT
(
query
&&
mysql_bin_log
.
is_open
());
/*
If we are not in prelocked mode, mysql_unlock_tables() will be
called after this binlog_query(), so we have to flush the pending
rows event with the STMT_END_F set to unlock all tables at the
slave side as well.
If we are in prelocked mode, the flushing will be done inside the
top-most close_thread_tables().
*/
#ifdef HAVE_ROW_BASED_REPLICATION
if
(
this
->
prelocked_mode
==
NON_PRELOCKED
)
if
(
int
error
=
binlog_flush_pending_rows_event
(
TRUE
))
DBUG_RETURN
(
error
);
#endif
/*HAVE_ROW_BASED_REPLICATION*/
switch
(
qtype
)
{
case
THD
:
:
MYSQL_QUERY_TYPE
:
/*
...
...
@@ -2731,25 +2751,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype,
case
THD
:
:
ROW_QUERY_TYPE
:
#ifdef HAVE_ROW_BASED_REPLICATION
if
(
current_stmt_binlog_row_based
)
{
/*
If thd->lock is set, then we are not inside a stored function.
In that case, mysql_unlock_tables() will be called after this
binlog_query(), so we have to flush the pending rows event
with the STMT_END_F set to unlock all tables at the slave side
as well.
We will not flush the pending event, if thd->lock is NULL.
This means that we are inside a stored function or trigger, so
the flushing will be done inside the top-most
close_thread_tables().
*/
#ifdef HAVE_ROW_BASED_REPLICATION
if
(
this
->
lock
)
DBUG_RETURN
(
binlog_flush_pending_rows_event
(
TRUE
));
#endif
/*HAVE_ROW_BASED_REPLICATION*/
DBUG_RETURN
(
0
);
}
#endif
/* Otherwise, we fall through */
case
THD
:
:
STMT_QUERY_TYPE
:
...
...
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