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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
70ac1c71
Commit
70ac1c71
authored
Oct 21, 2010
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Manual Merge
parents
9129cb18
6646fecc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
104 additions
and
2 deletions
+104
-2
mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
+46
-2
mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test
mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test
+57
-0
sql/log_event.cc
sql/log_event.cc
+1
-0
No files found.
mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
View file @
70ac1c71
...
...
@@ -65,9 +65,53 @@ slave-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server
slave-bin.000001 # Query # # BEGIN
slave-bin.000001 # Table_map # # table_id: # (test.t1)
slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
slave-bin.000001 #
Query # # COMMIT
slave-bin.000001 #
Xid # # COMMIT /* XID */
slave-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t2_tmp` /* generated by server */
slave-bin.000001 # Query # # BEGIN
slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
slave-bin.000001 #
Query # # COMMIT
slave-bin.000001 #
Xid # # COMMIT /* XID */
slave-bin.000001 # Query # # use `test`; DROP TABLE `t3`,`t1` /* generated by server */
# Bug#55478 Row events wrongly apply on the temporary table of the same name
# ==========================================================================
# The statement should be binlogged
CREATE TEMPORARY TABLE t1(c1 INT) ENGINE=InnoDB;
# Case 1: CREATE TABLE t1 ... SELECT
# ----------------------------------
# The statement generates row events on t1. And the rows events should
# be inserted into the base table on slave.
CREATE TABLE t1 ENGINE=MyISAM SELECT rand();
show binlog events in 'master-bin.000001' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; CREATE TABLE `t1` (
`rand()` double NOT NULL DEFAULT '0'
) ENGINE=MyISAM
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
# Case 2: DROP TEMPORARY TABLE in a transacation
# ----------------------------------------------
BEGIN;
DROP TEMPORARY TABLE t1;
# The rows event will binlogged before 'DROP TEMPORARY TABLE t1',
# as t1 is non-transactional table
INSERT INTO t1 VALUES(Rand());
COMMIT;
show binlog events in 'master-bin.000001' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t1` /* generated by server */
master-bin.000001 # Query # # COMMIT
# Compare the base table.
Comparing tables master:test.t1 and slave:test.t1
DROP TABLE t1;
mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test
View file @
70ac1c71
...
...
@@ -11,6 +11,7 @@
source
include
/
master
-
slave
.
inc
;
source
include
/
have_binlog_format_mixed
.
inc
;
source
include
/
have_innodb
.
inc
;
--
echo
====
Initialize
====
...
...
@@ -146,3 +147,59 @@ DROP TABLE t3, t1;
--
sync_slave_with_master
--
source
include
/
show_binlog_events
.
inc
--
echo
--
echo
# Bug#55478 Row events wrongly apply on the temporary table of the same name
--
echo
# ==========================================================================
connection
master
;
let
$binlog_file
=
query_get_value
(
SHOW
MASTER
STATUS
,
File
,
1
);
let
$binlog_start
=
query_get_value
(
SHOW
MASTER
STATUS
,
Position
,
1
);
--
echo
# The statement should be binlogged
CREATE
TEMPORARY
TABLE
t1
(
c1
INT
)
ENGINE
=
InnoDB
;
--
echo
--
echo
# Case 1: CREATE TABLE t1 ... SELECT
--
echo
# ----------------------------------
let
$binlog_file
=
query_get_value
(
SHOW
MASTER
STATUS
,
File
,
1
);
let
$binlog_start
=
query_get_value
(
SHOW
MASTER
STATUS
,
Position
,
1
);
--
echo
--
echo
# The statement generates row events on t1. And the rows events should
--
echo
# be inserted into the base table on slave.
CREATE
TABLE
t1
ENGINE
=
MyISAM
SELECT
rand
();
source
include
/
show_binlog_events
.
inc
;
let
$binlog_file
=
query_get_value
(
SHOW
MASTER
STATUS
,
File
,
1
);
let
$binlog_start
=
query_get_value
(
SHOW
MASTER
STATUS
,
Position
,
1
);
--
echo
--
echo
# Case 2: DROP TEMPORARY TABLE in a transacation
--
echo
# ----------------------------------------------
--
echo
BEGIN
;
DROP
TEMPORARY
TABLE
t1
;
# The patch for BUG#55478 fixed the problem only on RBR. The problem on SBR
# will be fixed by the patch for bug#55709. So This statement cannot be
# executed until Bug#55709 is fixed
#
# INSERT INTO t1 VALUES(1);
--
echo
# The rows event will binlogged before 'DROP TEMPORARY TABLE t1',
--
echo
# as t1 is non-transactional table
INSERT
INTO
t1
VALUES
(
Rand
());
COMMIT
;
source
include
/
show_binlog_events
.
inc
;
--
echo
# Compare the base table.
let
diff_table
=
test
.
t1
;
source
include
/
rpl_diff_tables
.
inc
;
--
echo
connection
master
;
DROP
TABLE
t1
;
source
include
/
master
-
slave
-
end
.
inc
;
sql/log_event.cc
View file @
70ac1c71
...
...
@@ -8405,6 +8405,7 @@ int Table_map_log_event::do_apply_event(Relay_log_info const *rli)
m_field_metadata
,
m_field_metadata_size
,
m_null_bits
,
m_flags
);
table_list
->
m_tabledef_valid
=
TRUE
;
table_list
->
open_type
=
OT_BASE_ONLY
;
/*
We record in the slave's information that the table should be
...
...
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