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
2a243fa2
Commit
2a243fa2
authored
Oct 06, 2009
by
Alfranio Correia
Browse files
Options
Browse Files
Download
Plain Diff
mysql-5.1-bugteam (local) --> mysql-5.1-bugteam
parents
618d7980
b31e0c9a
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1192 additions
and
16 deletions
+1192
-16
mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test
...est/extra/binlog_tests/binlog_failure_mixing_engines.test
+300
-0
mysql-test/suite/binlog/r/binlog_mixed_failure_mixing_engines.result
...suite/binlog/r/binlog_mixed_failure_mixing_engines.result
+406
-0
mysql-test/suite/binlog/r/binlog_row_failure_mixing_engines.result
...t/suite/binlog/r/binlog_row_failure_mixing_engines.result
+440
-0
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
...l-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
+15
-3
mysql-test/suite/binlog/t/binlog_mixed_failure_mixing_engines.test
...t/suite/binlog/t/binlog_mixed_failure_mixing_engines.test
+4
-0
mysql-test/suite/binlog/t/binlog_row_failure_mixing_engines.test
...est/suite/binlog/t/binlog_row_failure_mixing_engines.test
+4
-0
mysql-test/suite/rpl/r/rpl_row_create_table.result
mysql-test/suite/rpl/r/rpl_row_create_table.result
+2
-2
sql/log.cc
sql/log.cc
+21
-11
No files found.
mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test
0 → 100644
View file @
2a243fa2
This diff is collapsed.
Click to expand it.
mysql-test/suite/binlog/r/binlog_mixed_failure_mixing_engines.result
0 → 100644
View file @
2a243fa2
This diff is collapsed.
Click to expand it.
mysql-test/suite/binlog/r/binlog_row_failure_mixing_engines.result
0 → 100644
View file @
2a243fa2
This diff is collapsed.
Click to expand it.
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
View file @
2a243fa2
...
...
@@ -133,6 +133,10 @@ 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 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
insert into t1 values(11);
commit;
show binlog events from <binlog_start>;
...
...
@@ -144,6 +148,8 @@ master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
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 # Xid # # COMMIT /* XID */
...
...
@@ -272,6 +278,10 @@ 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 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; drop table t1,t2
master-bin.000001 # Query # # use `test`; create table t0 (n int)
master-bin.000001 # Query # # BEGIN
...
...
@@ -372,7 +382,7 @@ master-bin.000001 # Query # # use `test`; DROP TABLE if exists t2
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 # #
ROLLBACK
master-bin.000001 # Query # #
COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb
master-bin.000001 # Query # # BEGIN
...
...
@@ -390,9 +400,11 @@ master-bin.000001 # Query # # use `test`; DROP TABLE t2
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 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # #
ROLLBACK
master-bin.000001 # Query # #
COMMIT
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
...
...
@@ -400,7 +412,7 @@ master-bin.000001 # Query # # COMMIT
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 # #
ROLLBACK
master-bin.000001 # Query # #
COMMIT
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
...
...
mysql-test/suite/binlog/t/binlog_mixed_failure_mixing_engines.test
0 → 100644
View file @
2a243fa2
--
source
include
/
have_binlog_format_mixed
.
inc
--
source
include
/
have_innodb
.
inc
--
source
extra
/
binlog_tests
/
binlog_failure_mixing_engines
.
test
mysql-test/suite/binlog/t/binlog_row_failure_mixing_engines.test
0 → 100644
View file @
2a243fa2
--
source
include
/
have_binlog_format_row
.
inc
--
source
include
/
have_innodb
.
inc
--
source
extra
/
binlog_tests
/
binlog_failure_mixing_engines
.
test
mysql-test/suite/rpl/r/rpl_row_create_table.result
View file @
2a243fa2
...
...
@@ -176,7 +176,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
# 106 Query # 174 BEGIN
# 174 Table_map # 216 table_id: # (test.t7)
# 216 Write_rows # 272 table_id: # flags: STMT_END_F
# 272 Query # 34
3 ROLLBACK
# 272 Query # 34
1 COMMIT
SELECT * FROM t7 ORDER BY a,b;
a b
1 2
...
...
@@ -327,7 +327,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
# 1329 Query # 1397 BEGIN
# 1397 Table_map # 1438 table_id: # (test.t1)
# 1438 Write_rows # 1482 table_id: # flags: STMT_END_F
# 1482 Query # 155
3 ROLLBACK
# 1482 Query # 155
1 COMMIT
SHOW TABLES;
Tables_in_test
t1
...
...
sql/log.cc
View file @
2a243fa2
...
...
@@ -153,7 +153,7 @@ private:
class
binlog_trx_data
{
public:
binlog_trx_data
()
:
at_least_one_stmt
(
0
),
incident
(
FALSE
),
m_pending
(
0
),
:
at_least_one_stmt
_committed
(
0
),
incident
(
FALSE
),
m_pending
(
0
),
before_stmt_pos
(
MY_OFF_T_UNDEF
)
{
trans_log
.
end_of_file
=
max_binlog_cache_size
;
...
...
@@ -182,7 +182,10 @@ public:
{
DBUG_PRINT
(
"info"
,
(
"truncating to position %lu"
,
(
ulong
)
pos
));
DBUG_PRINT
(
"info"
,
(
"before_stmt_pos=%lu"
,
(
ulong
)
pos
));
delete
pending
();
if
(
pending
())
{
delete
pending
();
}
set_pending
(
0
);
reinit_io_cache
(
&
trans_log
,
WRITE_CACHE
,
pos
,
0
,
0
);
trans_log
.
end_of_file
=
max_binlog_cache_size
;
...
...
@@ -192,12 +195,12 @@ public:
/*
The only valid positions that can be truncated to are at the
beginning of a statement. We are relying on this fact to be able
to set the at_least_one_stmt flag correctly. In other word, if
to set the at_least_one_stmt
_committed
flag correctly. In other word, if
we are truncating to the beginning of the transaction cache,
there will be no statements in the cache, otherwhise, we will
have at least one statement in the transaction cache.
*/
at_least_one_stmt
=
(
pos
>
0
);
at_least_one_stmt
_committed
=
(
pos
>
0
);
}
/*
...
...
@@ -239,7 +242,7 @@ public:
Boolean that is true if there is at least one statement in the
transaction cache.
*/
bool
at_least_one_stmt
;
bool
at_least_one_stmt
_committed
;
bool
incident
;
private:
...
...
@@ -1272,7 +1275,7 @@ static bool stmt_has_updated_trans_table(THD *thd)
{
Ha_trx_info
*
ha_info
;
for
(
ha_info
=
thd
->
transaction
.
stmt
.
ha_list
;
ha_info
;
ha_info
=
ha_info
->
next
())
for
(
ha_info
=
thd
->
transaction
.
stmt
.
ha_list
;
ha_info
&&
ha_info
->
is_started
()
;
ha_info
=
ha_info
->
next
())
{
if
(
ha_info
->
is_trx_read_write
()
&&
ha_info
->
ht
()
!=
binlog_hton
)
return
(
TRUE
);
...
...
@@ -1535,13 +1538,17 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all)
YESNO
(
in_transaction
),
YESNO
(
thd
->
transaction
.
all
.
modified_non_trans_table
),
YESNO
(
thd
->
transaction
.
stmt
.
modified_non_trans_table
)));
if
(
!
in_transaction
||
all
)
if
(
!
in_transaction
||
all
||
(
!
all
&&
!
trx_data
->
at_least_one_stmt_committed
&&
!
stmt_has_updated_trans_table
(
thd
)
&&
thd
->
transaction
.
stmt
.
modified_non_trans_table
))
{
Query_log_event
qev
(
thd
,
STRING_WITH_LEN
(
"COMMIT"
),
TRUE
,
TRUE
,
0
);
error
=
binlog_end_trans
(
thd
,
trx_data
,
&
qev
,
all
);
goto
end
;
}
trx_data
->
at_least_one_stmt_committed
=
my_b_tell
(
&
trx_data
->
trans_log
)
>
0
;
end:
if
(
!
all
)
trx_data
->
before_stmt_pos
=
MY_OFF_T_UNDEF
;
// part of the stmt commit
...
...
@@ -1608,15 +1615,18 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
{
/*
We flush the cache with a rollback, wrapped in a beging/rollback if:
. aborting a trans
cation that modified a non-transactional table or
;
. aborting a trans
action that modified a non-transactional table
;
. aborting a statement that modified both transactional and
non-transctional tables but which is not in the boundaries of any
transaction;
non-trans
a
ctional tables but which is not in the boundaries of any
transaction
or there was no early change
;
. the OPTION_KEEP_LOG is activate.
*/
if
((
all
&&
thd
->
transaction
.
all
.
modified_non_trans_table
)
||
(
!
all
&&
thd
->
transaction
.
stmt
.
modified_non_trans_table
&&
!
(
thd
->
options
&
(
OPTION_BEGIN
|
OPTION_NOT_AUTOCOMMIT
)))
||
(
!
all
&&
thd
->
transaction
.
stmt
.
modified_non_trans_table
&&
!
trx_data
->
at_least_one_stmt_committed
&&
thd
->
current_stmt_binlog_row_based
)
||
((
thd
->
options
&
OPTION_KEEP_LOG
)))
{
Query_log_event
qev
(
thd
,
STRING_WITH_LEN
(
"ROLLBACK"
),
TRUE
,
TRUE
,
0
);
...
...
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