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
a3e6b30a
Commit
a3e6b30a
authored
Apr 05, 2005
by
heikki@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handler.cc, ha_innodb.cc:
Fix Bug #8650 : InnoDB does not rollback SQL statement at an error
parent
680f7d3b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
19 deletions
+43
-19
sql/ha_innodb.cc
sql/ha_innodb.cc
+40
-16
sql/handler.cc
sql/handler.cc
+3
-3
No files found.
sql/ha_innodb.cc
View file @
a3e6b30a
...
...
@@ -748,17 +748,37 @@ ha_innobase::update_thd(
}
/*************************************************************************
Registers the InnoDB transaction in MySQL, to receive commit/rollback
events. This function must be called every time InnoDB starts a
transaction internally. */
static
Registers that InnoDB takes part in an SQL statement, so that MySQL knows to
roll back the statement if the statement results in an error. This MUST be
called for every SQL statement that may be rolled back by MySQL. Calling this
several times to register the same statement is allowed, too. */
inline
void
register_trans
(
/*===========*/
THD
*
thd
)
/* in:
thd to use the handle
*/
innobase_register_stmt
(
/*===========
========
*/
THD
*
thd
)
/* in:
MySQL thd (connection) object
*/
{
/* Register the sta
rt of the sta
tement */
/* Register the statement */
trans_register_ha
(
thd
,
FALSE
,
&
innobase_hton
);
}
/*************************************************************************
Registers an InnoDB transaction in MySQL, so that the MySQL XA code knows
to call the InnoDB prepare and commit, or rollback for the transaction. This
MUST be called for every transaction for which the user may call commit or
rollback. Calling this several times to register the same transaction is
allowed, too.
This function also registers the current SQL statement. */
inline
void
innobase_register_trx_and_stmt
(
/*===========================*/
THD
*
thd
)
/* in: MySQL thd (connection) object */
{
/* NOTE that actually innobase_register_stmt() registers also
the transaction in the AUTOCOMMIT=1 mode. */
innobase_register_stmt
(
thd
);
if
(
thd
->
options
&
(
OPTION_NOT_AUTOCOMMIT
|
OPTION_BEGIN
))
{
...
...
@@ -914,7 +934,7 @@ innobase_query_caching_of_table_permitted(
if
(
trx
->
active_trans
==
0
)
{
register_trans
(
thd
);
innobase_register_trx_and_stmt
(
thd
);
trx
->
active_trans
=
1
;
}
...
...
@@ -1030,7 +1050,7 @@ ha_innobase::init_table_handle_for_HANDLER(void)
if
(
prebuilt
->
trx
->
active_trans
==
0
)
{
register_trans
(
current_thd
);
innobase_register_trx_and_stmt
(
current_thd
);
prebuilt
->
trx
->
active_trans
=
1
;
}
...
...
@@ -1421,7 +1441,7 @@ innobase_start_trx_and_assign_read_view(
if
(
trx
->
active_trans
==
0
)
{
register_trans
(
current_thd
);
innobase_register_trx_and_stmt
(
current_thd
);
trx
->
active_trans
=
1
;
}
...
...
@@ -5544,8 +5564,10 @@ ha_innobase::start_stmt(
/* Set the MySQL flag to mark that there is an active transaction */
if
(
trx
->
active_trans
==
0
)
{
register_trans
(
thd
);
innobase_register_trx_and_stmt
(
thd
);
trx
->
active_trans
=
1
;
}
else
{
innobase_register_stmt
(
thd
);
}
return
(
0
);
...
...
@@ -5616,8 +5638,10 @@ ha_innobase::external_lock(
transaction */
if
(
trx
->
active_trans
==
0
)
{
register_trans
(
thd
);
innobase_register_trx_and_stmt
(
thd
);
trx
->
active_trans
=
1
;
}
else
if
(
trx
->
n_mysql_tables_in_use
==
0
)
{
innobase_register_stmt
(
thd
);
}
trx
->
n_mysql_tables_in_use
++
;
...
...
@@ -5780,7 +5804,7 @@ ha_innobase::transactional_table_lock(
/* Set the MySQL flag to mark that there is an active transaction */
if
(
trx
->
active_trans
==
0
)
{
register_trans
(
thd
);
innobase_register_trx_and_stmt
(
thd
);
trx
->
active_trans
=
1
;
}
...
...
sql/handler.cc
View file @
a3e6b30a
...
...
@@ -520,14 +520,14 @@ void trans_register_ha(THD *thd, bool all, handlerton *ht_arg)
else
trans
=
&
thd
->
transaction
.
stmt
;
#ifndef DBUG_OFF
handlerton
**
ht
=
trans
->
ht
;
while
(
*
ht
)
{
DBUG_ASSERT
(
*
ht
!=
ht_arg
);
if
(
*
ht
==
ht_arg
)
DBUG_VOID_RETURN
;
/* already registered, return */
ht
++
;
}
#endif
trans
->
ht
[
trans
->
nht
++
]
=
ht_arg
;
trans
->
no_2pc
|=
(
ht_arg
->
prepare
==
0
);
if
(
thd
->
transaction
.
xid
.
is_null
())
...
...
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