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
b0206c71
Commit
b0206c71
authored
Mar 09, 2010
by
Luis Soares
Browse files
Options
Browse Files
Download
Plain Diff
Automerge BUG 51251 bundle from bug report --> mysql-5.1-bugteam.
parents
888a354b
1fe647a4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
5 deletions
+77
-5
mysql-test/suite/binlog/r/binlog_row_innodb_truncate.result
mysql-test/suite/binlog/r/binlog_row_innodb_truncate.result
+28
-0
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
...l-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
+0
-1
mysql-test/suite/binlog/t/binlog_row_innodb_truncate.test
mysql-test/suite/binlog/t/binlog_row_innodb_truncate.test
+37
-0
sql/sql_delete.cc
sql/sql_delete.cc
+12
-4
No files found.
mysql-test/suite/binlog/r/binlog_row_innodb_truncate.result
0 → 100644
View file @
b0206c71
CREATE TABLE t1 ( c1 int , primary key (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1), (2), (3);
CREATE TEMPORARY TABLE IF NOT EXISTS t2 LIKE t1;
TRUNCATE TABLE t2;
DROP TABLE t1;
###############################################
### assertion: No event for 'TRUNCATE TABLE t2'
###############################################
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 ( c1 int , primary key (c1)) ENGINE=InnoDB
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 # # use `test`; DROP TABLE t1
###############################################
RESET MASTER;
CREATE TEMPORARY TABLE t1 (c1 int) Engine=InnoDB;
INSERT INTO t1 VALUES (1), (2), (3);
TRUNCATE t1;
DROP TEMPORARY TABLE t1;
###############################################
### assertion: No event for 'TRUNCATE TABLE t1'
###############################################
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
###############################################
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
View file @
b0206c71
...
...
@@ -413,7 +413,6 @@ 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 # # use `test`; TRUNCATE 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
...
...
mysql-test/suite/binlog/t/binlog_row_innodb_truncate.test
0 → 100644
View file @
b0206c71
--
source
include
/
have_binlog_format_row
.
inc
--
source
include
/
have_innodb
.
inc
#
# BUG#51251
#
# The test case checks if truncating a temporary table created with
# engine InnoDB will not cause the truncate statement to be binlogged.
# Before patch for BUG#51251, the TRUNCATE statements below would be
# binlogged, which would cause the slave to fail with "table does not
# exist".
CREATE
TABLE
t1
(
c1
int
,
primary
key
(
c1
))
ENGINE
=
InnoDB
;
INSERT
INTO
t1
VALUES
(
1
),
(
2
),
(
3
);
CREATE
TEMPORARY
TABLE
IF
NOT
EXISTS
t2
LIKE
t1
;
TRUNCATE
TABLE
t2
;
DROP
TABLE
t1
;
--
echo
###############################################
--
echo
### assertion: No event for 'TRUNCATE TABLE t2'
--
echo
###############################################
--
source
include
/
show_binlog_events
.
inc
--
echo
###############################################
RESET
MASTER
;
CREATE
TEMPORARY
TABLE
t1
(
c1
int
)
Engine
=
InnoDB
;
INSERT
INTO
t1
VALUES
(
1
),
(
2
),
(
3
);
TRUNCATE
t1
;
DROP
TEMPORARY
TABLE
t1
;
--
echo
###############################################
--
echo
### assertion: No event for 'TRUNCATE TABLE t1'
--
echo
###############################################
--
source
include
/
show_binlog_events
.
inc
--
echo
###############################################
sql/sql_delete.cc
View file @
b0206c71
...
...
@@ -50,6 +50,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
SELECT_LEX
*
select_lex
=
&
thd
->
lex
->
select_lex
;
THD
::
killed_state
killed_status
=
THD
::
NOT_KILLED
;
DBUG_ENTER
(
"mysql_delete"
);
bool
save_binlog_row_based
;
THD
::
enum_binlog_query_type
query_type
=
thd
->
lex
->
sql_command
==
SQLCOM_TRUNCATE
?
...
...
@@ -293,6 +294,11 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
table
->
mark_columns_needed_for_delete
();
save_binlog_row_based
=
thd
->
current_stmt_binlog_row_based
;
if
(
thd
->
lex
->
sql_command
==
SQLCOM_TRUNCATE
&&
thd
->
current_stmt_binlog_row_based
)
thd
->
clear_current_stmt_binlog_row_based
();
while
(
!
(
error
=
info
.
read_record
(
&
info
))
&&
!
thd
->
killed
&&
!
thd
->
is_error
())
{
...
...
@@ -342,6 +348,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
else
table
->
file
->
unlock_row
();
// Row failed selection, release lock on it
}
thd
->
current_stmt_binlog_row_based
=
save_binlog_row_based
;
killed_status
=
thd
->
killed
;
if
(
killed_status
!=
THD
::
NOT_KILLED
||
thd
->
is_error
())
error
=
1
;
// Aborted
...
...
@@ -390,7 +397,10 @@ cleanup:
/* See similar binlogging code in sql_update.cc, for comments */
if
((
error
<
0
)
||
thd
->
transaction
.
stmt
.
modified_non_trans_table
)
{
if
(
mysql_bin_log
.
is_open
())
if
(
mysql_bin_log
.
is_open
()
&&
!
(
thd
->
lex
->
sql_command
==
SQLCOM_TRUNCATE
&&
thd
->
current_stmt_binlog_row_based
&&
find_temporary_table
(
thd
,
table_list
)))
{
bool
const
is_trans
=
thd
->
lex
->
sql_command
==
SQLCOM_TRUNCATE
?
...
...
@@ -1059,15 +1069,13 @@ bool multi_delete::send_eof()
static
bool
mysql_truncate_by_delete
(
THD
*
thd
,
TABLE_LIST
*
table_list
)
{
bool
error
,
save_binlog_row_based
=
thd
->
current_stmt_binlog_row_based
;
bool
error
;
DBUG_ENTER
(
"mysql_truncate_by_delete"
);
table_list
->
lock_type
=
TL_WRITE
;
mysql_init_select
(
thd
->
lex
);
thd
->
clear_current_stmt_binlog_row_based
();
error
=
mysql_delete
(
thd
,
table_list
,
NULL
,
NULL
,
HA_POS_ERROR
,
LL
(
0
),
TRUE
);
ha_autocommit_or_rollback
(
thd
,
error
);
end_trans
(
thd
,
error
?
ROLLBACK
:
COMMIT
);
thd
->
current_stmt_binlog_row_based
=
save_binlog_row_based
;
DBUG_RETURN
(
error
);
}
...
...
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